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

Use absolute path to support Cop Exclude param

Open blelump opened this issue 8 years ago • 7 comments

When Exclude param is used for a cop, ie:

Metrics/BlockLength:
  Exclude:
    - 'spec/**/*.rb'

Rubocop internally checks these strings using the match_pattern? method and since the pattern arg is given as project root + pattern, it never works for relative paths. It would, however, work for a path defined as regexp, ie:

Metrics/BlockLength:
  Exclude:
    - !ruby/regexp /spec\/.*\/.*_spec.rb$/

however I think it's convenient to support string paths in order to allow '**' pattern as well.

blelump avatar Aug 17 '17 14:08 blelump

@blelump what is the status of this?

madslundholmdk avatar Feb 09 '18 08:02 madslundholmdk

@madslundholmdk , what do you mean?

blelump avatar Feb 09 '18 09:02 blelump

@blelump why isn't this merged yet?

madslundholmdk avatar Feb 09 '18 09:02 madslundholmdk

@madslundholmdk , this is just my PR for a particular problem :-) . Whether the PR will be merged or not eventually , depends on the repo owner (which I am not).

blelump avatar Feb 09 '18 09:02 blelump

@m4i can this be merged? I just tested it, and it fix my issue #38

madslundholmdk avatar Feb 21 '18 07:02 madslundholmdk

@m4i this change worked for me too. Do you need any help to merge this?

For now I'm using specific_install to use this fix: gem specific_install -l [email protected]:blelump/rubocop-git.git -r 79a6579b7ebbd82890c32f536fe78472fe816071

tiagoefmoraes avatar Apr 02 '18 19:04 tiagoefmoraes

I just switched my config to use the regex from the OP...not sure what downsides might be though 🤷‍♂

tfwright avatar Nov 23 '19 00:11 tfwright