diff --git a/Source/SwiftLintCore/Models/Configuration.swift b/Source/SwiftLintCore/Models/Configuration.swift index a680b776b94..ae19bab5a70 100644 --- a/Source/SwiftLintCore/Models/Configuration.swift +++ b/Source/SwiftLintCore/Models/Configuration.swift @@ -127,7 +127,7 @@ public struct Configuration { excludedPaths: [String] = [], indentation: IndentationStyle = .default, warningThreshold: Int? = nil, - reporter: String = XcodeReporter.identifier, + reporter: String = "xcode", cachePath: String? = nil, pinnedVersion: String? = nil, allowZeroLintableFiles: Bool = false diff --git a/Source/SwiftLintCore/Protocols/Reporter.swift b/Source/SwiftLintCore/Protocols/Reporter.swift index d96fc341114..fbd551919b6 100644 --- a/Source/SwiftLintCore/Protocols/Reporter.swift +++ b/Source/SwiftLintCore/Protocols/Reporter.swift @@ -21,7 +21,7 @@ public protocol Reporter: CustomStringConvertible { static func generateReport(_ violations: [StyleViolation]) -> String } -public extension Reporter { +extension Reporter { /// For CustomStringConvertible conformance. var description: String { Self.description } } diff --git a/Source/SwiftLintCore/Reporters/CSVReporter.swift b/Source/SwiftLintCore/Reporters/CSVReporter.swift index a736e1074cb..3c0a7ff26ef 100644 --- a/Source/SwiftLintCore/Reporters/CSVReporter.swift +++ b/Source/SwiftLintCore/Reporters/CSVReporter.swift @@ -1,14 +1,14 @@ import Foundation /// Reports violations as a newline-separated string of comma-separated values (CSV). -public struct CSVReporter: Reporter { +struct CSVReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "csv" - public static let isRealtime = false - public static let description = "Reports violations as a newline-separated string of comma-separated values (CSV)." + static let identifier = "csv" + static let isRealtime = false + static let description = "Reports violations as a newline-separated string of comma-separated values (CSV)." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { let keys = [ "file", "line", diff --git a/Source/SwiftLintCore/Reporters/CheckstyleReporter.swift b/Source/SwiftLintCore/Reporters/CheckstyleReporter.swift index aeffee40c49..4c039e2b2bc 100644 --- a/Source/SwiftLintCore/Reporters/CheckstyleReporter.swift +++ b/Source/SwiftLintCore/Reporters/CheckstyleReporter.swift @@ -1,13 +1,13 @@ /// Reports violations as XML conforming to the Checkstyle specification, as defined here: /// https://www.jetbrains.com/help/teamcity/xml-report-processing.html -public struct CheckstyleReporter: Reporter { +struct CheckstyleReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "checkstyle" - public static let isRealtime = false - public static let description = "Reports violations as Checkstyle XML." + static let identifier = "checkstyle" + static let isRealtime = false + static let description = "Reports violations as Checkstyle XML." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return [ "\n", violations diff --git a/Source/SwiftLintCore/Reporters/CodeClimateReporter.swift b/Source/SwiftLintCore/Reporters/CodeClimateReporter.swift index cfadab747fa..829e3ae234b 100644 --- a/Source/SwiftLintCore/Reporters/CodeClimateReporter.swift +++ b/Source/SwiftLintCore/Reporters/CodeClimateReporter.swift @@ -5,14 +5,14 @@ import Foundation import SourceKittenFramework /// Reports violations as a JSON array in Code Climate format. -public struct CodeClimateReporter: Reporter { +struct CodeClimateReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "codeclimate" - public static let isRealtime = false - public static let description = "Reports violations as a JSON array in Code Climate format." + static let identifier = "codeclimate" + static let isRealtime = false + static let description = "Reports violations as a JSON array in Code Climate format." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return toJSON(violations.map(dictionary(for:))) .replacingOccurrences(of: "\\/", with: "/") } diff --git a/Source/SwiftLintCore/Reporters/EmojiReporter.swift b/Source/SwiftLintCore/Reporters/EmojiReporter.swift index 9fe6d42892d..64e85595268 100644 --- a/Source/SwiftLintCore/Reporters/EmojiReporter.swift +++ b/Source/SwiftLintCore/Reporters/EmojiReporter.swift @@ -1,12 +1,12 @@ /// Reports violations in a format that's both fun and easy to read. -public struct EmojiReporter: Reporter { +struct EmojiReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "emoji" - public static let isRealtime = false - public static let description = "Reports violations in the format that's both fun and easy to read." + static let identifier = "emoji" + static let isRealtime = false + static let description = "Reports violations in the format that's both fun and easy to read." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { violations .group { $0.location.file ?? "Other" } .sorted { $0.key < $1.key } diff --git a/Source/SwiftLintCore/Reporters/GitHubActionsLoggingReporter.swift b/Source/SwiftLintCore/Reporters/GitHubActionsLoggingReporter.swift index 2b6ed834945..f4d388f710e 100644 --- a/Source/SwiftLintCore/Reporters/GitHubActionsLoggingReporter.swift +++ b/Source/SwiftLintCore/Reporters/GitHubActionsLoggingReporter.swift @@ -1,13 +1,13 @@ /// Reports violations in the format GitHub-hosted virtual machine for Actions can recognize as messages. -public struct GitHubActionsLoggingReporter: Reporter { +struct GitHubActionsLoggingReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "github-actions-logging" - public static let isRealtime = true - public static let description = "Reports violations in the format GitHub-hosted virtual " + + static let identifier = "github-actions-logging" + static let isRealtime = true + static let description = "Reports violations in the format GitHub-hosted virtual " + "machine for Actions can recognize as messages." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return violations.map(generateForSingleViolation).joined(separator: "\n") } diff --git a/Source/SwiftLintCore/Reporters/GitLabJUnitReporter.swift b/Source/SwiftLintCore/Reporters/GitLabJUnitReporter.swift index 57fc1376452..57381e3b94d 100644 --- a/Source/SwiftLintCore/Reporters/GitLabJUnitReporter.swift +++ b/Source/SwiftLintCore/Reporters/GitLabJUnitReporter.swift @@ -1,12 +1,12 @@ /// Reports violations as JUnit XML supported by GitLab. -public struct GitLabJUnitReporter: Reporter { +struct GitLabJUnitReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "gitlab" - public static let isRealtime = false - public static let description = "Reports violations as JUnit XML supported by GitLab." + static let identifier = "gitlab" + static let isRealtime = false + static let description = "Reports violations as JUnit XML supported by GitLab." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return "\n" + violations.map({ violation -> String in let fileName = (violation.location.relativeFile ?? "").escapedForXML() diff --git a/Source/SwiftLintCore/Reporters/HTMLReporter.swift b/Source/SwiftLintCore/Reporters/HTMLReporter.swift index e80f910b471..fcc1d654867 100644 --- a/Source/SwiftLintCore/Reporters/HTMLReporter.swift +++ b/Source/SwiftLintCore/Reporters/HTMLReporter.swift @@ -7,14 +7,14 @@ private let formatter: DateFormatter = { }() /// Reports violations as HTML. -public struct HTMLReporter: Reporter { +struct HTMLReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "html" - public static let isRealtime = false - public static let description = "Reports violations as HTML." + static let identifier = "html" + static let isRealtime = false + static let description = "Reports violations as HTML." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return generateReport(violations, swiftlintVersion: Version.current.value, dateString: formatter.string(from: Date())) } diff --git a/Source/SwiftLintCore/Reporters/JSONReporter.swift b/Source/SwiftLintCore/Reporters/JSONReporter.swift index 576fb888965..78834307e26 100644 --- a/Source/SwiftLintCore/Reporters/JSONReporter.swift +++ b/Source/SwiftLintCore/Reporters/JSONReporter.swift @@ -2,14 +2,14 @@ import Foundation import SourceKittenFramework /// Reports violations as a JSON array. -public struct JSONReporter: Reporter { +struct JSONReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "json" - public static let isRealtime = false - public static let description: String = "Reports violations as a JSON array." + static let identifier = "json" + static let isRealtime = false + static let description: String = "Reports violations as a JSON array." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return toJSON(violations.map(dictionary(for:))) } diff --git a/Source/SwiftLintCore/Reporters/JUnitReporter.swift b/Source/SwiftLintCore/Reporters/JUnitReporter.swift index a88a510e820..1ea0f122eed 100644 --- a/Source/SwiftLintCore/Reporters/JUnitReporter.swift +++ b/Source/SwiftLintCore/Reporters/JUnitReporter.swift @@ -1,12 +1,12 @@ /// Reports violations as JUnit XML. -public struct JUnitReporter: Reporter { +struct JUnitReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "junit" - public static let isRealtime = false - public static let description = "Reports violations as JUnit XML." + static let identifier = "junit" + static let isRealtime = false + static let description = "Reports violations as JUnit XML." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { let warningCount = violations.filter({ $0.severity == .warning }).count let errorCount = violations.filter({ $0.severity == .error }).count diff --git a/Source/SwiftLintCore/Reporters/MarkdownReporter.swift b/Source/SwiftLintCore/Reporters/MarkdownReporter.swift index 6be074bf2b0..b121be845ad 100644 --- a/Source/SwiftLintCore/Reporters/MarkdownReporter.swift +++ b/Source/SwiftLintCore/Reporters/MarkdownReporter.swift @@ -1,14 +1,14 @@ import Foundation /// Reports violations as markdown formated (with tables). -public struct MarkdownReporter: Reporter { +struct MarkdownReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "markdown" - public static let isRealtime = false - public static let description = "Reports violations as markdown formated (with tables)." + static let identifier = "markdown" + static let isRealtime = false + static let description = "Reports violations as markdown formated (with tables)." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { let keys = [ "file", "line", diff --git a/Source/SwiftLintCore/Reporters/RelativePathReporter.swift b/Source/SwiftLintCore/Reporters/RelativePathReporter.swift index cefa845d73d..ae22120e9ce 100644 --- a/Source/SwiftLintCore/Reporters/RelativePathReporter.swift +++ b/Source/SwiftLintCore/Reporters/RelativePathReporter.swift @@ -1,12 +1,12 @@ /// Reports violations with relative paths. -public struct RelativePathReporter: Reporter { +struct RelativePathReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "relative-path" - public static let isRealtime = true - public static let description = "Reports violations with relative paths." + static let identifier = "relative-path" + static let isRealtime = true + static let description = "Reports violations with relative paths." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return violations.map(generateForSingleViolation).joined(separator: "\n") } diff --git a/Source/SwiftLintCore/Reporters/SonarQubeReporter.swift b/Source/SwiftLintCore/Reporters/SonarQubeReporter.swift index 4c3efe46c47..81483ccf453 100644 --- a/Source/SwiftLintCore/Reporters/SonarQubeReporter.swift +++ b/Source/SwiftLintCore/Reporters/SonarQubeReporter.swift @@ -1,14 +1,14 @@ import SourceKittenFramework /// Reports violations in SonarQube import format. -public struct SonarQubeReporter: Reporter { +struct SonarQubeReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "sonarqube" - public static let isRealtime = false - public static let description = "Reports violations in SonarQube import format." + static let identifier = "sonarqube" + static let isRealtime = false + static let description = "Reports violations in SonarQube import format." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return toJSON(["issues": violations.map(dictionary(for:))]) } diff --git a/Source/SwiftLintCore/Reporters/SummaryReporter.swift b/Source/SwiftLintCore/Reporters/SummaryReporter.swift index e81acaa8c7e..b26f4a5875a 100644 --- a/Source/SwiftLintCore/Reporters/SummaryReporter.swift +++ b/Source/SwiftLintCore/Reporters/SummaryReporter.swift @@ -2,15 +2,15 @@ import Foundation import SwiftyTextTable /// Reports a summary table of all violations -public struct SummaryReporter: Reporter { +struct SummaryReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "summary" - public static let isRealtime = false + static let identifier = "summary" + static let isRealtime = false - public static let description = "Reports a summary table of all violations." + static let description = "Reports a summary table of all violations." - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { TextTable(violations: violations).renderWithExtraSeparator() } } diff --git a/Source/SwiftLintCore/Reporters/XcodeReporter.swift b/Source/SwiftLintCore/Reporters/XcodeReporter.swift index 829548cddcc..cd478be29f8 100644 --- a/Source/SwiftLintCore/Reporters/XcodeReporter.swift +++ b/Source/SwiftLintCore/Reporters/XcodeReporter.swift @@ -1,12 +1,12 @@ /// Reports violations in the format Xcode uses to display in the IDE. (default) -public struct XcodeReporter: Reporter { +struct XcodeReporter: Reporter { // MARK: - Reporter Conformance - public static let identifier = "xcode" - public static let isRealtime = true - public static let description = "Reports violations in the format Xcode uses to display in the IDE. (default)" + static let identifier = "xcode" + static let isRealtime = true + static let description = "Reports violations in the format Xcode uses to display in the IDE. (default)" - public static func generateReport(_ violations: [StyleViolation]) -> String { + static func generateReport(_ violations: [StyleViolation]) -> String { return violations.map(generateForSingleViolation).joined(separator: "\n") }