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
[Fix #6289] Naming/FileName: Add ExpectMatchingClass option #7780
Conversation
96fabf8
to
920905a
Compare
I think it's much better to just add an option for checking the path hierarchy instead, as it seems the new option you introduced is the same as the other sans the path checking. For me the suggested solution is confusing, but valuable - let's simplify it. :-) |
Bozhidar, thanks for the comment! I'd like to fix up this PR to address your suggestion; however, I'm not entirely sure what you're suggesting -- could you please clarify? The
This PR's new proposed option ( Are you suggesting that we add an additional new option that would check only item 1 above? Such that we'd end up with
I'd be happy to take that on -- I just want to check my understanding of whether that's what you're suggesting, first. 🙂 |
@bbatsov, this is 100% not urgent, but I wanted to bump my above question for you, just in case you hadn't seen it yet. 🙂 |
Sorry about the slow reply. My bad, my previous reply was completely wrong. I was under the impression that the cop already was checking for some definition and I had assumed you wanted to limit the full path checking and focus only on checking for a definition. I saw this was not the case, so it seems everything's good with your PR. Just rebase to resolve the merge conflict, please. |
Ah, forget what I said. I'm too tired for meaningful replies. Actually seems I wasn't wrong last time around! What I meant was that instead of having |
0d85eb5
to
d03dfb9
Compare
Ok! As per your suggestion, @bbatsov, I've adjusted this PR to instead add a new |
d03dfb9
to
640f458
Compare
I've rebased this PR to fix the typical merge conflict in the @bbatsov, is there anything else I can do to help with this at this point? 🙂 |
Thanks and sorry for forgetting about this PR! |
#6289 describes a limitation of the existing
ExpectMatchingDefinition: true
option on theNaming/FileName
cop: It generates false positives when run on a project with classes which (by design) aren't namespaced with modules to match their file paths.This PR addresses that issue by adding a new option to the
Naming/FileName
cop:CheckDefinitionPathHierarchy
. This defaults totrue
; if set tofalse
, it modifies theExpectMatchingDefinition
option to only check whether each source file's class or module name matches the file name -- not whether the nested module hierarchy matches the subdirectory path.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.