1

Could you help me? I want to write custom rule for SwiftLint. I would like to enforce putting one blank line before and after PRAGMA MARK: //

Example:

Error case

some code\n

// MARK - Smt\n

some code\n


Right case

some code\n\n // MARK - Smt\n\n

some code\n\n


Thx in advance

1 Answers1

0

I think you can try setting the regex to match "// MARK -" with newlines preceding it and coming after it.

To make sure SwiftLint only applies this to comments, you can set "match_kinds" to just comments on the SwiftLint yml file.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Akash Kundu
  • 1,278
  • 13
  • 21