Open prabindatta opened 3 weeks ago
This is mentioned in the README:
It is important to note that the regular expression pattern is used with the flags
s
andm
enabled, that is.
matches newlines and^
/$
match the start and end of lines, respectively. If you do not want to have.
match newlines, for example, the regex can be prepended by(?-s)
.
Your regex matches up to as many lines before as it can. Since the position where it triggers is the beginning of the match be default, you see the warning "somewhere". Prepending the regex with (?-s)
at least makes the rule trigger in the line where the violation actually appears.
New Issue Checklist
Bug Description
I have added a custom rule to check if developer has used booleanVariable == true or booleanVariable == false except when we have optional chain like optionalVariable?.booleanVariable == true or optionalVariable?.booleanVariable == false Rules are working and I can see warning message is shown to developers except it always appear couple of lines above the actual expected line of code.
Mention the command or other SwiftLint integration method that caused the issue. Include stack traces or command output.
Environment
SwiftLint version: 0.56.1 Xcode version: Xcode 15 (unrelated, replicable in CLI) Installation method: Homebrew and Cocoapod (both have same behaviour)