Open Craz1k0ek opened 2 days ago
I tried fixing this issue myself, but it appears the macro is not correctly parsed, but I can't figure out why. Parts of the code I added
if configuration.ignoresMacroDeclarations {
print("Configuration set to ignore macros")
if lineHasKinds(line: line, kinds: macroKinds, kindsByLine: swiftDeclarationKindsByLine.value) {
print("Ignoring line \(line.index) due to macro declaration: \(line.content)")
return nil
} else {
print("""
Something went wrong, debug info
================================
Checking line \(line.index): \(line.content)
swiftDeclarationKindsByLine.value: \(swiftDeclarationKindsByLine.value)
""")
}
}
Outputs the following
Configuration set to ignore macros
Something went wrong, debug info
================================
Checking line 19: public macro obfuscate(_ value: String) -> String = #externalMacro(module: "ObfuscatedStringMacros", type: "ObfuscationMacro")
swiftDeclarationKindsByLine.value: [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [SourceKittenFramework.SwiftDeclarationKind.varParameter]]
This appears to be a SourceKitten
issue. I've added an issue there.
New Issue Checklist
Describe the bug
I have a specific setting in my
.swiftlint.yml
to exclude function declarationsHowever, this ignores the macro definitions
Complete output when running SwiftLint, including the stack trace and command used
Gives me
Environment
swiftlint version
to be sure)? 0.55.1xcodebuild -version
)? Xcode 15.4echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
to quickly test if your example is really demonstrating the issue. If your example is more complex, you can useswiftlint lint --path [file here] --no-cache --enable-all-rules
. Create a macro using Xcode and run the linter to recreate the issue