Skip to content
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

Respect DisabledByDefault in parent configs #3713

Merged
merged 1 commit into from Nov 19, 2016

Conversation

aroben
Copy link
Contributor

@aroben aroben commented Nov 11, 2016

d956705 changed Config initialization such that Config#deprecation_check was called before resolving inheritance. Config#deprecation_check causes Config#for_all_cops to be lazily initialized to a new hash disconnected from Config's primary hash. Config#for_all_cops would thus not reflect any settings inherited from parent configs.

Essentially, it's an error for Config#for_all_cops to be called before inheritance is resolved. Perhaps this code could be made more robust. For now I've just rearranged config initialization such that things happen in the same order as prior to d956705.

/cc @NickLaMuro


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Used the same coding conventions as the rest of the project.
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • All tests are passing.
  • The new code doesn't generate RuboCop offenses.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Updated cop documentation with rake generate_cops_documentation (required only when you've added a new cop or changed the configuration/documentation of an existing cop).

@aroben aroben force-pushed the fix-inherited-disabled-by-default branch from 544392f to 674fe3f Compare November 11, 2016 21:40
@NickLaMuro
Copy link
Contributor

So I think the tests failing on the test I wrote in that commit are the reason I picked the order that I did. That all said, it has been so long since I looked at #3421 that I would have to take a bit to re-familiarize myself with the whole config setup to tell you for sure.

Regardless... sorry for breaking this... 😞

@jonas054
Copy link
Collaborator

The failing test case is about resolving configuration where the namespace is missing, i.e., we have LineLength rather than Metrics/LineLength. So the call to config.add_missing_namespaces must be done before the resolve_... methods. And maybe a second time after those calls.

@aroben aroben force-pushed the fix-inherited-disabled-by-default branch from 674fe3f to 4538186 Compare November 14, 2016 19:32
@aroben
Copy link
Contributor Author

aroben commented Nov 14, 2016

Whoops, I clearly forgot to run the whole test suite before opening this PR. I've fixed the failures and force-pushed. How's it look now?

@jonas054
Copy link
Collaborator

👍 LGTM. You just need to rebase because I'm so slow with the reviewing.

d956705 changed Config initialization
such that Config#deprecation_check was called before resolving
inheritance. Config#deprecation_check causes Config#for_all_cops to be
lazily initialized to a new hash disconnected from Config's primary
hash. Config#for_all_cops would thus not reflect any settings inherited
from parent configs.

Essentially, it's an error for Config#for_all_cops to be called before
inheritance is resolved. Perhaps this code could be made more robust.
For now I've just moved the deprecation check after resolving
inheritance as it was before d956705.
@aroben aroben force-pushed the fix-inherited-disabled-by-default branch from 4538186 to 0f81a13 Compare November 18, 2016 18:52
@aroben
Copy link
Contributor Author

aroben commented Nov 18, 2016

Rebased!

@bbatsov bbatsov merged commit 9128852 into rubocop:master Nov 19, 2016
@aroben aroben deleted the fix-inherited-disabled-by-default branch November 21, 2016 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants