-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AllCops > Include parameter isn't behaving as expected #10802
Comments
I have not been able to reproduce. Tried on your branch in
|
@jonas054 in bson-ruby, try running |
Ah, OK. With the submodule checked out, I get inspection of 3 additional files:
Do you get the same? Because those are executables and they get inspected even though they're not matched by the |
@jonas054 yes, I get the same.
The point of this ticket is to fix this behavior, even though Rubocop has been this way for a long time. |
I've realized that there is a good reason for this behavior. You can't specify extensionless executable ruby files with a pattern. That's why they have to be included by default. |
@jonas054 I don't see why that's a good reason. We should include extensionless Ruby files only if they satisfy the pattern. For example, given
Would this be fine to change the behavior? |
The problem is that including fewer files by default would be a breaking change. We would either have to wait until RuboCop 2.0 to introduce it, or come up with some backwards compatible way to achieve the same thing. I guess it would be possible to add a configuration parameter The question is, would we have to support the new parameter for departments and cops too? Could get tricky. |
I think your proposal above is good. OK to raise a PR for this? |
I'm OK with that, if you want to do it. I'll review but leave it to someone else to merge, so we get more eyes on it. |
For context, the ability to scan extensionless executables was added in #58. I'm not exactly sure why these executables don't operate under the same rules of I agree with @jonas054 that adding a configuration (defaulting to match existing behaviour) would be a good migration path. I've been trying to come up with a better name but this is a hard concept to name succinctly... perhaps In any case, the documentation should be updated to better reflect the current behaviour. |
To clarify the requirements expressed in mongodb/bson-ruby#284: the request is for rubocop to be configured to check a specific subdirectory of the project only (in this case |
Given a very simple
.rubocop.yml
in my project root:I expect that running
$project-root/>rubocop
on the command line should only scan files in the rootlib
dir, and exclude all else. Currently, this seems to be picking up files outside lib, even some files that don't havelib
at all in their path. Please try it on a few projects you should get the same result.The text was updated successfully, but these errors were encountered: