Closed username0x0a closed 1 year ago
unused_declaration
is an analyzer rule so it should go in the analyzer_rules
section of your config file, not in opt_in_rules
.
When moving it from opt_in_rules
to a newly created analyzer_rules
, it makes no difference. Also it doesn't complain about different, unused_import
rule we also have in opt_in_rules
section now.
The warning only dismisses if I delete or comment out the configuration customisation placed on the root level:
# unused_declaration:
# severity: warning
So it complains about this part. 🤔
Thanks, @SimplyDanny! 👍 It would probably be also nice to check what @jpsim mentioned, that is placement of rules in proper sections. 🤔 'Cause at this moment, it can really be a bit confusing as we read (altho an Analyser rule) being Enabled by default: No
, one might really feel an urge to place it in opt_in_rules
instead of proper analyzer_rules
section, but it seems like it works anyway.
Yes, the current implementation doesn't care where Analyzer rules are placed. It might only be helpful for users to have these special rules separated.
We could add a warning recommending to place the rule in analyzer_rules
instead.
Thanks for digging into this @SimplyDanny, there were two issues and I was only seeing one of them.
New Issue Checklist
Describe the bug
Having
unused_declaration
enabled in the project like this:throws me a lot of console warnings:
Previously, SwiftLint 0.49.1 worked just fine with this setup, so I guess some syntax parsing issue is involved.
Complete output when running SwiftLint, including the stack trace and command used
Environment
0.50.1
Homebrew