1

I'm trying to implement custom swiftlint rule to track when before "extension" there is no "// MARK: -". Here is my rule:

custom_rules:
    pragma_mark:
        name: "Missing pagma mark"
        match_kinds:
            - comment
            - string
        regex: '(^(?!(\/\/ MARK: -.*\n))(.*\n.*extension.*\{))'
        message: "Please add // MARK:"
        severity: warning

I've created regex on regex101: https://regex101.com/r/0AKKmL/2

It works on regex101 but doesn't work in SwiftLint.

I'm sure that SwiftLint is configured correct as other rules work perfectly. Also I'm using disabled_rules - so I can't use whitelist and it is not a reason for custom_rules.

Maybe I collapse SwiftLint existing rules?

0 Answers0