-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rogue Custom Rules #1586
Comments
So, the actual issue here is that we should provide better feedback when a regex is invalid? |
When I started the issue I had no idea what was happening. But after investigating in the code, yes, the issue is related with invalid regex. This actually leads to two different issues:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are certain rules that kill all custom rules. I call them Rogue Rules.
Simple example
Let us start with a simple .swiftlint file, with only one customization:
Imagine that you have a custom rule, like this one:
Then an awesome variable like this one:
_ = "http://thavariable.com"
This works. The variable produces a warning, everyone is happy.
THE ROGUE RULE
The moment you bring the Rogue Rule, the panic starts, people running and fire emerges in other rules.
Let me introduce you to my Rogue Rule:
So by now, you must be imagining "YOU ARE THE ROGUE THAT IS KILLING REGEX". Probably you are right. Yeah, I know I have a lot to learn with regex, but it would be cool that people that use websites like Regex101 and create Rogue Rules wouldn't destroy all the work ever done by humankind.
Post Script Notes
PS: I am using the version 0.19.0.
PS2: I imagine that is some error with that regex that destroys everything, but since I have no feedback is kinda hard to spot the error. At least an error on running the script would be cool.
Ok, enough is enough, I am going after that Rogue Rule.
PS3: I started to mess around with SwiftLint code and found out that this rule is created with a niled regex
PS4: Ideally, for me, as a SwiftLinter user it would give an error (like it currently happens when the YAML parser fails) when a custom rule is badly defined. Not saying anything and obliterate the other custom rules is kinda weird.
The text was updated successfully, but these errors were encountered: