Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print only file path when reporting a correction #5596

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
[Martin Redington](https://github.com/mildm8nnered)
[#5614](https://github.com/realm/SwiftLint/issues/5614)

* When SwiftLint corrects violations automatically (`swiftlint lint --fix`)
it doesn't report the exact location of the fix any longer. The new format
is `<file-path>: Correcting <rule-name>` without line and column numbers.
Reason: Correction positions are likely just incorrect, especially when
multiple rules apply their rewrites. Fixing that is not trivial and likely
not worth the effort also considering that there haven't been any bug
reports about wrong correction positions so far.
[SimplyDanny](https://github.com/SimplyDanny)

#### Experimental

* None.
Expand Down
2 changes: 1 addition & 1 deletion Source/SwiftLintCore/Models/Correction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public struct Correction: Equatable, Sendable {

/// The console-printable description for this correction.
public var consoleDescription: String {
return "\(location) Corrected \(ruleDescription.name)"
return "\(location.file ?? "<nopath>"): Corrected \(ruleDescription.name)"
}

/// Memberwise initializer.
Expand Down