autocorrect

This commit is contained in:
Sven Weidauer 2024-08-03 19:23:03 +02:00
parent 120bb4b79a
commit 604fe35be6
3 changed files with 3 additions and 3 deletions

View file

@ -17,7 +17,7 @@ parser = OptionParser.new do |opt|
<<~DOC
Shell command to format files, will run once per file. Occurrences of the placeholder `{}` will \
be replaced with a path to the file being formatted. \
(Example: "prettier --stdin-filepath \'{}\'")
(Example: "prettier --stdin-filepath '{}'")
DOC
) do |o|
parameters[:formatter] = o

View file

@ -39,7 +39,7 @@ module FormatStaged
return false unless formatted.size == files.size
quiet = @verbose ? [] : ['--quiet']
return !write || get_status('git', 'diff-index', '--cached', '--exit-code', *quiet, 'HEAD') != 0
!write || get_status('git', 'diff-index', '--cached', '--exit-code', *quiet, 'HEAD') != 0
end
def repo_root

View file

@ -132,7 +132,7 @@ describe FormatStaged do
repo.set_content 'test.test', 'a=b'
repo.stage 'test.test'
expect(repo.run_formatter write: false).to be_truthy
expect(repo.run_formatter(write: false)).to be_truthy
expect(repo.get_content('test.test')).to eq 'a=b'
expect(repo.get_staged('test.test')).to eq 'a=b'
end