-
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
Certain custom rule regular expressions aren't parsed properly #717
Comments
Works for me. What version of SwiftLint do you have installed ( $ cat .swiftlint.yml
custom_rules:
void_as_parameter:
included: "*.swift"
name: "Void as Parameter"
regex: "(Void ->)"
message: "Use Void only as return type."
severity: warning
$ cat main.swift
let abc: Void -> () = {}
$ swiftlint
Loading configuration from '.swiftlint.yml'
Linting Swift files in current working directory
Linting 'main.swift' (1/1)
/working_dir/main.swift:1:10: warning: Void as Parameter Violation: Use Void only as return type. (void_as_parameter)
Done linting! Found 1 violation, 0 serious in 1 file. |
Sorry i was not clear enough, the posted rule works but the one to match
|
Oops, no you were clear in your issue I just misread it. I can reproduce this, I suspect it's the way we're creating |
should I submit a rule for this once the issue is resolved? |
Yes please! |
Hi,
i am trying to add custom warnings in my yaml to match
Void ->
and-> ()
The first rule to match
Void ->
andVoid->
works perfectlybut i cannot match
-> ()
and->()
i have tried
(->[ ]?\(\))
and(\-\>[ ]?\(\))
but nothing worksAm I doing something wrong?
The text was updated successfully, but these errors were encountered: