`indentation_width` triggered when the previous line is commented at the beginning
New Issue Checklist
- [x] Updated SwiftLint to the latest version
- [x] I searched for existing GitHub issues
Describe the bug
Commenting a line at the beginning of it incorrectly triggers indentation_width for the next line.
Side note: This is how Xcode comments lines by default when using cmd + /.
Complete output when running SwiftLint, including the stack trace and command used
$ ./swiftlint lint --path Test.swift
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths Test.swift
Linting 'Test.swift' (1/1)
/Users/revolt/Downloads/portable_swiftlint/Test.swift:4:1: warning: Indentation Width Violation: Code should be indented using one tab or 4 spaces. (indentation_width)
Done linting! Found 1 violation, 0 serious in 1 file.
Environment
- SwiftLint version (run
swiftlint versionto be sure)?0.41.0 - Installation method used (Homebrew, CocoaPods, building from source, etc)? Using a pre-built package
- Paste your configuration file:
opt_in_rules:
- indentation_width
- Are you using nested configurations? No If so, paste their relative paths and respective contents.
- Which Xcode version are you using (check
xcodebuild -version)? Xcode 12.2 Build version 12B45b - Do you have a sample that shows the issue? Run
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rulesto 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.
class Test {
func test() {
// comment
let string = "string"
}
}
This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!
This is still valid.
@jpsim, could you please reopen it?
Sorry for the bot-thrash, reopened.
The issue still exists. Any update or workaround?
I worked on a fix for this, but I can't figure out the correct solution, and I also got busy with other stuff :(