Skip to content

Commit

Permalink
Merge pull request #622 from 417-72KI/fix-ambiguous-use-of-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
f-meloni authored Sep 23, 2024
2 parents 164c4d2 + 1e29186 commit a3c659e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
-->

## Master
- Remove deprecated `lint` function with `lintAllFiles` flag [@417-72KI][] - [#622](https://github.com/danger/swift/pull/622)

## 3.19.1

- Expose markdownKit on Swiftlint.lint() for customizing the output [@nikoloutsos][] - [#609](https://github.com/danger/swift/pull/609)
- Expose markdownKit on Swiftlint.lint() for customizing the output [@nikoloutsos][] - [#610](https://github.com/danger/swift/pull/610)
- Drop Swift 5.7 [@417-72KI][] - [#620](https://github.com/danger/swift/pull/620)
- Fix pattern for detecting SwiftLint in package [@417-72KI][] - [#616](https://github.com/danger/swift/pull/616)
- Allow optional GitLab MR description [@kvvzr][] - [#609](https://github.com/danger/swift/pull/609)
Expand Down
32 changes: 4 additions & 28 deletions Sources/Danger/Plugins/SwiftLint/SwiftLint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,6 @@ public enum SwiftLint {
static let danger = Danger()
static let shellExecutor = ShellExecutor()

/// This method is deprecated in favor of
@available(*, deprecated, message: "Use the lint(_ lintStyle ..) method instead.")
@discardableResult
public static func lint(inline: Bool = false,
directory: String? = nil,
configFile: String? = nil,
strict: Bool = false,
quiet: Bool = true,
lintAllFiles: Bool = false,
swiftlintPath: String? = nil) -> [SwiftLintViolation] {
let lintStyle: LintStyle = {
if lintAllFiles {
return .all(directory: directory)
} else {
return .modifiedAndCreatedFiles(directory: directory)
}
}()

return lint(lintStyle,
inline: inline,
configFile: configFile,
strict: strict,
quiet: quiet,
swiftlintPath: swiftlintPath)
}

/// When the swiftlintPath is not specified,
/// it uses by default swift run swiftlint if the Package.swift in your root folder contains swiftlint as dependency,
/// otherwise calls directly the swiftlint command
Expand All @@ -73,13 +47,15 @@ public enum SwiftLint {
configFile: String? = nil,
strict: Bool = false,
quiet: Bool = true,
swiftlintPath: String?) -> [SwiftLintViolation] {
swiftlintPath: String,
markdownAction: (String) -> Void = markdown) -> [SwiftLintViolation] {
lint(lintStyle,
inline: inline,
configFile: configFile,
strict: strict,
quiet: quiet,
swiftlintPath: swiftlintPath.map(SwiftlintPath.bin))
swiftlintPath: .bin(swiftlintPath),
markdownAction: markdownAction)
}

/// This is the main entry point for linting Swift in PRs.
Expand Down

0 comments on commit a3c659e

Please sign in to comment.