-
-
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
Whitelist the Rakefile and Gemfile from name check #878
Conversation
When building a Ruby project it's very common that you'll have a Rakefile and a Gemfile. These files are normally capitalized, which violates the default Rubocop filename checks. This changeset adds a whitelist for base filenames that should *NOT* be included in the file_name checks. This works by adding a constant to the FileName class, WHITELIST, which is an Array that contains the whitelisted basenames. Later on, it will only add an offense if the basename is not snake case, and the basename is not Rakefile or Gemfile. I've updated the tests for this specific use case and have confirmed that all tests pass on my local system. -Tim
Could you explain your situation where RuboCop registers offenses for Normally RuboCop inspect files with |
I found this behavior with the following configuration in my Rakefile caused my CI to fail the build: Rubocop::RakeTask.new(:rubocop) do |t|
t.patterns = %w{ Rakefile Gemfile rmuh.gemspec lib/**/*.rb spec/*_spec.rb }
t.fail_on_error = true
end I wanted to make sure my Rakefile and Gemfile both are within rubocop compliancy. If there is a better option that doesn't require this patch I'm open for suggestions. |
@theckman You can either list the files in |
@yujinakayama Every cop has |
Totally. I must have been copy-pasting an entry with a typo. :-) Should be more careful. I’ll fix both issues now. Cheers, On Friday, March 14, 2014 at 6:45 PM, Yuji Nakayama wrote:
|
When building a Ruby project it's very common that you'll have a Rakefile and a Gemfile. These files are normally capitalized, which violates the default Rubocop filename checks. This changeset adds a whitelist for base filenames that should NOT be included in the file_name checks.
This works by adding a constant to the FileName class, WHITELIST, which is an Array that contains the whitelisted basenames. Later on, it will only add an offense if the basename is not snake case, and the basename is not Rakefile or Gemfile.
I've updated the tests for this specific use case and have confirmed that all tests pass on my local system.
-Tim