Mik
Mik

Reputation: 41

Why is SwiftLint whitelist_rules not working on my project?

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,

What am I missing? Why isn't it working?

Upvotes: 2

Views: 1473

Answers (1)

caperonce
caperonce

Reputation: 89

In case anyone had recent issues with whilelist_rules configuration key, notice that it was renamed to only_rules in version 0.41.0

https://github.com/realm/SwiftLint/releases/tag/0.41.0

Upvotes: 4

Related Questions