Skip to content

Automatically disable rules with lots of violations in --gen-config #617

Description

@straight-shoota

--gen-config produces a list of excludes to disable a rule in all the files that violate it.
When a rule is violated in many files, this list grows so large that it's not very practical to use.

For example, running ameba --gen-config on https://github.com/crystal-lang/crystal found 584 violations of the Lint/NotNil rule in 151 different files. There's not much point in listing that many files. The exact filenames are largely noise (cf. #566) and provide no meaningful information.

To reduce the weight of the generated config, we can entirely disable a rule when the excludes list would be very long

Rubocop does this as well: https://docs.rubocop.org/rubocop/configuration.html#automatically-generated-configuration
If the number of excluded files is more then 15, it replaces the exclude list with an Enabled: false. The limit is configurable with the --exclude-limit option. It can be disabled with --no-exclude-limit.
I suggest implementing the same behaviour with the same options in ameba.

Maybe --no-exclude-limit is unnecessary and could be expressed as --exclude-limit=0.

Previous discussion in #566

Activity

  1. added theissue type on Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions