Skip to content

Commit 08185e8

Browse files
authored
Merge pull request swiftlang#252 from fortmarek/swift-5.3-branch
Add strict flag
2 parents f8ed656 + 1898488 commit 08185e8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/swift-format/Subcommands/Lint.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,22 @@ extension SwiftFormatCommand {
2121

2222
@OptionGroup()
2323
var lintOptions: LintFormatOptions
24+
25+
@Flag(
26+
name: .shortAndLong,
27+
help: "Fail on warnings."
28+
)
29+
var strict: Bool = false
2430

2531
func run() throws {
2632
let frontend = LintFrontend(lintFormatOptions: lintOptions)
2733
frontend.run()
2834
if frontend.errorsWereEmitted { throw ExitCode.failure }
35+
if strict,
36+
frontend.diagnosticEngine.diagnostics
37+
.contains(where: { $0.message.severity == .warning }) {
38+
throw ExitCode.failure
39+
}
2940
}
3041
}
3142
}

0 commit comments

Comments
 (0)