mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
b83e0991b9
The MIT license doesn't require that all files be prepended with this licensing or copyright information. Realm confirmed that they're ok with this change. This will enable some companies to contribute to SwiftLint and the date & authorship information will remain accessible via git source control.
27 lines
932 B
Swift
27 lines
932 B
Swift
import Foundation
|
|
import SourceKittenFramework
|
|
|
|
public struct SuperfluousDisableCommandRule: ConfigurationProviderRule {
|
|
public var configuration = SeverityConfiguration(.error)
|
|
|
|
public init() {}
|
|
|
|
public static let description = RuleDescription(
|
|
identifier: "superfluous_disable_command",
|
|
name: "Superfluous Disable Command",
|
|
description: "SwiftLint 'disable' commands are superfluous when the disabled rule would not have " +
|
|
"triggered a violation in the disabled region.",
|
|
kind: .lint
|
|
)
|
|
|
|
public func validate(file: File) -> [StyleViolation] {
|
|
// This rule is implemented in Linter.swift
|
|
return []
|
|
}
|
|
|
|
public func reason(for rule: Rule.Type) -> String {
|
|
return "SwiftLint rule '\(rule.description.identifier)' did not trigger a violation " +
|
|
"in the disabled region. Please remove the disable command."
|
|
}
|
|
}
|