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

Allow #ruby for Ruby version comment style on LeadingCommentSpace #7577

Merged

Conversation

cetinajero
Copy link
Contributor

@cetinajero cetinajero commented Dec 19, 2019

This PR removes the offense for comments that starts with #ruby as this style is
a valid syntax to write Ruby versions in Gemfile that can be used with bundler, RVM, and others.

Example:

  # Specific version (comment) will be used by RVM
  #ruby=2.7.0
  #ruby-gemset=myproject
  ruby '~> 2.7.0'

Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@cetinajero cetinajero force-pushed the ruby_version_leading_comment_space branch 3 times, most recently from 9ade057 to 83dfb43 Compare December 19, 2019 20:51
@bbatsov
Copy link
Collaborator

bbatsov commented Dec 31, 2019

I'm fine with adding this, but with a related configuration option. I don't want to introduce a performance penalty for people who are not using this. The description of the cop should also be expanded to reflect this.

@cetinajero
Copy link
Contributor Author

Thanks @bbatsov,

How about a configuration option like this one:

config/default.yml:

AllowGemfileRubyComment: false

@cetinajero cetinajero force-pushed the ruby_version_leading_comment_space branch from 83dfb43 to 7753212 Compare January 9, 2020 18:09
This PR remove the offense for comments that starts with `#ruby` as this style is
a valid syntax to write Ruby versions in Gemfile that can be used with bundler, RVM, and others.

Example:

```ruby
  # Specific version (comment) will be used by RVM
  #ruby=2.7.0
  #ruby-gemset=myproject
  ruby '~> 2.7.0'
```
@cetinajero cetinajero force-pushed the ruby_version_leading_comment_space branch from 7753212 to 6eb457f Compare January 9, 2020 18:24
@cetinajero
Copy link
Contributor Author

cetinajero commented Jan 9, 2020

All done 👍

  • Branch rebased to master tip
  • Added AllowGemfileRubyComment config option disabled by default
  • Updated test cases with new config option
  • Added documentation
  • All CI checks passing

If anything seems wrong or something has to be changed, please let me know.

@bbatsov bbatsov merged commit d689522 into rubocop:master Feb 4, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Feb 4, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants