Skip to content

Commit

Permalink
Tweak the auto-correction result console output for clarity (#3522)
Browse files Browse the repository at this point in the history
A colleague was confused by the output of `swiftlint autocorrect`, she
couldn't understand why SwiftLint told her it corrected thousands of
files when she only touched one.

The "Done correcting \(files.count) ..." output made her think that a
change was made on each of the `files`, when really they had only been
inspected.

A good solution would be to adopt a similar approach as the `lint`
command does.

Not being familiar with the codebase, I though a good first step could
have been to tweak the message a bit, making it clearer that the count
printed to the console is the inspected files.
  • Loading branch information
jpsim authored Feb 25, 2021
2 parents 5b1d737 + ff1ca8f commit 706abfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
* Add opt-in rule `private_subject` rule which warns against
public Combine subjects.
[Otavio Cordeiro](https://github.com/otaviocc)
* Tweak the auto-correction result console output for clarity.
[mokagio](https://github.com/mokagio)
[#3522](https://github.com/realm/SwiftLint/issues/3522)

* Allow configuring related USRs to skip in UnusedDeclarationRule by
specifying a list of USRs in the `related_usrs_to_skip` key.
Expand Down
2 changes: 1 addition & 1 deletion Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ struct LintOrAnalyzeCommand {
let pluralSuffix = { (collection: [Any]) -> String in
return collection.count != 1 ? "s" : ""
}
queuedPrintError("Done correcting \(files.count) file\(pluralSuffix(files))!")
queuedPrintError("Done inspecting \(files.count) file\(pluralSuffix(files)) for auto-correction!")
}
return .success(())
}
Expand Down

0 comments on commit 706abfe

Please sign in to comment.