-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Declare --stdin with FILE argument for better help text #4226
Conversation
2d94a1c
to
8ba169e
Compare
lib/rubocop/options.rb
Outdated
if @options[:stdin] && !args.one? | ||
raise ArgumentError, '-s/--stdin requires exactly one path.' | ||
if @options[:stdin] | ||
if args.any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the error message shouldn't we check if args
has a size of 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change the file name given to --stdin
is now an argument to the option, so it doesn't go into args
. I can add a comment clarifying this. Or change the message to "No other files can be given when --stdin
is used"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you can do both. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the wording of the error message, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end I couldn't come up with a message that better than the one we've got, so I only updated the comments.
Before this change it is not apparent from the help text that -s/--stdin takes a file name argument.
8ba169e
to
4b67947
Compare
Hi @jonas054, this has broken an Atom plugin that I use, Before I make an issue... I'm just wondering if this new stricter behaviour is intended, if it is I'll make the issue/PR in their repo instead. |
@savef The new stricter behavior is sort of a byproduct of the better description from |
OK! 😄 |
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. Also, the tests were enhanced that involved the bear to be run on files with the `.rb` (ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. Also, the tests were enhanced that involved the bear to be run on files with the `.rb` (ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. Also, the tests were enhanced that involved the bear to be run on files with the `.rb` (ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. A part of the fixing was to improve the tests that involved the bear to be run on files with the `.rb`(ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. A part of the fixing was to improve the tests that involved the bear to be run on files with the `.rb`(ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. A part of the fixing was to improve the tests that involved the bear to be run on files with the `.rb`(ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. A part of the fixing was to improve the tests that involved the bear to be run on files with the `.rb`(ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. A part of the fixing was to improve the tests that involved the bear to be run on files with the `.rb`(ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. A part of the fixing was to improve the tests that involved the bear to be run on files with the `.rb`(ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
rubocop/rubocop#4226 indicates that `--stdin` takes filename as an argument which was incorporated. A part of the fixing was to improve the tests that involved the bear to be run on files with the `.rb`(ruby) extension because initially the bear was run on the generated temporary files that was the cause of error. Fixes coala#1548
Before this change it is not apparent from the help text that
-s
/--stdin
takes a file name argument.