0

My .swiftlint.yml file:

disabled_rules:
  - trailing_whitespace
  - mark
  - line_length
  - force_cast
  - variable_name
  - force_try
  - cyclomatic_complexity
  - function_body_length
  - type_body_length
  - file_length
  - type_name

excluded:
  - Pods

custom_rules:
  press_enter_after_object_definition:
    regex: "(class|enum).*"

The result is following:

enter image description here

Why it has found only first match?

I need to find every line with enum or class keyword.

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

1 Answers1

1

Remove the .*, this means match anything except a line break. So it appears to die in SwiftLint after the first line break of a successful match.

This works:

press_enter_after_object_definition:
    regex: "(class|enum)"
cocojoe
  • 220
  • 1
  • 6