Skip to content

Option parsing is too eager

gitlab-qa-bot requested to merge prevent_eager_usage_of_-i into master

Created by: JonRowe

Test case: Run rspec with this .rspec file:

--format d --order random -I ./app/models -I ./app/services -I ./app/contexts --I ./app/repositories

When you do, rspec will repeatedly try to run as if you'd specified "rspec --init". That's because the last option in the .rspec file is typoed; it should be -I instead of --I.

As a result, the option is parsed as if you'd typed --init, but you meant -I.

Suggestion: rspec should only parse options exactly as written, with no coercion. It should be an error to specify an option that is not recognized exactly.

Merge request reports