Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer raise a RuntimeError if an input file was not formatted wel… #6

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lib/gherkin_format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ def format(file, options = {})
output = format_string input, file
return if input == output

File.write(file, output) if options.key? :replace
if options.key? :replace
File.write(file, output)
puts "File #{file} was not formatted well. Fixed it for you!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove the you?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

else
puts "File #{file} is not formatted well. Re-run with --replace"
end

fail_with 'Terminating. Some files may not have been checked.'
end

puts "File #{file} is not formatted well."
raise "File #{file} is not formatted well."
def fail_with(message)
puts message
exit 1
end

def render(template, files)
Expand Down