Skip to content

Regenerate RuboCop todo#2234

Merged
jneen merged 1 commit intorouge-ruby:mainfrom
larouxn:regen_rubocop_todo
Feb 27, 2026
Merged

Regenerate RuboCop todo#2234
jneen merged 1 commit intorouge-ruby:mainfrom
larouxn:regen_rubocop_todo

Conversation

@larouxn
Copy link
Copy Markdown
Contributor

@larouxn larouxn commented Feb 27, 2026

Description

Quick PR to regenerate the RuboCop todo as it's slightly out of date. Gives us more explicit lists too!

Relevant PRs

How?

bundle exec rubocop --auto-gen-config --exclude-limit 50

@jneen
Copy link
Copy Markdown
Member

jneen commented Feb 27, 2026

Is it possible to leave the list of offences intact for Rouge/NoBuildingAlternationPatternInRegexp?

@larouxn
Copy link
Copy Markdown
Contributor Author

larouxn commented Feb 27, 2026

Is it possible to leave the list of offences intact for Rouge/NoBuildingAlternationPatternInRegexp?

I was wondering the same as I had manually ensured it was explicit in the the original cop PR. Turns out, there is a way. We simply need to use the following command for todo regen to ensure the exclude limit is high enough that it lists the explicit entries. exclude-limit appears to be 15 by default. I think 50 should be sufficient.

bundle exec rubocop --auto-gen-config --exclude-limit 50

Note, the command used to generate the todo is available at the top of the file in a comment, for reference.

@jneen jneen added this pull request to the merge queue Feb 27, 2026
Merged via the queue into rouge-ruby:main with commit cdb8770 Feb 27, 2026
10 checks passed
@larouxn larouxn deleted the regen_rubocop_todo branch February 27, 2026 15:48
@jneen
Copy link
Copy Markdown
Member

jneen commented Feb 27, 2026

@larouxn do you have a sense of why bundle exec rubocop and bundle exec rake check:style are different? the latter is giving me duplicate set elements from e.g. the ISBL lexer.

@larouxn
Copy link
Copy Markdown
Contributor Author

larouxn commented Feb 27, 2026

👋 @jneen, I believe that is because while bundle exec rubocop ignores lexers/**/keywords.rb and lexers/**/builtins.rb according to the all cops exclude RuboCop config we added back in #2205, bundle exec rake check:style seemingly overrides which files to lint via its task.patterns config and thus includes those keywords.rb and builtins.rb files during its linting.

rouge/.rubocop.yml

Lines 17 to 18 in 3d57c38

- "lib/rouge/lexers/**/keywords.rb"
- "lib/rouge/lexers/**/builtins.rb"

task.patterns = ["bin/**/*", "lib/**/*.rb", "spec/**/*.rb"]

image

If we want we can remove the all cops excludes for keywords and builtins from the RuboCop config if we're now confident in the uniqueness of the, if I recall correctly, generated files.

@jneen
Copy link
Copy Markdown
Member

jneen commented Feb 27, 2026

Is it possible to make the rake task respect .rubocop.yml? I'm not too familiar with how the Rake configuration works.

@larouxn
Copy link
Copy Markdown
Contributor Author

larouxn commented Feb 27, 2026

It does in fact already respect it for cops and whatnot but that task.patterns forces it to skip over the file exclusion. However, we should be able to add a --force-exclusion flag to the rake style task so that it respects the .rubocop.yml exclusions. (docs)

Note, the small difference in number of files is because the rake style only checks bin, lib, and spec while RuboCop includes root level files (i.e. Gemfile) as well.

Screenshot From 2026-02-27 13-55-34

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.

2 participants