KEMBAR78
Ability to specify files/directories to look at and ignore everything else · Issue #4247 · rubocop/rubocop · GitHub
Skip to content

Ability to specify files/directories to look at and ignore everything else #4247

@olegantonyan

Description

@olegantonyan

Situation:
A big old project written without any specific style. It's impossible to integrate Rubocop to the whole project. But, it's possible to enable it for new code only and incrementally add new directories as we go.

What I want to do:
Add global .rubocop.yml to the project and specify directories to look at. Everything else should be ignored. We're going to add more directories to that list as we go, but we need to start with a small step.

Right now the only way to do this looks very ugly and unreadable:

Exclude:
    - !ruby/regexp /^((?!(something|some\/other\/dir)).)*$/

I bet everyone will give up on this after a 10 directories added.

My first try was this:

Include:
    - 'something/**/*.rb'
Exclude:
  - '**/*'

I.e. exclude everything, but include these.

Second try was:

Include:
    - 'something/**/*.rb'

Ok, just include these, and I'm not telling you to include anything else, so why do you even look at ./*?

I'm not sure how syntax should look like, but I hope the problem was clear. Any thoughts appretiated

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions