-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fixes warning about configurations for rules that are not enabled, when they are enabled in a parent config #4864
Fixes warning about configurations for rules that are not enabled, when they are enabled in a parent config #4864
Conversation
Generated by 🚫 Danger |
aaf59ed
to
a1a47ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I lost a bit the overview. Perhaps my comments/questions are stupid. But somehow the disabled rules must be taken into account, isn't it?
Source/SwiftLintFramework/Extensions/Configuration+Parsing.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Extensions/Configuration+Parsing.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Extensions/Configuration+Parsing.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Extensions/Configuration+Parsing.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Extensions/Configuration+Parsing.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Extensions/Configuration+Parsing.swift
Outdated
Show resolved
Hide resolved
60c3bed
to
5a27b97
Compare
I think you're right about disabled - I'll put together some local test cases to verify those, athough I'll try to find a configurable non-optin rule to test with because of #4859 |
538b3b8
to
491bea8
Compare
2cccc14
to
9fb9619
Compare
270ae47
to
ec30ced
Compare
fac976e
to
0f10a37
Compare
4869293
to
aa434ff
Compare
aa434ff
to
8314415
Compare
b53c0d6
to
75381d7
Compare
077c2bc
to
8a3f4d1
Compare
3405c7c
to
cf06542
Compare
03010b4
to
60a6162
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow ... this has been a tough topic! After almost one year after this got opened, it will finally be merged. 😅
Thank you so much for your patience and the continuous improvements and rework!
No problem. We got there in the end :-) |
Fixes #4858
The problem here is configurations like this:
with child configurations like this:
SwiftLint will report
warning: Found a configuration for 'implicit_return' rule, but it is not enabled on 'opt_in_rules'.
for the child config, even though it will correctly apply the new config.We now pass in the parent configuration when validating rule configurations for the child, and do not complain about configurations where that rule is enabled in the parent.
There should be no change in behaviour at all here - just a change in the warnings.
Getting this correct turned out to be quite complex, but after this PR, it should be the case that whenever, and only when, a rule is disabled in the parent or "child" config, a warning message will be printed, and the exact warning will vary somewhat, depending on whether the rule is disabled in the parent or "child", or not enabled at all.
There is a separate issue with
child_config
that this PR does not attempt to address - See #5251