Search code examples
swiftswiftlint

SwiftLint: how to configure rule severity for a rule with warning and error configurations


I would like to configure the Swiftlint cyclomatic_complexity rule to always have the severity level of warning.

Here are the approaches I have tried in the .swiftlint.yml.

cyclomatic_complexity: warning
cyclomatic_complexity: 
  severity: warning

Both of these yield the same result. Namely, upon running swiftlint, before linting it prints the following error.

Invalid configuration for 'cyclomatic_complexity'. Falling back to default.

How do you configure the severity of this rule for swiftlint, so that it only generates warnings and not errors?


Solution

  • # .swiftlint.yml
    cyclomatic_complexity: 20