Refactor "diagnostics" into "findings". #270
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change addresses swiftlang/swift-syntax#309 and swiftlang/swift-syntax#325, which split
SwiftSyntaxParser
into its own module and then removed theDiagnosticEngine
APIs (so only theDiagnostic
type remains as the way diagnostics from the parser are sent back to the caller).Rather than remain coupled to swift-syntax's
Diagnostic
type, this change creates a similarFinding
type (and related types) to describe the "lint findings" that tree-based rules, the pretty-printer, and the whitespace linter encounter duringformatting/linting.
This
Finding
type is the currency type for these kinds of findings/diagnostics emitted by the formatter API layer. Theswift-format
frontend tool now adoptsDiagnosticsEngine
from https://github.com/apple/swift-tools-support-core to manage and print these, but other clients using the API could use something different entirely. Since the usage ofTSC
is limited to the executable, API users don't have to take on a large and mostly unrelated dependency.There are still some opportunities for renaming here -- mainly replacing instances of
diagnose
in the internal code withemitFinding
or something similar -- but I'll leave that as future cleanup.