Skip to content

Commit

Permalink
Let all rules be configurable (#5274)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyDanny authored Oct 12, 2023
1 parent 58928b7 commit 2ed1fc2
Show file tree
Hide file tree
Showing 239 changed files with 271 additions and 265 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct AnonymousArgumentInMultilineClosureRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule {
struct AnonymousArgumentInMultilineClosureRule: SwiftSyntaxRule, OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct BlockBasedKVORule: ConfigurationProviderRule {
struct BlockBasedKVORule: Rule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct ConvenienceTypeRule: OptInRule, ConfigurationProviderRule {
struct ConvenienceTypeRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct DiscouragedAssertRule: OptInRule, ConfigurationProviderRule {
struct DiscouragedAssertRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct DiscouragedNoneNameRule: OptInRule, ConfigurationProviderRule {
struct DiscouragedNoneNameRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static var description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct DiscouragedObjectLiteralRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule {
struct DiscouragedObjectLiteralRule: SwiftSyntaxRule, OptInRule {
var configuration = DiscouragedObjectLiteralConfiguration()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct DiscouragedOptionalBooleanRule: OptInRule, ConfigurationProviderRule {
struct DiscouragedOptionalBooleanRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SourceKittenFramework

struct DiscouragedOptionalCollectionRule: ASTRule, OptInRule, ConfigurationProviderRule {
struct DiscouragedOptionalCollectionRule: ASTRule, OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import SourceKittenFramework

struct DuplicateImportsRule: ConfigurationProviderRule, CorrectableRule {
struct DuplicateImportsRule: CorrectableRule {
var configuration = SeverityConfiguration<Self>(.warning)

// List of all possible import kinds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SourceKittenFramework

private typealias SourceKittenElement = SourceKittenDictionary

struct ExplicitACLRule: OptInRule, ConfigurationProviderRule {
struct ExplicitACLRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct ExplicitEnumRawValueRule: OptInRule, ConfigurationProviderRule {
struct ExplicitEnumRawValueRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax
import SwiftSyntaxBuilder

struct ExplicitInitRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule, OptInRule {
struct ExplicitInitRule: SwiftSyntaxCorrectableRule, OptInRule {
var configuration = ExplicitInitConfiguration()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct ExplicitTopLevelACLRule: OptInRule, ConfigurationProviderRule {
struct ExplicitTopLevelACLRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct ExplicitTypeInterfaceRule: OptInRule, ConfigurationProviderRule, SwiftSyntaxRule {
struct ExplicitTypeInterfaceRule: OptInRule, SwiftSyntaxRule {
var configuration = ExplicitTypeInterfaceConfiguration()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import SourceKittenFramework

struct ExtensionAccessModifierRule: ASTRule, ConfigurationProviderRule, OptInRule {
struct ExtensionAccessModifierRule: ASTRule, OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct FallthroughRule: ConfigurationProviderRule, OptInRule {
struct FallthroughRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct FatalErrorMessageRule: ConfigurationProviderRule, OptInRule {
struct FatalErrorMessageRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import SourceKittenFramework

struct FileNameNoSpaceRule: ConfigurationProviderRule, OptInRule, SourceKitFreeRule {
struct FileNameNoSpaceRule: OptInRule, SourceKitFreeRule {
var configuration = FileNameNoSpaceConfiguration()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct FileNameRule: ConfigurationProviderRule, OptInRule, SourceKitFreeRule {
struct FileNameRule: OptInRule, SourceKitFreeRule {
var configuration = FileNameConfiguration()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct ForWhereRule: SwiftSyntaxRule, ConfigurationProviderRule {
struct ForWhereRule: SwiftSyntaxRule {
var configuration = ForWhereConfiguration()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct ForceCastRule: ConfigurationProviderRule, SwiftSyntaxRule {
struct ForceCastRule: SwiftSyntaxRule {
var configuration = SeverityConfiguration<Self>(.error)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct ForceTryRule: ConfigurationProviderRule {
struct ForceTryRule: Rule {
var configuration = SeverityConfiguration<Self>(.error)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct ForceUnwrappingRule: OptInRule, SwiftSyntaxRule, ConfigurationProviderRule {
struct ForceUnwrappingRule: OptInRule, SwiftSyntaxRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct FunctionDefaultParameterAtEndRule: ConfigurationProviderRule, OptInRule {
struct FunctionDefaultParameterAtEndRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import SwiftSyntax

struct GenericTypeNameRule: SwiftSyntaxRule, ConfigurationProviderRule {
struct GenericTypeNameRule: SwiftSyntaxRule {
var configuration = NameConfiguration<Self>(minLengthWarning: 1,
minLengthError: 0,
maxLengthWarning: 20,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct ImplicitlyUnwrappedOptionalRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInRule {
struct ImplicitlyUnwrappedOptionalRule: SwiftSyntaxRule, OptInRule {
var configuration = ImplicitlyUnwrappedOptionalConfiguration()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct IsDisjointRule: ConfigurationProviderRule {
struct IsDisjointRule: Rule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct JoinedDefaultParameterRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule, OptInRule {
struct JoinedDefaultParameterRule: SwiftSyntaxCorrectableRule, OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct LegacyCGGeometryFunctionsRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule {
struct LegacyCGGeometryFunctionsRule: SwiftSyntaxCorrectableRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SwiftSyntax
import SwiftSyntaxBuilder

@SwiftSyntaxRule
struct LegacyConstantRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule {
struct LegacyConstantRule: SwiftSyntaxCorrectableRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct LegacyConstructorRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule {
struct LegacyConstructorRule: SwiftSyntaxCorrectableRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct LegacyHashingRule: ConfigurationProviderRule {
struct LegacyHashingRule: Rule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule(foldExpressions: true)
struct LegacyMultipleRule: OptInRule, ConfigurationProviderRule {
struct LegacyMultipleRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct LegacyNSGeometryFunctionsRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule {
struct LegacyNSGeometryFunctionsRule: SwiftSyntaxCorrectableRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private let legacyObjcTypes = [
]

@SwiftSyntaxRule
struct LegacyObjcTypeRule: OptInRule, ConfigurationProviderRule {
struct LegacyObjcTypeRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct LegacyRandomRule: ConfigurationProviderRule {
struct LegacyRandomRule: Rule {
var configuration = SeverityConfiguration<Self>(.warning)

static var description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import SourceKittenFramework

struct NimbleOperatorRule: ConfigurationProviderRule, OptInRule, CorrectableRule {
struct NimbleOperatorRule: OptInRule, CorrectableRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct NoExtensionAccessModifierRule: OptInRule, ConfigurationProviderRule {
struct NoExtensionAccessModifierRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.error)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct NoFallthroughOnlyRule: ConfigurationProviderRule {
struct NoFallthroughOnlyRule: Rule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SourceKittenFramework

struct NoGroupingExtensionRule: OptInRule, ConfigurationProviderRule {
struct NoGroupingExtensionRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct NoMagicNumbersRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule {
struct NoMagicNumbersRule: SwiftSyntaxRule, OptInRule {
var configuration = NoMagicNumbersConfiguration()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct ObjectLiteralRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInRule {
struct ObjectLiteralRule: SwiftSyntaxRule, OptInRule {
var configuration = ObjectLiteralConfiguration<Self>()

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct PatternMatchingKeywordsRule: ConfigurationProviderRule, OptInRule {
struct PatternMatchingKeywordsRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct PreferNimbleRule: OptInRule, ConfigurationProviderRule {
struct PreferNimbleRule: OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftSyntax

@SwiftSyntaxRule
struct PreferZeroOverExplicitInitRule: SwiftSyntaxCorrectableRule, OptInRule, ConfigurationProviderRule {
struct PreferZeroOverExplicitInitRule: SwiftSyntaxCorrectableRule, OptInRule {
var configuration = SeverityConfiguration<Self>(.warning)

static let description = RuleDescription(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftSyntax

struct PrivateOverFilePrivateRule: ConfigurationProviderRule, SwiftSyntaxCorrectableRule {
struct PrivateOverFilePrivateRule: SwiftSyntaxCorrectableRule {
var configuration = PrivateOverFilePrivateConfiguration()

static let description = RuleDescription(
Expand Down
Loading

0 comments on commit 2ed1fc2

Please sign in to comment.