standardrb / standard-rails

A Standard Ruby plugin that configures rubocop-rails
MIT License
162 stars 15 forks source link

How to override a cop? #29

Closed danieldocki closed 1 week ago

danieldocki commented 6 months ago

I would like to add the copy below, is it possible?

Rails/DynamicFindBy:
  Whitelist:
    - find_by_prefix_id
markokajzer commented 4 months ago

From https://github.com/standardrb/standard

provides an unconfigurable configuration

Also see https://github.com/standardrb/standard?tab=readme-ov-file#wait-did-you-say-unconfigurable-configuration

mjankowski commented 3 months ago

I found this article incredibly useful to work through how to choose between stock standard -vs- using standard rules from rubocop -- https://evilmartians.com/chronicles/rubocoping-with-legacy-bring-your-ruby-code-up-to-standard

My conclusion was pretty similar to the article - just use standard directly on new projects from scratch; and use standard-via-rubocop (see the inherit_from and inherit_gem approaches they describe about half way through) on legacy projects where doing so would be prohibitive and/or you really need to override something.

(Although note, as acknowledged in the article, this is not an officially supported integration and hypothetical one or both tools could break the "interface" at any time ... it just happens to work right now and likely near term future...)

dogweather commented 2 months ago

See https://github.com/standardrb/standard?tab=readme-ov-file#ignoring-specific-rules-in-files-and-globs

ignore:
  - 'test/**/*':
    - Layout/AlignHash