You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am was working on this autocorrect for long single line function headers so it automatically corrects them into multiple lines but since it was too complex i broke it into two separate autocorrects. First to break paramters into a singular line away from the func ( ) -> x surounding it and a second one that cycles over the match and break the last parameters onto a separate line every cycle. However eventhough it matches correctly as soon as I apply autocorrection to the second rule nothing ever changes. Please help me I am very confused because event if I switch out the replacement for litterally any matching group it ignored the autocorrect
`let longMultilineFunctionDefMatchingExample = "static func defaultAlert(verylongStringToPutToMultipleLineThatExceeds120charactersForSureSinceItIsSoVeryLongOhMyGod: Sting) {\n}"
let longMultilineFunctionDefNonMatchingExample1 = "\tstatic func defaultAlert(title: String, title: String, title: String, message: String) {\n}"
let longMultilineFunctionDefBeforeAutocorrect = "\tstatic func defaultAlert(verylongStringToPutToMultipleLineThatExceeds120charactersForSureSinceItIsSoVeryLongOhMyGod: String){\n}"
let longMultilineFunctionDefAfterAutocorrect = "\tstatic func defaultAlert(\n\t\tverylongStringToPutToMultipleLineThatExceeds120charactersForSureSinceItIsSoVeryLongOhMyGod: String\n\t){\n}"
try Lint.checkFileContents(
checkInfo: "Long multiparameter function: Parameters of functions above 120 character should be split into multiple lines",
regex: #"^(?=.{121,})(?[ \t])(?
Hey @meteora8888, sorry for getting back to you this late, I didn't notice the email last year when you first wrote this and I'm just seeing it.
I've copied and tried out your check, the regex seems to trigger in the tests but not in real files, that's really weird. I don't see anything you're doing wrong, I will have to further investigate what's going on internally in AnyLint to know what the issue is, but looks like a bug in AnyLint, thanks for reporting. 👍
I am was working on this autocorrect for long single line function headers so it automatically corrects them into multiple lines but since it was too complex i broke it into two separate autocorrects. First to break paramters into a singular line away from the func ( ) -> x surounding it and a second one that cycles over the match and break the last parameters onto a separate line every cycle. However eventhough it matches correctly as soon as I apply autocorrection to the second rule nothing ever changes. Please help me I am very confused because event if I switch out the replacement for litterally any matching group it ignored the autocorrect
`let longMultilineFunctionDefMatchingExample = "static func defaultAlert(verylongStringToPutToMultipleLineThatExceeds120charactersForSureSinceItIsSoVeryLongOhMyGod: Sting) {\n}"
[a-zA-Z@ ]func[a-zA-Z<> ]()(?.)(?).(?:->){0,1}.{)$"#,let longMultilineFunctionDefNonMatchingExample1 = "\tstatic func defaultAlert(title: String, title: String, title: String, message: String) {\n}"
let longMultilineFunctionDefBeforeAutocorrect = "\tstatic func defaultAlert(verylongStringToPutToMultipleLineThatExceeds120charactersForSureSinceItIsSoVeryLongOhMyGod: String){\n}"
let longMultilineFunctionDefAfterAutocorrect = "\tstatic func defaultAlert(\n\t\tverylongStringToPutToMultipleLineThatExceeds120charactersForSureSinceItIsSoVeryLongOhMyGod: String\n\t){\n}"
try Lint.checkFileContents(
checkInfo: "Long multiparameter function: Parameters of functions above 120 character should be split into multiple lines",
regex: #"^(?=.{121,})(?[ \t])(?
matchingExamples: [longMultilineFunctionDefMatchingExample],
nonMatchingExamples: [longMultilineFunctionDefNonMatchingExample1],
includeFilters: [#".*.swift"#],
excludeFilters: excludeFilters,
autoCorrectReplacement: "$SPACING$HEADER\n$SPACING\t$PARAMETERS\n$SPACING$HEADEND",
autoCorrectExamples: [
["before": longMultilineFunctionDefBeforeAutocorrect,
"after": longMultilineFunctionDefAfterAutocorrect]
]
)
Expected Behavior
single line function parameters break into separate lines each
Actual Behavior
first rule works having all parameters on one line but second one is ignored (eventhough it matches)
Steps to Reproduce the Problem
class func from( html: String?, font: (regular: UIFont, bold: UIFont), color: UIColor, documentAttributes: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil ) -> NSAttributedString? { return from(html: html, font: font, size: font.regular.pointSize, color: color, documentAttributes: documentAttributes) }
Specifications
The text was updated successfully, but these errors were encountered: