Skip to content

Demo of `rubocop --auto-gen-config` failing to exclude files after discovering `snake_case` config

Notifications You must be signed in to change notification settings

sambostock/rubocop-auto-gen-config-missing-exclude-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rubocop-auto-gen-config-missing-exclude-demo

This repository demonstrates a bug with

% rubocop --auto-gen-config

It correctly detects that the majority of files adhere to the snake_case method naming convention.

# good/*.rb
def good
end

However, while this file violates the convention

# bad/zero.rb
def Bad
end

no Exclude section is added to .rubocop_todo.yml, whereas it is for other cops.

 # This configuration was generated by
 # `rubocop --auto-gen-config`
 # on 2023-12-27 00:45:53 UTC using RuboCop version 1.59.0.
 # The point is for the user to remove these configuration records
 # one by one as the offenses are removed from the code base.
 # Note that changes in the inspected code, or installation of new
 # versions of RuboCop, may require this file to be generated again.
 
 # Offense count: 1
 # Configuration parameters: AllowedPatterns.
 # SupportedStyles: snake_case, camelCase
 Naming/MethodName:
   EnforcedStyle: snake_case
-  Exclude:
-    - 'bad/zero.rb'
 
 # Offense count: 1
 # This cop supports unsafe autocorrection (--autocorrect-all).
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: always, always_true, never
 Style/FrozenStringLiteralComment:
   Exclude:
     - 'bad/zero.rb'

This leaves the repository with offenses, despite having just run --auto-gen-config.

% rubocop
Inspecting 7 files
.C.....

Offenses:

bad/zero.rb:2:7: C: Naming/MethodName: Use snake_case for method names.
  def Bad
      ^^^

7 files inspected, 1 offense detected

About

Demo of `rubocop --auto-gen-config` failing to exclude files after discovering `snake_case` config

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages