rspec / rspec-core

RSpec runner and formatters
http://rspec.info
MIT License
1.23k stars 765 forks source link

Cannot comment out lines in .rspec #2985

Closed JunichiIto closed 1 year ago

JunichiIto commented 2 years ago

Subject of the issue

As far as I see, there is no way to comment out lines in .rspec

Your environment

Steps to reproduce

Save .rspec like this:

# --format d

And run specs:

bundle exec rspec

Expected behavior

The format option is ignored.

Actual behavior

The format option (--format d) is applied.

I think it would be useful if we can comment out configurations in .rspec by putting # .

This PR resolves this: https://github.com/rspec/rspec-core/pull/2984

JonRowe commented 2 years ago

Why not just delete the lines? The .rspec file is expected to contain shell like commands and comments would not be valid on the command line either?

JunichiIto commented 2 years ago

Here is my use case. I added the line below for an experimental purpose:

--tag ~slow

And I wanted to run all tests, so I added #, but it didn't work (--tag ~slow is still applied):

# --tag ~slow

Of course, I can delete the line, but I need to type --tag ~slow again if I want to revert it. Adding/removing # is much more useful than deleting/typing all charactors.

Moreover, config files such as .gitignore, .zshrc or .env support commenting out with #, so I expect .rspec would also work in the same way. It was surprising for me when I saw # was just ignored and --tag ~slow was applied. It was difficult for me to expect such a behvior.

I guess supporting # comment would be useful and easy to understand for the most developers.