0

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?

Ilias Karim
  • 4,798
  • 3
  • 38
  • 60

2 Answers2

0

Try this in .swiftlint.yml, it works for me:

cyclomatic_complexity:
warning: 10
error: 20
Buxlan
  • 11
  • 3
  • This is the default configuration. It generates an error for complexity over 20. I would like it to generate a warning even if the complexity is over 20. – Ilias Karim Jul 31 '21 at 14:20
  • 1
    Yes, it's default, but you can set if you want warning to 30 and error to 50. – Buxlan Jul 31 '21 at 14:37
0
# .swiftlint.yml
cyclomatic_complexity: 20
Ilias Karim
  • 4,798
  • 3
  • 38
  • 60