Skip to content

Commit 698b525

Browse files
authored
Merge pull request #43 from Cleverlance/bugfix/formatting
Fix settings swift format version
2 parents d09deba + c0d0e6e commit 698b525

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Sources/SwiftTools/Format/Resource/FormatService.swift

+11-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@ final class FormatServiceImpl: FormatService {
1616
private let printService: PrintService
1717
private let localFileService: LocalFileService
1818
private let configurationController: ConfigurationController
19+
private let verboseController: VerboseController
1920

20-
init(printService: PrintService, localFileService: LocalFileService, configurationController: ConfigurationController) {
21+
init(
22+
printService: PrintService,
23+
localFileService: LocalFileService,
24+
configurationController: ConfigurationController,
25+
verboseController: VerboseController
26+
) {
2127
self.printService = printService
2228
self.localFileService = localFileService
2329
self.configurationController = configurationController
30+
self.verboseController = verboseController
2431
}
2532

2633
func format(path: String) throws {
@@ -29,12 +36,13 @@ final class FormatServiceImpl: FormatService {
2936
case .error, .warning:
3037
self?.printService.printText("\(type): \(text)")
3138
case .info, .success, .content, .raw:
32-
break
39+
self?.printService.printVerbose("\(type): \(text)")
3340
}
3441
}
3542
let currentPath = localFileService.getCurrentPath()
3643
let configurationFilePath = configurationController.getSwiftFormatConfigurationFilePath()
37-
let result = CLI.run(in: currentPath, with: "\(path) --config \(configurationFilePath) --swiftversion 5")
44+
let verboseText = verboseController.isVerbose() ? " --verbose" : ""
45+
let result = CLI.run(in: currentPath, with: "\(path) --config \(configurationFilePath)\(verboseText)")
3846

3947
if result != .ok {
4048
throw ToolsError(description: "Formatting failed with exit code: \(result)")

0 commit comments

Comments
 (0)