SwiftLint: SwiftSyntax comment parsing error since 0.47.0+ on Linux builds
Describe the bug
Swiftlint is ignoring disable comments since 0.47.0 and flagging warning and errors when it shouldn’t.
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint sample.swift
Environment
-
SwiftLint version (run
swiftlint versionto be sure)? 0.47.1 -
Installation method used (Homebrew, CocoaPods, building from source, etc)? building from source on linux
-
Are you using nested configurations? no If so, paste their relative paths and respective contents.
Example
// sample.swift
// swiftlint:disable colon
let noWarning :String = "" // No warning about colons immediately after variable names!
// swiftlint:enable colon
let hasWarning :String = "" // Warning generated about colons immediately after variable names
Expected: One warning
Linting Swift files at paths /home/wmkn/local/sample.swift
Linting 'sample.swift' (1/1)
/home/wmkn/local/sample.swift:5:5: warning: Colon Spacing Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)
Done linting! Found 1 violation, 0 serious in 1 file.
Actual: Two warnings
Linting Swift files at paths /home/wmkn/local/sample.swift
Linting 'sample.swift' (1/1)
Could not parse the syntax tree for at least one file. Results may be invalid.
/home/wmkn/local/sample.swift:3:5: warning: Colon Spacing Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)
/home/wmkn/local/sample.swift:5:5: warning: Colon Spacing Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)
Done linting! Found 2 violations, 0 serious in 1 file.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (2 by maintainers)
Commits related to this issue
- Specify a old version of SwiftLint - This is a workaround for https://github.com/realm/SwiftLint/issues/4031. — committed to acevif/LicensePlist by acevif 2 years ago
- Specify a old version of SwiftLint - This is a workaround for https://github.com/realm/SwiftLint/issues/4031. — committed to acevif/LicensePlist by acevif 2 years ago
Ok this is fixed on main so I’ll close this ticket then.
We just tried using
mainin our GitHub workflows and it’s working correctly.Though we cant adopt it until there’s a new release since it’s tougher for devs to install from
mainand there’s some rule now giving new warnings.