I'm trying to configure swiftlint in my project and white_list is not working.
Here is what I'm trying to do:
my .swiftlint.yml:
whitelist_rules:
- force_cast: warning
my code:
let forceCast: Int = "hue" as! Int
which gives me the error:
Force Cast Violation: Force casts should be avoided. (force_cast)
when I expect it to give me only a warning, not an error. Beyond this example, no other rule is working when on whitelist.
I know swiftlint is reading my .swiftlint.yml because I tested it with disabled_rules and it seemed to be working fine, so it's not a matter with the path of my .swiftlint.yml file.
Also, for the record,
- I have configured correctly the Run Script Phase
- I am not using
whitelist_rulesalong withdisabled_rulesandopt_in_rules, I'm using onlywhitelist_rules. - I'm using swiftlint version 0.40.3, xcode 11.3, ios 13.2 and swift 5
What am I missing? Why isn't it working?
In case anyone had recent issues with
whilelist_rulesconfiguration key, notice that it was renamed toonly_rulesin version 0.41.0https://github.com/realm/SwiftLint/releases/tag/0.41.0