rubocop / rubocop

A Ruby static code analyzer and formatter, based on the community Ruby style guide.

Home Page:https://docs.rubocop.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`--auto-gen-config --auto-gen-only-exclude` should generate a list of LineLength offending files

brkn opened this issue · comments

Expected behavior

Running rubocop --auto-gen-config --auto-gen-only-exclude should create a list of LineLength offending files. Example before version 1.62.1

# Offense count: 231
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
  Exclude:
    - 'app/models/book.rb'
    - 'app/models/author.rb'

Actual behavior

The command outputs this instead.

Phase 1 of 2: run Layout/LineLength cop (skipped because only excludes will be generated due to `--auto-gen-only-exclude` flag)
Phase 2 of 2: run all cops

And then todo file contains this block instead

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
  Max: 842

This behaviour changed at #12730

Steps to reproduce the problem

  1. Have files violating the Layout/LineLength rule.
  2. run rubocop --auto-gen-config --auto-gen-only-exclude

RuboCop version

❯ bundle exec rubocop -V 
1.62.1 (using Parser 3.3.0.5, rubocop-ast 1.31.2, running on ruby 2.7.8) [arm64-darwin22]
  - rubocop-capybara 2.20.0
  - rubocop-factory_bot 2.25.1
  - rubocop-rails 2.24.1
  - rubocop-rspec 2.29.1

Nevermind, this happens because I switched from --exclude-limit 9999999 to --no-exclude-limit