Skip to content

Commit

Permalink
Hide reporters from public interface
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyDanny committed Jul 15, 2023
1 parent 9873330 commit 05011e1
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 73 deletions.
4 changes: 2 additions & 2 deletions Source/SwiftLintCore/Models/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public struct Configuration {
excludedPaths: [String] = [],
indentation: IndentationStyle = .default,
warningThreshold: Int? = nil,
reporter: String = XcodeReporter.identifier,
reporter: String? = nil,
cachePath: String? = nil,
pinnedVersion: String? = nil,
allowZeroLintableFiles: Bool = false
Expand All @@ -153,7 +153,7 @@ public struct Configuration {
excludedPaths: excludedPaths,
indentation: indentation,
warningThreshold: warningThreshold,
reporter: reporter,
reporter: reporter ?? XcodeReporter.identifier,
cachePath: cachePath,
allowZeroLintableFiles: allowZeroLintableFiles
)
Expand Down
2 changes: 1 addition & 1 deletion Source/SwiftLintCore/Protocols/Reporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/CSVReporter.swift
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/CheckstyleReporter.swift
Original file line number Diff line number Diff line change
@@ -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 [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<checkstyle version=\"4.3\">",
violations
Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/CodeClimateReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "/")
}
Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/EmojiReporter.swift
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
}

Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/GitLabJUnitReporter.swift
Original file line number Diff line number Diff line change
@@ -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 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<testsuites><testsuite>" +
violations.map({ violation -> String in
let fileName = (violation.location.relativeFile ?? "<nopath>").escapedForXML()
Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/HTMLReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}
Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/JSONReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:)))
}

Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/JUnitReporter.swift
Original file line number Diff line number Diff line change
@@ -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

Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/MarkdownReporter.swift
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/RelativePathReporter.swift
Original file line number Diff line number Diff line change
@@ -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")
}

Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/SonarQubeReporter.swift
Original file line number Diff line number Diff line change
@@ -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:))])
}

Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/SummaryReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
10 changes: 5 additions & 5 deletions Source/SwiftLintCore/Reporters/XcodeReporter.swift
Original file line number Diff line number Diff line change
@@ -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")
}

Expand Down

0 comments on commit 05011e1

Please sign in to comment.