rubocop-git icon indicating copy to clipboard operation
rubocop-git copied to clipboard

rubocop-git doesn't support per cop Excludes

Open simonrand opened this issue 8 years ago • 4 comments
trafficstars

Adding the following to .rubocop.yml works when running rubocop, however this has no effect when running rubocop-git.

Metrics/BlockLength:
  Exclude:
    - "**/*_spec.rb"

It looks to me (correct me if I'm wrong) rubocop-git doesn't check if a file should be included on a per cop level, it only respects the AllCops Exclude value.

Given the current implementation of only checking exclusions and then passing the source to all cops (https://github.com/m4i/rubocop-git/blob/master/lib/rubocop/git/style_guide.rb#L15-L16) - I'm not sure how to easily support these per cop Excludes without completely rethinking how the cops are run - has anyone any thoughts?

simonrand avatar Apr 13 '17 11:04 simonrand

I've added a PR #33 to deal with it.

blelump avatar Aug 17 '17 14:08 blelump

I need this merged!

StephanMeijer avatar Jan 02 '18 12:01 StephanMeijer

Yeah, me too!

tsujigiri avatar Jan 23 '18 16:01 tsujigiri

if anyone is still using this, i've release a forked gem, rubocop-git2, with this and other fixes included

jaynetics avatar Mar 24 '23 21:03 jaynetics