Skip to content

Commit e4e7167

Browse files
authored
Merge branch 'master' into jflan/pipe-overfill
2 parents 2152706 + 8f0bf9d commit e4e7167

File tree

7 files changed

+156
-33
lines changed

7 files changed

+156
-33
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515

1616
- Drain stdout while shell commands are running to prevent execution from locking up if there's too much output [@jflan-dd][] - [#614](https://github.com/danger/swift/pull/614)
1717

18+
## 3.20.0
19+
- Remove deprecated `lint` function with `lintAllFiles` flag [@417-72KI][] - [#622](https://github.com/danger/swift/pull/622)
20+
- Updated Swift 6 build process: Danger files moved to .build/debug/Modules, and SwiftFormat module map conflict resolved by adjusting the Swift import search path. [@abhi-m-simformsolutons][] -[#626](https://github.com/danger/swift/pull/626)
21+
1822
## 3.19.1
1923

20-
- Expose markdownKit on Swiftlint.lint() for customizing the output [@nikoloutsos][] - [#609](https://github.com/danger/swift/pull/609)
24+
- Expose markdownKit on Swiftlint.lint() for customizing the output [@nikoloutsos][] - [#610](https://github.com/danger/swift/pull/610)
2125
- Drop Swift 5.7 [@417-72KI][] - [#620](https://github.com/danger/swift/pull/620)
2226
- Fix pattern for detecting SwiftLint in package [@417-72KI][] - [#616](https://github.com/danger/swift/pull/616)
2327
- Allow optional GitLab MR description [@kvvzr][] - [#609](https://github.com/danger/swift/pull/609)

Package.resolved

Lines changed: 135 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/Danger/Plugins/SwiftLint/SwiftLint.swift

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,6 @@ public enum SwiftLint {
3737
static let danger = Danger()
3838
static let shellExecutor = ShellExecutor()
3939

40-
/// This method is deprecated in favor of
41-
@available(*, deprecated, message: "Use the lint(_ lintStyle ..) method instead.")
42-
@discardableResult
43-
public static func lint(inline: Bool = false,
44-
directory: String? = nil,
45-
configFile: String? = nil,
46-
strict: Bool = false,
47-
quiet: Bool = true,
48-
lintAllFiles: Bool = false,
49-
swiftlintPath: String? = nil) -> [SwiftLintViolation] {
50-
let lintStyle: LintStyle = {
51-
if lintAllFiles {
52-
return .all(directory: directory)
53-
} else {
54-
return .modifiedAndCreatedFiles(directory: directory)
55-
}
56-
}()
57-
58-
return lint(lintStyle,
59-
inline: inline,
60-
configFile: configFile,
61-
strict: strict,
62-
quiet: quiet,
63-
swiftlintPath: swiftlintPath)
64-
}
65-
6640
/// When the swiftlintPath is not specified,
6741
/// it uses by default swift run swiftlint if the Package.swift in your root folder contains swiftlint as dependency,
6842
/// otherwise calls directly the swiftlint command
@@ -73,13 +47,15 @@ public enum SwiftLint {
7347
configFile: String? = nil,
7448
strict: Bool = false,
7549
quiet: Bool = true,
76-
swiftlintPath: String?) -> [SwiftLintViolation] {
50+
swiftlintPath: String,
51+
markdownAction: (String) -> Void = markdown) -> [SwiftLintViolation] {
7752
lint(lintStyle,
7853
inline: inline,
7954
configFile: configFile,
8055
strict: strict,
8156
quiet: quiet,
82-
swiftlintPath: swiftlintPath.map(SwiftlintPath.bin))
57+
swiftlintPath: .bin(swiftlintPath),
58+
markdownAction: markdownAction)
8359
}
8460

8561
/// This is the main entry point for linting Swift in PRs.
@@ -209,7 +185,7 @@ extension SwiftLint {
209185
var arguments = arguments
210186

211187
if let directory = directory {
212-
arguments.append("--path \"\(directory)\"")
188+
arguments.append(directory)
213189
}
214190

215191
return swiftlintViolations(swiftlintPath: swiftlintPath,

Sources/Runner/Commands/Runner.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func runDanger(version dangerSwiftVersion: String, logger: Logger) throws {
6060
if let spmDanger = SPMDanger() {
6161
spmDanger.buildDependencies(executor: executor)
6262
libArgs += ["-L", spmDanger.buildFolder]
63-
libArgs += ["-I", spmDanger.buildFolder]
63+
libArgs += ["-I", spmDanger.moduleFolder]
6464
libArgs += [spmDanger.swiftcLibImport]
6565
} else {
6666
guard let libDangerPath = Runtime.getLibDangerPath() else {

Sources/Runner/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Logger
33
import RunnerLib
44

55
/// Version for showing in verbose mode
6-
let DangerVersion = "3.19.1" // swiftlint:disable:this identifier_name
6+
let DangerVersion = "3.20.0" // swiftlint:disable:this identifier_name
77
let MinimumDangerJSVersion = "6.1.6" // swiftlint:disable:this identifier_name
88

99
private func runCommand(_ command: DangerCommand, logger: Logger) throws {

Sources/RunnerLib/SPMDanger.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ public struct SPMDanger {
1010
fileManager.currentDirectoryPath + "/.build/debug"
1111
}
1212

13+
public var moduleFolder: String {
14+
#if compiler(<6.0)
15+
buildFolder
16+
#else
17+
buildFolder + "/Modules"
18+
#endif
19+
}
20+
1321
public init?(
1422
packagePath: String = "Package.swift",
1523
readFile: (String) -> String? = { try? String(contentsOfFile: $0) },

Tests/DangerTests/SwiftLint/DangerSwiftLintTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ final class DangerSwiftLintTests: XCTestCase {
268268
XCTAssertNotNil(swiftlintCommand)
269269
XCTAssertEqual(swiftlintCommand!.environmentVariables.count, 0)
270270
XCTAssertFalse(swiftlintCommand!.environmentVariables.values.contains { $0.contains("Tests/SomeFile.swift") })
271-
XCTAssertTrue(swiftlintCommand!.arguments.contains("--path \"Tests\""))
271+
XCTAssertEqual(swiftlintCommand!.arguments.last, directory)
272272
}
273273

274274
func testFiltersOnSwiftFiles() {

0 commit comments

Comments
 (0)