Skip to content

Commit fc3fab6

Browse files
authored
Merge pull request #250 from dylansturg/unparsable_lints
Handle `ignore-unparsable-files` option in LintFrontend.
2 parents dd87cc2 + 5e62d56 commit fc3fab6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/swift-format/Frontend/LintFrontend.swift

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ class LintFrontend: Frontend {
3939
.error, "Unable to lint \(path): file is not readable or does not exist."))
4040
return
4141
} catch SwiftFormatError.fileContainsInvalidSyntax(let position) {
42+
guard !lintFormatOptions.ignoreUnparsableFiles else {
43+
// The caller wants to silently ignore this error.
44+
return
45+
}
4246
let location = SourceLocationConverter(file: path, source: source).location(for: position)
4347
diagnosticEngine.diagnose(
4448
Diagnostic.Message(.error, "file contains invalid or unrecognized Swift syntax."),

0 commit comments

Comments
 (0)