Skip to content

SwiftSyntax comment parsing error since 0.47.0+ on Linux builds #4031

Closed
@wasdkhan

Description

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 version to 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.

Metadata

Assignees

No one assigned

    Labels

    bugUnexpected and reproducible misbehavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions