From cabe12b9815e0d4aac2fa16f4bc853240b80030f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danny=20M=C3=B6sch?= Date: Sun, 24 Mar 2024 16:00:20 +0100 Subject: [PATCH] Rename severity configuration to allow its name to be inferred --- .../Rules/Idiomatic/FileNameNoSpaceRule.swift | 2 +- .../Rules/Idiomatic/FileNameRule.swift | 2 +- .../Rules/Idiomatic/GenericTypeNameRule.swift | 2 +- .../RedundantTypeAnnotationRule.swift | 2 +- .../Rules/Idiomatic/SyntacticSugarRule.swift | 2 +- .../Rules/Idiomatic/TypeNameRule.swift | 2 +- .../Lint/AccessibilityLabelForImageRule.swift | 2 +- .../Lint/AccessibilityTraitForButtonRule.swift | 2 +- .../Rules/Lint/BlanketDisableCommandRule.swift | 2 +- .../Rules/Lint/CaptureVariableRule.swift | 2 +- .../Rules/Lint/CommentSpacingRule.swift | 2 +- .../Rules/Lint/ExpiringTodoRule.swift | 6 +++--- .../Lint/InvalidSwiftLintCommandRule.swift | 2 +- .../Rules/Lint/PeriodSpacingRule.swift | 2 +- .../Rules/Lint/QuickDiscouragedCallRule.swift | 2 +- .../Rules/Lint/UnusedDeclarationRule.swift | 2 +- .../Rules/Lint/UnusedImportRule.swift | 2 +- .../AttributesConfiguration.swift | 2 +- .../BlanketDisableCommandConfiguration.swift | 2 +- .../CollectionAlignmentConfiguration.swift | 2 +- .../ColonConfiguration.swift | 2 +- .../ComputedAccessorsOrderConfiguration.swift | 2 +- ...ditionalReturnsOnNewlineConfiguration.swift | 2 +- .../DeploymentTargetConfiguration.swift | 6 +++--- .../DiscouragedDirectInitConfiguration.swift | 2 +- .../EmptyCountConfiguration.swift | 2 +- .../ExplicitInitConfiguration.swift | 2 +- .../ExplicitTypeInterfaceConfiguration.swift | 2 +- .../FileHeaderConfiguration.swift | 6 +++--- .../FileNameConfiguration.swift | 2 +- .../FileNameNoSpaceConfiguration.swift | 2 +- .../FileTypesOrderConfiguration.swift | 2 +- .../ForWhereConfiguration.swift | 2 +- .../ImplicitReturnConfiguration.swift | 2 +- ...licitlyUnwrappedOptionalConfiguration.swift | 2 +- .../InclusiveLanguageConfiguration.swift | 2 +- .../IndentationWidthConfiguration.swift | 2 +- .../ModifierOrderConfiguration.swift | 2 +- .../MultilineArgumentsConfiguration.swift | 2 +- .../MultilineParametersConfiguration.swift | 2 +- ...rridableClassDeclarationConfiguration.swift | 2 +- .../NumberSeparatorConfiguration.swift | 2 +- .../ObjectLiteralConfiguration.swift | 2 +- .../OpeningBraceConfiguration.swift | 2 +- .../OperatorUsageWhitespaceConfiguration.swift | 2 +- .../OverriddenSuperCallConfiguration.swift | 2 +- ...PrefixedTopLevelConstantConfiguration.swift | 2 +- .../PrivateOutletConfiguration.swift | 2 +- .../PrivateOverFilePrivateConfiguration.swift | 2 +- .../PrivateUnitTestConfiguration.swift | 6 +++--- .../ProhibitedSuperConfiguration.swift | 2 +- .../RedundantVoidReturnConfiguration.swift | 2 +- .../SelfBindingConfiguration.swift | 2 +- .../ShorthandArgumentConfiguration.swift | 2 +- .../SortedImportsConfiguration.swift | 2 +- .../StatementPositionConfiguration.swift | 2 +- .../SwitchCaseAlignmentConfiguration.swift | 2 +- .../TestCaseAccessibilityConfiguration.swift | 2 +- .../RuleConfigurations/TodoConfiguration.swift | 2 +- .../TrailingClosureConfiguration.swift | 2 +- .../TrailingCommaConfiguration.swift | 2 +- .../TrailingWhitespaceConfiguration.swift | 2 +- .../TypeContentsOrderConfiguration.swift | 2 +- .../UnitTestConfiguration.swift | 2 +- .../UnneededOverrideRuleConfiguration.swift | 2 +- .../UnusedDeclarationConfiguration.swift | 2 +- .../UnusedImportConfiguration.swift | 2 +- .../UnusedOptionalBindingConfiguration.swift | 2 +- ...lWhitespaceClosingBracesConfiguration.swift | 2 +- .../VerticalWhitespaceConfiguration.swift | 2 +- .../XCTSpecificMatcherConfiguration.swift | 2 +- .../Rules/Style/AttributesRule.swift | 2 +- .../Style/ClosureEndIndentationRule.swift | 2 +- .../Rules/Style/ColonRule.swift | 2 +- .../Rules/Style/CommaInheritanceRule.swift | 2 +- .../Rules/Style/CommaRule.swift | 2 +- .../Rules/Style/ExplicitSelfRule.swift | 2 +- .../Rules/Style/FileHeaderRule.swift | 2 +- .../Rules/Style/FileTypesOrderRule.swift | 2 +- .../Rules/Style/IdentifierNameRule.swift | 2 +- .../Rules/Style/IndentationWidthRule.swift | 6 +++--- .../Rules/Style/LeadingWhitespaceRule.swift | 2 +- .../LiteralExpressionEndIndentationRule.swift | 2 +- .../Rules/Style/ModifierOrderRule.swift | 2 +- .../Style/MultilineFunctionChainsRule.swift | 2 +- .../MultilineParametersBracketsRule.swift | 4 ++-- .../NonOverridableClassDeclarationRule.swift | 2 +- .../Style/OperatorUsageWhitespaceRule.swift | 2 +- .../Rules/Style/ShorthandArgumentRule.swift | 6 +++--- .../Rules/Style/SingleTestClassRule.swift | 2 +- .../Rules/Style/SortedImportsRule.swift | 2 +- .../Rules/Style/StatementPositionRule.swift | 4 ++-- .../Rules/Style/TrailingNewlineRule.swift | 2 +- .../Rules/Style/TrailingWhitespaceRule.swift | 2 +- .../Rules/Style/TypeContentsOrderRule.swift | 2 +- .../VerticalWhitespaceBetweenCasesRule.swift | 2 +- .../VerticalWhitespaceClosingBracesRule.swift | 2 +- .../VerticalWhitespaceOpeningBracesRule.swift | 2 +- .../Rules/Style/VerticalWhitespaceRule.swift | 2 +- Source/SwiftLintCore/Models/Linter.swift | 4 ++-- .../Models/SeverityConfiguration.swift | 14 +++++++------- .../Protocols/RuleConfiguration.swift | 6 +++--- .../Protocols/SwiftSyntaxRule.swift | 2 +- .../RegexConfiguration.swift | 8 ++++---- Source/SwiftLintCore/Rules/CustomRules.swift | 2 +- .../RuleConfigurationMacros.swift | 4 ++-- .../SwiftLintCoreMacros.swift | 4 +--- Tests/MacroTests/AutoApplyTests.swift | 18 ++++++++---------- .../ConfigurationTests+MultipleConfigs.swift | 2 +- .../CustomRulesTests.swift | 4 ++-- .../DeploymentTargetConfigurationTests.swift | 12 ++++++------ .../ExpiringTodoRuleTests.swift | 6 +++--- ...plicitTypeInterfaceConfigurationTests.swift | 4 ++-- .../ImplicitReturnConfigurationTests.swift | 2 +- ...lyUnwrappedOptionalConfigurationTests.swift | 12 ++++++------ .../ImplicitlyUnwrappedOptionalRuleTests.swift | 2 +- .../RuleConfigurationTests.swift | 14 +++++++------- .../TrailingClosureConfigurationTests.swift | 4 ++-- .../UnusedDeclarationConfigurationTests.swift | 2 +- 119 files changed, 174 insertions(+), 178 deletions(-) diff --git a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/FileNameNoSpaceRule.swift b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/FileNameNoSpaceRule.swift index 24f8afae05..41c29b7c5d 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/FileNameNoSpaceRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/FileNameNoSpaceRule.swift @@ -20,7 +20,7 @@ struct FileNameNoSpaceRule: OptInRule, SourceKitFreeRule { } return [StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: filePath, line: 1))] } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/FileNameRule.swift b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/FileNameRule.swift index fc8839f43d..9c8be1fe5c 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/FileNameRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/FileNameRule.swift @@ -46,7 +46,7 @@ struct FileNameRule: OptInRule, SourceKitFreeRule { } return [StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: filePath, line: 1))] } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/GenericTypeNameRule.swift b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/GenericTypeNameRule.swift index 0864c43827..c2d3f1b9ec 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/GenericTypeNameRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/GenericTypeNameRule.swift @@ -63,7 +63,7 @@ private extension GenericTypeNameRule { reason: """ Generic type name '\(name)' should only contain alphanumeric and other allowed characters """, - severity: configuration.unallowedSymbolsSeverity.severity + severity: configuration.unallowedSymbolsSeverity.violationSeverity ) ) } else if let caseCheckSeverity = configuration.validatesStartWithLowercase.severity, diff --git a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/RedundantTypeAnnotationRule.swift b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/RedundantTypeAnnotationRule.swift index 130066ede8..2b5fe3205a 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/RedundantTypeAnnotationRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/RedundantTypeAnnotationRule.swift @@ -80,7 +80,7 @@ struct RedundantTypeAnnotationRule: OptInRule, SubstitutionCorrectableRule { return violationRanges(in: file).map { range in StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: range.location) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/SyntacticSugarRule.swift b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/SyntacticSugarRule.swift index b398598357..eaa8f3da74 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/SyntacticSugarRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/SyntacticSugarRule.swift @@ -21,7 +21,7 @@ struct SyntacticSugarRule: CorrectableRule, SourceKitFreeRule { flattenViolations(visitor.violations) }.map { violation in return StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, byteOffset: ByteCount(violation.position)), reason: violation.type.violationReason) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/TypeNameRule.swift b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/TypeNameRule.swift index 7237a45514..ead9cced55 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/TypeNameRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/TypeNameRule.swift @@ -86,7 +86,7 @@ private extension TypeNameRule { return ReasonedRuleViolation( position: identifier.positionAfterSkippingLeadingTrivia, reason: "Type name '\(name)' should only contain alphanumeric and other allowed characters", - severity: nameConfiguration.unallowedSymbolsSeverity.severity + severity: nameConfiguration.unallowedSymbolsSeverity.violationSeverity ) } if let caseCheckSeverity = nameConfiguration.validatesStartWithLowercase.severity, diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityLabelForImageRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityLabelForImageRule.swift index 18dfda9d8e..246f4d4dd3 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityLabelForImageRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityLabelForImageRule.swift @@ -55,7 +55,7 @@ struct AccessibilityLabelForImageRule: ASTRule, OptInRule { violations.append( StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, byteOffset: offset)) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityTraitForButtonRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityTraitForButtonRule.swift index 62ab87460f..8b18928dfc 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityTraitForButtonRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/AccessibilityTraitForButtonRule.swift @@ -57,7 +57,7 @@ struct AccessibilityTraitForButtonRule: ASTRule, OptInRule { violations.append( StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, byteOffset: offset)) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/BlanketDisableCommandRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/BlanketDisableCommandRule.swift index 3229b27f30..d3568ce746 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/BlanketDisableCommandRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/BlanketDisableCommandRule.swift @@ -100,7 +100,7 @@ struct BlanketDisableCommandRule: Rule, SourceKitFreeRule { ) -> StyleViolation { StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: command.location(of: ruleIdentifier, in: file), reason: reason ) diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/CaptureVariableRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/CaptureVariableRule.swift index 388c0e96a1..d0f482f000 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/CaptureVariableRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/CaptureVariableRule.swift @@ -164,7 +164,7 @@ struct CaptureVariableRule: AnalyzerRule, CollectingRule { .filter { capturedVariable in collectedInfo.values.contains { $0.contains(capturedVariable.usr) } } .map { StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, byteOffset: $0.offset)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/CommentSpacingRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/CommentSpacingRule.swift index 464f15f134..c2d3a1174b 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/CommentSpacingRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/CommentSpacingRule.swift @@ -152,7 +152,7 @@ struct CommentSpacingRule: SourceKitFreeRule, SubstitutionCorrectableRule { return violationRanges(in: file).map { range in StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: range.location) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/ExpiringTodoRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/ExpiringTodoRule.swift index 851128a234..ee5fa581d3 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/ExpiringTodoRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/ExpiringTodoRule.swift @@ -88,11 +88,11 @@ struct ExpiringTodoRule: OptInRule { private func severity(for violationLevel: ExpiryViolationLevel) -> ViolationSeverity? { switch violationLevel { case .approachingExpiry: - return configuration.approachingExpirySeverity.severity + return configuration.approachingExpirySeverity.violationSeverity case .expired: - return configuration.expiredSeverity.severity + return configuration.expiredSeverity.violationSeverity case .badFormatting: - return configuration.badFormattingSeverity.severity + return configuration.badFormattingSeverity.violationSeverity } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/InvalidSwiftLintCommandRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/InvalidSwiftLintCommandRule.swift index 71fed8fc04..4c5fa3f9c6 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/InvalidSwiftLintCommandRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/InvalidSwiftLintCommandRule.swift @@ -62,7 +62,7 @@ struct InvalidSwiftLintCommandRule: Rule, SourceKitFreeRule { let character = command.startingCharacterPosition(in: file) return StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file.path, line: command.line, character: character), reason: reason ) diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/PeriodSpacingRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/PeriodSpacingRule.swift index e53bd22288..e1bcf5b3c2 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/PeriodSpacingRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/PeriodSpacingRule.swift @@ -80,7 +80,7 @@ struct PeriodSpacingRule: SourceKitFreeRule, OptInRule, SubstitutionCorrectableR return violationRanges(in: file).map { range in StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: range.location) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/QuickDiscouragedCallRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/QuickDiscouragedCallRule.swift index 13d5380cab..735d457a69 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/QuickDiscouragedCallRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/QuickDiscouragedCallRule.swift @@ -53,7 +53,7 @@ struct QuickDiscouragedCallRule: OptInRule { return violationOffsets(in: dictionary.enclosedArguments).map { StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, byteOffset: $0), reason: "Discouraged call inside a '\(name)' block") } diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/UnusedDeclarationRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/UnusedDeclarationRule.swift index 4820a6b35e..66f623babf 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/UnusedDeclarationRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/UnusedDeclarationRule.swift @@ -61,7 +61,7 @@ struct UnusedDeclarationRule: AnalyzerRule, CollectingRule { allReferencedUSRs: allReferencedUSRs) .map { StyleViolation(ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, byteOffset: $0)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Lint/UnusedImportRule.swift b/Source/SwiftLintBuiltInRules/Rules/Lint/UnusedImportRule.swift index 31d5be392b..332db5e721 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Lint/UnusedImportRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Lint/UnusedImportRule.swift @@ -20,7 +20,7 @@ struct UnusedImportRule: CorrectableRule, AnalyzerRule { func validate(file: SwiftLintFile, compilerArguments: [String]) -> [StyleViolation] { return importUsage(in: file, compilerArguments: compilerArguments).map { importUsage in StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: importUsage.violationRange?.location ?? 1), reason: importUsage.violationReason) } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/AttributesConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/AttributesConfiguration.swift index e9a6fe06b9..26c84346da 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/AttributesConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/AttributesConfiguration.swift @@ -5,7 +5,7 @@ struct AttributesConfiguration: SeverityBasedRuleConfiguration { typealias Parent = AttributesRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "attributes_with_arguments_always_on_line_above") private(set) var attributesWithArgumentsAlwaysOnNewLine = true @ConfigurationElement(key: "always_on_same_line") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/BlanketDisableCommandConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/BlanketDisableCommandConfiguration.swift index b7bc5e1d31..a38bd81897 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/BlanketDisableCommandConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/BlanketDisableCommandConfiguration.swift @@ -5,7 +5,7 @@ struct BlanketDisableCommandConfiguration: SeverityBasedRuleConfiguration { typealias Parent = BlanketDisableCommandRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "allowed_rules") private(set) var allowedRuleIdentifiers: Set = [ "file_header", diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/CollectionAlignmentConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/CollectionAlignmentConfiguration.swift index 0838689139..70bc93cb7e 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/CollectionAlignmentConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/CollectionAlignmentConfiguration.swift @@ -5,7 +5,7 @@ struct CollectionAlignmentConfiguration: SeverityBasedRuleConfiguration { typealias Parent = CollectionAlignmentRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "align_colons") private(set) var alignColons = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ColonConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ColonConfiguration.swift index ee0379a0a7..c3db2e0cc3 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ColonConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ColonConfiguration.swift @@ -5,7 +5,7 @@ struct ColonConfiguration: SeverityBasedRuleConfiguration { typealias Parent = ColonRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "flexible_right_spacing") private(set) var flexibleRightSpacing = false @ConfigurationElement(key: "apply_to_dictionaries") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ComputedAccessorsOrderConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ComputedAccessorsOrderConfiguration.swift index 01a3a2e3eb..2bc0b33d23 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ComputedAccessorsOrderConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ComputedAccessorsOrderConfiguration.swift @@ -11,7 +11,7 @@ struct ComputedAccessorsOrderConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "order") private(set) var order = Order.getSet } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ConditionalReturnsOnNewlineConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ConditionalReturnsOnNewlineConfiguration.swift index 2a44156d46..b00d6f5e8d 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ConditionalReturnsOnNewlineConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ConditionalReturnsOnNewlineConfiguration.swift @@ -5,7 +5,7 @@ struct ConditionalReturnsOnNewlineConfiguration: SeverityBasedRuleConfiguration typealias Parent = ConditionalReturnsOnNewlineRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "if_only") private(set) var ifOnly = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/DeploymentTargetConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/DeploymentTargetConfiguration.swift index 8490c18a99..9593bff62b 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/DeploymentTargetConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/DeploymentTargetConfiguration.swift @@ -105,12 +105,12 @@ struct DeploymentTargetConfiguration: SeverityBasedRuleConfiguration { private(set) var tvOSDeploymentTarget = Version(platform: .tvOS, major: 9) private(set) var tvOSAppExtensionDeploymentTarget = Version(platform: .tvOSApplicationExtension, major: 9) - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) private let targets: [String: Version] var parameterDescription: RuleConfigurationDescription? { - severityConfiguration + severity for (platform, target) in targets.sorted(by: { $0.key < $1.key }) { platform => .symbol(target.stringValue) } @@ -135,7 +135,7 @@ struct DeploymentTargetConfiguration: SeverityBasedRuleConfiguration { } for (key, value) in configuration { if key == "severity", let value = value as? String { - try severityConfiguration.apply(configuration: value) + try severity.apply(configuration: value) continue } guard let target = targets[key] else { diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/DiscouragedDirectInitConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/DiscouragedDirectInitConfiguration.swift index 22641758c6..94d83e011e 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/DiscouragedDirectInitConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/DiscouragedDirectInitConfiguration.swift @@ -5,7 +5,7 @@ struct DiscouragedDirectInitConfiguration: SeverityBasedRuleConfiguration { typealias Parent = DiscouragedDirectInitRule @ConfigurationElement(key: "severity") - var severityConfiguration = SeverityConfiguration(.warning) + var severity = SeverityConfiguration(.warning) @ConfigurationElement( key: "types", diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/EmptyCountConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/EmptyCountConfiguration.swift index c0302c9cee..e7de3913b0 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/EmptyCountConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/EmptyCountConfiguration.swift @@ -5,7 +5,7 @@ struct EmptyCountConfiguration: SeverityBasedRuleConfiguration { typealias Parent = EmptyCountRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.error) + private(set) var severity = SeverityConfiguration(.error) @ConfigurationElement(key: "only_after_dot") private(set) var onlyAfterDot = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ExplicitInitConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ExplicitInitConfiguration.swift index 12797b725e..a418fb58a6 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ExplicitInitConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ExplicitInitConfiguration.swift @@ -3,7 +3,7 @@ struct ExplicitInitConfiguration: SeverityBasedRuleConfiguration { typealias Parent = ExplicitInitRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "include_bare_init") private(set) var includeBareInit = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ExplicitTypeInterfaceConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ExplicitTypeInterfaceConfiguration.swift index b57dd54f74..541039e8d9 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ExplicitTypeInterfaceConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ExplicitTypeInterfaceConfiguration.swift @@ -15,7 +15,7 @@ struct ExplicitTypeInterfaceConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "excluded") private(set) var excluded = [VariableKind]() @ConfigurationElement(key: "allow_redundancy") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileHeaderConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileHeaderConfiguration.swift index fd0557b99a..e59b795a84 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileHeaderConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileHeaderConfiguration.swift @@ -11,7 +11,7 @@ struct FileHeaderConfiguration: SeverityBasedRuleConfiguration { [.anchorsMatchLines, .dotMatchesLineSeparators] @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "required_string") private var requiredString: String? @ConfigurationElement(key: "required_pattern") @@ -60,8 +60,8 @@ struct FileHeaderConfiguration: SeverityBasedRuleConfiguration { } } - if let severityString = configuration[$severityConfiguration.key] { - try severityConfiguration.apply(configuration: severityString) + if let severityString = configuration[$severity.key] { + try severity.apply(configuration: severityString) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileNameConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileNameConfiguration.swift index 9caeff15f9..4690e640c3 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileNameConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileNameConfiguration.swift @@ -5,7 +5,7 @@ struct FileNameConfiguration: SeverityBasedRuleConfiguration { typealias Parent = FileNameRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "excluded") private(set) var excluded: Set = ["main.swift", "LinuxMain.swift"] @ConfigurationElement(key: "prefix_pattern") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileNameNoSpaceConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileNameNoSpaceConfiguration.swift index 8482977ece..31e9513782 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileNameNoSpaceConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileNameNoSpaceConfiguration.swift @@ -5,7 +5,7 @@ struct FileNameNoSpaceConfiguration: SeverityBasedRuleConfiguration { typealias Parent = FileNameNoSpaceRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration.warning + private(set) var severity = SeverityConfiguration.warning @ConfigurationElement(key: "excluded") private(set) var excluded = Set() } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileTypesOrderConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileTypesOrderConfiguration.swift index f9d6c34323..c0dcf8b64c 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileTypesOrderConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FileTypesOrderConfiguration.swift @@ -14,7 +14,7 @@ struct FileTypesOrderConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "order") private(set) var order: [[FileType]] = [ [.supportingType], diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ForWhereConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ForWhereConfiguration.swift index 56f13072e4..f7eaf2a4e4 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ForWhereConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ForWhereConfiguration.swift @@ -5,7 +5,7 @@ struct ForWhereConfiguration: SeverityBasedRuleConfiguration { typealias Parent = ForWhereRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "allow_for_as_filter") private(set) var allowForAsFilter = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ImplicitReturnConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ImplicitReturnConfiguration.swift index 8c1c2af319..199ec86334 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ImplicitReturnConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ImplicitReturnConfiguration.swift @@ -20,7 +20,7 @@ struct ImplicitReturnConfiguration: SeverityBasedRuleConfiguration { static let defaultIncludedKinds = Set(ReturnKind.allCases) @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "included") private(set) var includedKinds = Self.defaultIncludedKinds diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ImplicitlyUnwrappedOptionalConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ImplicitlyUnwrappedOptionalConfiguration.swift index 1f4ec57f41..1648e19a1e 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ImplicitlyUnwrappedOptionalConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ImplicitlyUnwrappedOptionalConfiguration.swift @@ -12,7 +12,7 @@ struct ImplicitlyUnwrappedOptionalConfiguration: SeverityBasedRuleConfiguration } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration.warning + private(set) var severity = SeverityConfiguration.warning @ConfigurationElement(key: "mode") private(set) var mode = ImplicitlyUnwrappedOptionalModeConfiguration.allExceptIBOutlets } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/InclusiveLanguageConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/InclusiveLanguageConfiguration.swift index 03d2e472bb..6ed0c04609 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/InclusiveLanguageConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/InclusiveLanguageConfiguration.swift @@ -16,7 +16,7 @@ struct InclusiveLanguageConfiguration: SeverityBasedRuleConfiguration { ] @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "additional_terms") private(set) var additionalTerms: Set? @ConfigurationElement(key: "override_terms") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/IndentationWidthConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/IndentationWidthConfiguration.swift index 8f78f761b4..12bfa09a05 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/IndentationWidthConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/IndentationWidthConfiguration.swift @@ -5,7 +5,7 @@ struct IndentationWidthConfiguration: SeverityBasedRuleConfiguration { typealias Parent = IndentationWidthRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration.warning + private(set) var severity = SeverityConfiguration.warning @ConfigurationElement( key: "indentation_width", postprocessor: { if $0 < 1 { throw Issue.invalidConfiguration(ruleID: Parent.identifier) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ModifierOrderConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ModifierOrderConfiguration.swift index 70338e61ed..79fbfdcdd7 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ModifierOrderConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ModifierOrderConfiguration.swift @@ -6,7 +6,7 @@ struct ModifierOrderConfiguration: SeverityBasedRuleConfiguration { typealias Parent = ModifierOrderRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "preferred_modifier_order") private(set) var preferredModifierOrder: [SwiftDeclarationAttributeKind.ModifierGroup] = [ .override, diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineArgumentsConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineArgumentsConfiguration.swift index 674e5fb039..a16e8a92d1 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineArgumentsConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineArgumentsConfiguration.swift @@ -12,7 +12,7 @@ struct MultilineArgumentsConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "first_argument_location") private(set) var firstArgumentLocation = FirstArgumentLocation.anyLine @ConfigurationElement(key: "only_enforce_after_first_closure_on_first_line") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineParametersConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineParametersConfiguration.swift index 963afd7b6e..733b2edff1 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineParametersConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/MultilineParametersConfiguration.swift @@ -5,7 +5,7 @@ struct MultilineParametersConfiguration: SeverityBasedRuleConfiguration { typealias Parent = MultilineParametersRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "allows_single_line") private(set) var allowsSingleLine = true } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/NonOverridableClassDeclarationConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/NonOverridableClassDeclarationConfiguration.swift index 5022944724..32e12ef088 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/NonOverridableClassDeclarationConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/NonOverridableClassDeclarationConfiguration.swift @@ -11,7 +11,7 @@ struct NonOverridableClassDeclarationConfiguration: SeverityBasedRuleConfigurati } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration.warning + private(set) var severity = SeverityConfiguration.warning @ConfigurationElement(key: "final_class_modifier") private(set) var finalClassModifier = FinalClassModifier.finalClass } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/NumberSeparatorConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/NumberSeparatorConfiguration.swift index 6268222e0a..093ba58df9 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/NumberSeparatorConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/NumberSeparatorConfiguration.swift @@ -28,7 +28,7 @@ struct NumberSeparatorConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "minimum_length") private(set) var minimumLength = 0 @ConfigurationElement(key: "minimum_fraction_length") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ObjectLiteralConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ObjectLiteralConfiguration.swift index fd691da869..06b87f6efa 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ObjectLiteralConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ObjectLiteralConfiguration.swift @@ -5,7 +5,7 @@ typealias DiscouragedObjectLiteralConfiguration = ObjectLiteralConfiguration: SeverityBasedRuleConfiguration { @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "image_literal") private(set) var imageLiteral = true @ConfigurationElement(key: "color_literal") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OpeningBraceConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OpeningBraceConfiguration.swift index 85f40e1da0..59b4b84167 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OpeningBraceConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OpeningBraceConfiguration.swift @@ -5,7 +5,7 @@ struct OpeningBraceConfiguration: SeverityBasedRuleConfiguration { typealias Parent = OpeningBraceRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "allow_multiline_func") private(set) var allowMultilineFunc = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OperatorUsageWhitespaceConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OperatorUsageWhitespaceConfiguration.swift index 09c8bcd489..2b78febe86 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OperatorUsageWhitespaceConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OperatorUsageWhitespaceConfiguration.swift @@ -5,7 +5,7 @@ struct OperatorUsageWhitespaceConfiguration: SeverityBasedRuleConfiguration { typealias Parent = OperatorUsageWhitespaceRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "lines_look_around") private(set) var linesLookAround = 2 @ConfigurationElement(key: "skip_aligned_constants") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OverriddenSuperCallConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OverriddenSuperCallConfiguration.swift index ca2a9aeb32..ec52e9eacf 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OverriddenSuperCallConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/OverriddenSuperCallConfiguration.swift @@ -37,7 +37,7 @@ struct OverriddenSuperCallConfiguration: SeverityBasedRuleConfiguration { ] @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "excluded") private(set) var excluded = [String]() @ConfigurationElement(key: "included") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrefixedTopLevelConstantConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrefixedTopLevelConstantConfiguration.swift index f6057ceb93..4af5cb5190 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrefixedTopLevelConstantConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrefixedTopLevelConstantConfiguration.swift @@ -5,7 +5,7 @@ struct PrefixedTopLevelConstantConfiguration: SeverityBasedRuleConfiguration { typealias Parent = PrefixedTopLevelConstantRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "only_private") private(set) var onlyPrivateMembers = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateOutletConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateOutletConfiguration.swift index e31075e071..93ad71a1a6 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateOutletConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateOutletConfiguration.swift @@ -5,7 +5,7 @@ struct PrivateOutletConfiguration: SeverityBasedRuleConfiguration { typealias Parent = PrivateOutletRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "allow_private_set") private(set) var allowPrivateSet = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateOverFilePrivateConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateOverFilePrivateConfiguration.swift index ed9766230f..b7ef730738 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateOverFilePrivateConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateOverFilePrivateConfiguration.swift @@ -5,7 +5,7 @@ struct PrivateOverFilePrivateConfiguration: SeverityBasedRuleConfiguration { typealias Parent = PrivateOverFilePrivateRule @ConfigurationElement(key: "severity") - var severityConfiguration = SeverityConfiguration(.warning) + var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "validate_extensions") var validateExtensions = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateUnitTestConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateUnitTestConfiguration.swift index 65b14cdcfe..7105d072c0 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateUnitTestConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/PrivateUnitTestConfiguration.swift @@ -5,7 +5,7 @@ struct PrivateUnitTestConfiguration: SeverityBasedRuleConfiguration { typealias Parent = PrivateUnitTestRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "test_parent_classes") private(set) var testParentClasses: Set = ["QuickSpec", "XCTestCase"] @@ -52,8 +52,8 @@ struct PrivateUnitTestConfiguration: SeverityBasedRuleConfiguration { "warning: 'message' is ignored from now on. You may remove it from the configuration file." ) } - if let severityString = configurationDict[$severityConfiguration.key] as? String { - try severityConfiguration.apply(configuration: severityString) + if let severityString = configurationDict[$severity.key] as? String { + try severity.apply(configuration: severityString) } } } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ProhibitedSuperConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ProhibitedSuperConfiguration.swift index 914e3a5dfc..2b231d91c5 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ProhibitedSuperConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ProhibitedSuperConfiguration.swift @@ -5,7 +5,7 @@ struct ProhibitedSuperConfiguration: SeverityBasedRuleConfiguration { typealias Parent = ProhibitedSuperRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "excluded") private(set) var excluded = [String]() @ConfigurationElement(key: "included") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/RedundantVoidReturnConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/RedundantVoidReturnConfiguration.swift index c81e36723a..4992caad6f 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/RedundantVoidReturnConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/RedundantVoidReturnConfiguration.swift @@ -3,7 +3,7 @@ struct RedundantVoidReturnConfiguration: SeverityBasedRuleConfiguration { typealias Parent = RedundantVoidReturnRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "include_closures") private(set) var includeClosures = true } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SelfBindingConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SelfBindingConfiguration.swift index 005a838f3c..2e6b88e921 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SelfBindingConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SelfBindingConfiguration.swift @@ -5,7 +5,7 @@ struct SelfBindingConfiguration: SeverityBasedRuleConfiguration { typealias Parent = SelfBindingRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "bind_identifier") private(set) var bindIdentifier = "self" } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ShorthandArgumentConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ShorthandArgumentConfiguration.swift index e5313e64d9..de85921b6e 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ShorthandArgumentConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/ShorthandArgumentConfiguration.swift @@ -5,7 +5,7 @@ struct ShorthandArgumentConfiguration: SeverityBasedRuleConfiguration { typealias Parent = ShorthandArgumentRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "allow_until_line_after_opening_brace") private(set) var allowUntilLineAfterOpeningBrace = 4 @ConfigurationElement(key: "always_disallow_more_than_one") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SortedImportsConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SortedImportsConfiguration.swift index 8aaab0abc8..7e51f1edb9 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SortedImportsConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SortedImportsConfiguration.swift @@ -14,7 +14,7 @@ struct SortedImportsConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "grouping") private(set) var grouping = SortedImportsGroupingConfiguration.names } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/StatementPositionConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/StatementPositionConfiguration.swift index a0361e64d7..8825e16270 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/StatementPositionConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/StatementPositionConfiguration.swift @@ -11,7 +11,7 @@ struct StatementPositionConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration.warning + private(set) var severity = SeverityConfiguration.warning @ConfigurationElement(key: "statement_mode") private(set) var statementMode = StatementModeConfiguration.default } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SwitchCaseAlignmentConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SwitchCaseAlignmentConfiguration.swift index 7f0a94920e..66d381f9f9 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SwitchCaseAlignmentConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/SwitchCaseAlignmentConfiguration.swift @@ -5,7 +5,7 @@ struct SwitchCaseAlignmentConfiguration: SeverityBasedRuleConfiguration { typealias Parent = SwitchCaseAlignmentRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "indented_cases") private(set) var indentedCases = false @ConfigurationElement(key: "ignore_one_liners") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TestCaseAccessibilityConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TestCaseAccessibilityConfiguration.swift index 05296ceb18..104ffa0661 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TestCaseAccessibilityConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TestCaseAccessibilityConfiguration.swift @@ -5,7 +5,7 @@ struct TestCaseAccessibilityConfiguration: SeverityBasedRuleConfiguration { typealias Parent = TestCaseAccessibilityRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "allowed_prefixes") private(set) var allowedPrefixes: Set = [] @ConfigurationElement( diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TodoConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TodoConfiguration.swift index 437c57a2cb..89b53abbff 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TodoConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TodoConfiguration.swift @@ -11,7 +11,7 @@ struct TodoConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "only") private(set) var only = TodoKeyword.allCases } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingClosureConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingClosureConfiguration.swift index e4b4862921..dc19b00dca 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingClosureConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingClosureConfiguration.swift @@ -5,7 +5,7 @@ struct TrailingClosureConfiguration: SeverityBasedRuleConfiguration { typealias Parent = TrailingClosureRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "only_single_muted_parameter") private(set) var onlySingleMutedParameter = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingCommaConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingCommaConfiguration.swift index f386f1967d..fc20559c92 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingCommaConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingCommaConfiguration.swift @@ -5,7 +5,7 @@ struct TrailingCommaConfiguration: SeverityBasedRuleConfiguration { typealias Parent = TrailingCommaRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "mandatory_comma") private(set) var mandatoryComma = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingWhitespaceConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingWhitespaceConfiguration.swift index d8577e64ae..046c6333b9 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingWhitespaceConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TrailingWhitespaceConfiguration.swift @@ -5,7 +5,7 @@ struct TrailingWhitespaceConfiguration: SeverityBasedRuleConfiguration { typealias Parent = TrailingWhitespaceRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "ignores_empty_lines") private(set) var ignoresEmptyLines = false @ConfigurationElement(key: "ignores_comments") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TypeContentsOrderConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TypeContentsOrderConfiguration.swift index 811622d0f7..1563fa3e9c 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TypeContentsOrderConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/TypeContentsOrderConfiguration.swift @@ -24,7 +24,7 @@ struct TypeContentsOrderConfiguration: SeverityBasedRuleConfiguration { typealias Parent = TypeContentsOrderRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "order") private(set) var order: [[TypeContent]] = [ [.case], diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnitTestConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnitTestConfiguration.swift index 43be8e9889..eb4dd994fe 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnitTestConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnitTestConfiguration.swift @@ -9,7 +9,7 @@ typealias SingleTestClassConfiguration = UnitTestConfiguration: SeverityBasedRuleConfiguration { @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement( key: "test_parent_classes", postprocessor: { $0.formUnion(["QuickSpec", "XCTestCase"]) } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnneededOverrideRuleConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnneededOverrideRuleConfiguration.swift index 14d4968152..130420abd9 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnneededOverrideRuleConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnneededOverrideRuleConfiguration.swift @@ -5,7 +5,7 @@ struct UnneededOverrideRuleConfiguration: SeverityBasedRuleConfiguration { typealias Parent = UnneededOverrideRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "affect_initializers") private(set) var affectInits = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedDeclarationConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedDeclarationConfiguration.swift index 58877e82a5..1daea7732c 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedDeclarationConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedDeclarationConfiguration.swift @@ -5,7 +5,7 @@ struct UnusedDeclarationConfiguration: SeverityBasedRuleConfiguration { typealias Parent = UnusedDeclarationRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration.error + private(set) var severity = SeverityConfiguration.error @ConfigurationElement(key: "include_public_and_open") private(set) var includePublicAndOpen = false @ConfigurationElement( diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedImportConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedImportConfiguration.swift index 5e9f2eec69..7137608416 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedImportConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedImportConfiguration.swift @@ -32,7 +32,7 @@ struct UnusedImportConfiguration: SeverityBasedRuleConfiguration { typealias Parent = UnusedImportRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration.warning + private(set) var severity = SeverityConfiguration.warning @ConfigurationElement(key: "require_explicit_imports") private(set) var requireExplicitImports = false @ConfigurationElement(key: "allowed_transitive_imports") diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedOptionalBindingConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedOptionalBindingConfiguration.swift index fa094ad346..81811d9527 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedOptionalBindingConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/UnusedOptionalBindingConfiguration.swift @@ -5,7 +5,7 @@ struct UnusedOptionalBindingConfiguration: SeverityBasedRuleConfiguration { typealias Parent = UnusedOptionalBindingRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "ignore_optional_try") private(set) var ignoreOptionalTry = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/VerticalWhitespaceClosingBracesConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/VerticalWhitespaceClosingBracesConfiguration.swift index 700b06e04b..dfe95b392b 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/VerticalWhitespaceClosingBracesConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/VerticalWhitespaceClosingBracesConfiguration.swift @@ -5,7 +5,7 @@ struct VerticalWhitespaceClosingBracesConfiguration: SeverityBasedRuleConfigurat typealias Parent = VerticalWhitespaceClosingBracesRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "only_enforce_before_trivial_lines") private(set) var onlyEnforceBeforeTrivialLines = false } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/VerticalWhitespaceConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/VerticalWhitespaceConfiguration.swift index 2249594ee8..9bc1c03b8d 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/VerticalWhitespaceConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/VerticalWhitespaceConfiguration.swift @@ -5,7 +5,7 @@ struct VerticalWhitespaceConfiguration: SeverityBasedRuleConfiguration { typealias Parent = VerticalWhitespaceRule @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "max_empty_lines") private(set) var maxEmptyLines = 1 } diff --git a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/XCTSpecificMatcherConfiguration.swift b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/XCTSpecificMatcherConfiguration.swift index 249c35ef4e..8c7c571001 100644 --- a/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/XCTSpecificMatcherConfiguration.swift +++ b/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/XCTSpecificMatcherConfiguration.swift @@ -11,7 +11,7 @@ struct XCTSpecificMatcherConfiguration: SeverityBasedRuleConfiguration { } @ConfigurationElement(key: "severity") - private(set) var severityConfiguration = SeverityConfiguration(.warning) + private(set) var severity = SeverityConfiguration(.warning) @ConfigurationElement(key: "matchers") private(set) var matchers = Matcher.allCases } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/AttributesRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/AttributesRule.swift index ed24df070e..d30e368e54 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/AttributesRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/AttributesRule.swift @@ -46,7 +46,7 @@ private extension AttributesRule { ReasonedRuleViolation( position: helper.violationPosition, reason: reason, - severity: configuration.severityConfiguration.severity + severity: configuration.severity.violationSeverity ) ) return diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/ClosureEndIndentationRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/ClosureEndIndentationRule.swift index 018848ef83..6ea9706e3e 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/ClosureEndIndentationRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/ClosureEndIndentationRule.swift @@ -28,7 +28,7 @@ struct ClosureEndIndentationRule: Rule, OptInRule { "got \(violation.indentationRanges.actual.length)" return StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, byteOffset: violation.endOffset), reason: reason) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/ColonRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/ColonRule.swift index 3d382b6e2e..3af2ab6516 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/ColonRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/ColonRule.swift @@ -20,7 +20,7 @@ struct ColonRule: SubstitutionCorrectableRule, SourceKitFreeRule { func validate(file: SwiftLintFile) -> [StyleViolation] { violationRanges(in: file).map { range in StyleViolation(ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, characterOffset: range.location)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/CommaInheritanceRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/CommaInheritanceRule.swift index a304035d78..4069885686 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/CommaInheritanceRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/CommaInheritanceRule.swift @@ -63,7 +63,7 @@ struct CommaInheritanceRule: OptInRule, SubstitutionCorrectableRule, func validate(file: SwiftLintFile) -> [StyleViolation] { return violationRanges(in: file).map { StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: $0.location)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/CommaRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/CommaRule.swift index edb3054648..7568e00616 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/CommaRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/CommaRule.swift @@ -91,7 +91,7 @@ struct CommaRule: CorrectableRule, SourceKitFreeRule { func validate(file: SwiftLintFile) -> [StyleViolation] { return violationRanges(in: file).map { StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, byteOffset: $0.0.location)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/ExplicitSelfRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/ExplicitSelfRule.swift index 89df900515..45fb3d157b 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/ExplicitSelfRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/ExplicitSelfRule.swift @@ -18,7 +18,7 @@ struct ExplicitSelfRule: CorrectableRule, AnalyzerRule { func validate(file: SwiftLintFile, compilerArguments: [String]) -> [StyleViolation] { return violationRanges(in: file, compilerArguments: compilerArguments).map { StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: $0.location)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/FileHeaderRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/FileHeaderRule.swift index a92b6cae38..863204fc3c 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/FileHeaderRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/FileHeaderRule.swift @@ -96,7 +96,7 @@ struct FileHeaderRule: OptInRule { private func makeViolation(at location: Location) -> StyleViolation { return StyleViolation(ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: location, reason: "Header comments should be consistent with project patterns") } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/FileTypesOrderRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/FileTypesOrderRule.swift index 202dc76a34..986b33c8e7 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/FileTypesOrderRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/FileTypesOrderRule.swift @@ -79,7 +79,7 @@ struct FileTypesOrderRule: OptInRule { let styleViolation = StyleViolation( ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, byteOffset: fileTypeOffset.offset), reason: "\(article) '\(fileType)' should not be placed amongst the file type(s) '\(expected)'" ) diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/IdentifierNameRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/IdentifierNameRule.swift index 8b4564ea78..4251e428da 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/IdentifierNameRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/IdentifierNameRule.swift @@ -117,7 +117,7 @@ private extension IdentifierNameRule { \(type) should only contain alphanumeric and other \ allowed characters """ - return (reason, nameConfiguration.unallowedSymbolsSeverity.severity) + return (reason, nameConfiguration.unallowedSymbolsSeverity.violationSeverity) } if let severity = nameConfiguration.severity(forLength: type.name.count) { diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/IndentationWidthRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/IndentationWidthRule.swift index d79e11b85b..ad27913a00 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/IndentationWidthRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/IndentationWidthRule.swift @@ -66,7 +66,7 @@ struct IndentationWidthRule: OptInRule { violations.append( StyleViolation( ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, characterOffset: line.range.location), reason: "Code should be indented with tabs or " + "\(configuration.indentationWidth) spaces, but not both in the same line" @@ -90,7 +90,7 @@ struct IndentationWidthRule: OptInRule { violations.append( StyleViolation( ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, characterOffset: line.range.location), reason: "The first line shall not be indented" ) @@ -115,7 +115,7 @@ struct IndentationWidthRule: OptInRule { violations.append( StyleViolation( ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, characterOffset: line.range.location), reason: isIndentation ? "Code should be indented using one tab or \(indentWidth) spaces" : diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/LeadingWhitespaceRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/LeadingWhitespaceRule.swift index 59ccd8b946..a8ef09b461 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/LeadingWhitespaceRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/LeadingWhitespaceRule.swift @@ -28,7 +28,7 @@ struct LeadingWhitespaceRule: CorrectableRule, SourceKitFreeRule { } return [StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file.path, line: 1))] } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/LiteralExpressionEndIndentationRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/LiteralExpressionEndIndentationRule.swift index 245a2cb5ea..7a7da9188e 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/LiteralExpressionEndIndentationRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/LiteralExpressionEndIndentationRule.swift @@ -133,7 +133,7 @@ struct LiteralExpressionEndIndentationRule: Rule, OptInRule { "got \(violation.indentationRanges.actual.length)" return StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, byteOffset: violation.endOffset), reason: reason) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/ModifierOrderRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/ModifierOrderRule.swift index 409e5f3760..e37ed68b7e 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/ModifierOrderRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/ModifierOrderRule.swift @@ -29,7 +29,7 @@ struct ModifierOrderRule: ASTRule, OptInRule, CorrectableRule { return [ StyleViolation( ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, byteOffset: offset), reason: reason ) diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/MultilineFunctionChainsRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/MultilineFunctionChainsRule.swift index a12b0e8fd1..b6b52ec4e3 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/MultilineFunctionChainsRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/MultilineFunctionChainsRule.swift @@ -97,7 +97,7 @@ struct MultilineFunctionChainsRule: ASTRule, OptInRule { dictionary: SourceKittenDictionary) -> [StyleViolation] { return violatingOffsets(file: file, kind: kind, dictionary: dictionary).map { offset in return StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: offset)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/MultilineParametersBracketsRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/MultilineParametersBracketsRule.swift index ee19dca382..1da8b7d83b 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/MultilineParametersBracketsRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/MultilineParametersBracketsRule.swift @@ -154,7 +154,7 @@ struct MultilineParametersBracketsRule: OptInRule { return StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: invalidMatch.range.location + 1) ) } @@ -178,7 +178,7 @@ struct MultilineParametersBracketsRule: OptInRule { let characterOffset = lastParamRange.upperBound + invalidMatch.range.upperBound - 1 return StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: characterOffset) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/NonOverridableClassDeclarationRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/NonOverridableClassDeclarationRule.swift index bec336d152..7f0ec87ffa 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/NonOverridableClassDeclarationRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/NonOverridableClassDeclarationRule.swift @@ -132,7 +132,7 @@ private extension NonOverridableClassDeclarationRule { reason: inFinalClass ? "Class \(types) in final classes should themselves be final" : "Private class methods and properties should be declared final", - severity: configuration.severity + severity: configuration.violationSeverity )) violationCorrections.append( ViolationCorrection( diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/OperatorUsageWhitespaceRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/OperatorUsageWhitespaceRule.swift index af8818806e..735ccb1641 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/OperatorUsageWhitespaceRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/OperatorUsageWhitespaceRule.swift @@ -18,7 +18,7 @@ struct OperatorUsageWhitespaceRule: OptInRule, CorrectableRule, SourceKitFreeRul func validate(file: SwiftLintFile) -> [StyleViolation] { return violationRanges(file: file).map { range, _ in StyleViolation(ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, byteOffset: range.location)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/ShorthandArgumentRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/ShorthandArgumentRule.swift index 1bb1df43ac..190d54b136 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/ShorthandArgumentRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/ShorthandArgumentRule.swift @@ -79,7 +79,7 @@ private extension ShorthandArgumentRule { ReasonedRuleViolation( position: $0.position, reason: "Multiple different shorthand arguments should be avoided", - severity: configuration.severity + severity: configuration.violationSeverity ) }) // In this case, the rule triggers on all shorthand arguments, thus exit here. @@ -93,7 +93,7 @@ private extension ShorthandArgumentRule { ReasonedRuleViolation( position: $0.position, reason: "Accessing members of shorthand arguments should be avoided", - severity: configuration.severity + severity: configuration.violationSeverity ) }) } @@ -112,7 +112,7 @@ private extension ShorthandArgumentRule { References to shorthand arguments too far away from the closure's beginning should \ be avoided """, - severity: configuration.severity + severity: configuration.violationSeverity ) } }) diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/SingleTestClassRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/SingleTestClassRule.swift index 906b91e92c..56a0afd630 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/SingleTestClassRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/SingleTestClassRule.swift @@ -57,7 +57,7 @@ struct SingleTestClassRule: SourceKitFreeRule, OptInRule { return classes.map { position in return StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, position: position.position), reason: "\(classes.count) test classes found in this file") } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/SortedImportsRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/SortedImportsRule.swift index 22cfd90478..56f286b924 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/SortedImportsRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/SortedImportsRule.swift @@ -70,7 +70,7 @@ struct SortedImportsRule: CorrectableRule, OptInRule { return violatingOffsets(inGroups: groups).map { index -> StyleViolation in let location = Location(file: file, characterOffset: index) return StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: location) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/StatementPositionRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/StatementPositionRule.swift index 960e81365a..af9b85f02c 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/StatementPositionRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/StatementPositionRule.swift @@ -89,7 +89,7 @@ private extension StatementPositionRule { func defaultValidate(file: SwiftLintFile) -> [StyleViolation] { return defaultViolationRanges(in: file, matching: Self.defaultPattern).compactMap { range in StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: range.location)) } } @@ -124,7 +124,7 @@ private extension StatementPositionRule { func uncuddledValidate(file: SwiftLintFile) -> [StyleViolation] { return uncuddledViolationRanges(in: file).compactMap { range in StyleViolation(ruleDescription: Self.uncuddledDescription, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: range.location)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/TrailingNewlineRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/TrailingNewlineRule.swift index 174a02282a..bfc56d2aee 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/TrailingNewlineRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/TrailingNewlineRule.swift @@ -45,7 +45,7 @@ struct TrailingNewlineRule: CorrectableRule, SourceKitFreeRule { return [] } return [StyleViolation(ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file.path, line: max(file.lines.count, 1)))] } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/TrailingWhitespaceRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/TrailingWhitespaceRule.swift index 8e52a821b4..8b018c5f14 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/TrailingWhitespaceRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/TrailingWhitespaceRule.swift @@ -40,7 +40,7 @@ struct TrailingWhitespaceRule: CorrectableRule { return filteredLines.map { StyleViolation(ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file.path, line: $0.index)) } } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/TypeContentsOrderRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/TypeContentsOrderRule.swift index 57f4082adf..c42f119015 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/TypeContentsOrderRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/TypeContentsOrderRule.swift @@ -56,7 +56,7 @@ struct TypeContentsOrderRule: OptInRule { let styleViolation = StyleViolation( ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, byteOffset: typeContentOffset.offset), reason: "\(article) '\(content)' should not be placed amongst the type content(s) '\(expected)'" ) diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceBetweenCasesRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceBetweenCasesRule.swift index 5f9a026b75..e1f82bc708 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceBetweenCasesRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceBetweenCasesRule.swift @@ -159,7 +159,7 @@ extension VerticalWhitespaceBetweenCasesRule: OptInRule { return StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: characterOffset) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceClosingBracesRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceClosingBracesRule.swift index 2dda75ade3..6fb0bbd0a3 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceClosingBracesRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceClosingBracesRule.swift @@ -31,7 +31,7 @@ struct VerticalWhitespaceClosingBracesRule: CorrectableRule, OptInRule { return StyleViolation( ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file, characterOffset: characterOffset) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceOpeningBracesRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceOpeningBracesRule.swift index 1df1c9ddd4..46eb3561c4 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceOpeningBracesRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceOpeningBracesRule.swift @@ -165,7 +165,7 @@ extension VerticalWhitespaceOpeningBracesRule: OptInRule { return StyleViolation( ruleDescription: Self.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: characterOffset) ) } diff --git a/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceRule.swift b/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceRule.swift index 70751ab2a9..ff1753ba39 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Style/VerticalWhitespaceRule.swift @@ -45,7 +45,7 @@ struct VerticalWhitespaceRule: CorrectableRule { return linesSections.map { eachLastLine, eachSectionCount in return StyleViolation( ruleDescription: Self.description, - severity: configuration.severityConfiguration.severity, + severity: configuration.severity.violationSeverity, location: Location(file: file.path, line: eachLastLine.index), reason: configuredDescriptionReason + "; currently \(eachSectionCount + 1)" ) diff --git a/Source/SwiftLintCore/Models/Linter.swift b/Source/SwiftLintCore/Models/Linter.swift index 5fee18ad6c..0899899cfa 100644 --- a/Source/SwiftLintCore/Models/Linter.swift +++ b/Source/SwiftLintCore/Models/Linter.swift @@ -48,7 +48,7 @@ private extension Rule { return StyleViolation( ruleDescription: type(of: superfluousDisableCommandRule).description, - severity: superfluousDisableCommandRule.configuration.severity, + severity: superfluousDisableCommandRule.configuration.violationSeverity, location: region.start, reason: superfluousDisableCommandRule.reason(for: self) ) @@ -350,7 +350,7 @@ public struct CollectedLinter { }).map { id in return StyleViolation( ruleDescription: type(of: superfluousDisableCommandRule).description, - severity: superfluousDisableCommandRule.configuration.severity, + severity: superfluousDisableCommandRule.configuration.violationSeverity, location: region.start, reason: superfluousDisableCommandRule.reason(forNonExistentRule: id.stringRepresentation) ) diff --git a/Source/SwiftLintCore/Models/SeverityConfiguration.swift b/Source/SwiftLintCore/Models/SeverityConfiguration.swift index 3dfea575c9..869892d692 100644 --- a/Source/SwiftLintCore/Models/SeverityConfiguration.swift +++ b/Source/SwiftLintCore/Models/SeverityConfiguration.swift @@ -6,25 +6,25 @@ public struct SeverityConfiguration: SeverityBasedRuleConfiguratio public static var warning: Self { Self(.warning) } @ConfigurationElement(key: "severity") - var severity = ViolationSeverity.warning + private (set) var violationSeverity = ViolationSeverity.warning - public var severityConfiguration: SeverityConfiguration { + public var severity: SeverityConfiguration { self } /// Create a `SeverityConfiguration` with the specified severity. /// /// - parameter severity: The severity that should be used when emitting violations. - public init(_ severity: ViolationSeverity) { - self.severity = severity + public init(_ violationSeverity: ViolationSeverity) { + self.violationSeverity = violationSeverity } public mutating func apply(configuration: Any) throws { let configString = configuration as? String let configDict = configuration as? [String: Any] - if let severityString: String = configString ?? configDict?[$severity.key] as? String { - if let severity = ViolationSeverity(rawValue: severityString.lowercased()) { - self.severity = severity + if let severityString: String = configString ?? configDict?[$violationSeverity.key] as? String { + if let violationSeverity = ViolationSeverity(rawValue: severityString.lowercased()) { + self.violationSeverity = violationSeverity } else { throw Issue.invalidConfiguration(ruleID: Parent.identifier) } diff --git a/Source/SwiftLintCore/Protocols/RuleConfiguration.swift b/Source/SwiftLintCore/Protocols/RuleConfiguration.swift index acdd2b6359..19be82da3e 100644 --- a/Source/SwiftLintCore/Protocols/RuleConfiguration.swift +++ b/Source/SwiftLintCore/Protocols/RuleConfiguration.swift @@ -18,13 +18,13 @@ public protocol RuleConfiguration: Equatable { /// A configuration for a rule that allows to configure at least the severity. public protocol SeverityBasedRuleConfiguration: RuleConfiguration { /// The configuration of a rule's severity. - var severityConfiguration: SeverityConfiguration { get } + var severity: SeverityConfiguration { get } } public extension SeverityBasedRuleConfiguration { /// The severity of a rule. - var severity: ViolationSeverity { - severityConfiguration.severity + var violationSeverity: ViolationSeverity { + severity.violationSeverity } } diff --git a/Source/SwiftLintCore/Protocols/SwiftSyntaxRule.swift b/Source/SwiftLintCore/Protocols/SwiftSyntaxRule.swift index 1a47105905..35939e1a65 100644 --- a/Source/SwiftLintCore/Protocols/SwiftSyntaxRule.swift +++ b/Source/SwiftLintCore/Protocols/SwiftSyntaxRule.swift @@ -32,7 +32,7 @@ public extension SwiftSyntaxRule where ConfigurationType: SeverityBasedRuleConfi func makeViolation(file: SwiftLintFile, violation: ReasonedRuleViolation) -> StyleViolation { StyleViolation( ruleDescription: Self.description, - severity: violation.severity ?? configuration.severity, + severity: violation.severity ?? configuration.violationSeverity, location: Location(file: file, position: violation.position), reason: violation.reason ) diff --git a/Source/SwiftLintCore/RuleConfigurations/RegexConfiguration.swift b/Source/SwiftLintCore/RuleConfigurations/RegexConfiguration.swift index 8a4f354629..27bedaf1b3 100644 --- a/Source/SwiftLintCore/RuleConfigurations/RegexConfiguration.swift +++ b/Source/SwiftLintCore/RuleConfigurations/RegexConfiguration.swift @@ -21,7 +21,7 @@ public struct RegexConfiguration: SeverityBasedRuleConfiguration, /// be ignored and not count as a rule violation. public var excludedMatchKinds = Set() @ConfigurationElement(key: "severity") - public var severityConfiguration = SeverityConfiguration(.warning) + public var severity = SeverityConfiguration(.warning) /// The index of the regex capture group to match. public var captureGroup: Int = 0 @@ -35,7 +35,7 @@ public struct RegexConfiguration: SeverityBasedRuleConfiguration, excluded.map(\.pattern).joined(separator: ","), SyntaxKind.allKinds.subtracting(excludedMatchKinds) .map({ $0.rawValue }).sorted(by: <).joined(separator: ","), - severity.rawValue + violationSeverity.rawValue ] if let jsonData = try? JSONSerialization.data(withJSONObject: jsonObject) { return String(decoding: jsonData, as: UTF8.self) @@ -86,8 +86,8 @@ public struct RegexConfiguration: SeverityBasedRuleConfiguration, if let message = configurationDict["message"] as? String { self.message = message } - if let severityString = configurationDict[$severityConfiguration.key] as? String { - try severityConfiguration.apply(configuration: severityString) + if let severityString = configurationDict[$severity.key] as? String { + try severity.apply(configuration: severityString) } if let captureGroup = configurationDict["capture_group"] as? Int { guard (0 ... regex.numberOfCaptureGroups).contains(captureGroup) else { diff --git a/Source/SwiftLintCore/Rules/CustomRules.swift b/Source/SwiftLintCore/Rules/CustomRules.swift index 8eca8e70b8..8dc55d6bcd 100644 --- a/Source/SwiftLintCore/Rules/CustomRules.swift +++ b/Source/SwiftLintCore/Rules/CustomRules.swift @@ -76,7 +76,7 @@ struct CustomRules: Rule, CacheDescriptionProvider { let excludingKinds = configuration.excludedMatchKinds return file.match(pattern: pattern, excludingSyntaxKinds: excludingKinds, captureGroup: captureGroup).map({ StyleViolation(ruleDescription: configuration.description, - severity: configuration.severity, + severity: configuration.violationSeverity, location: Location(file: file, characterOffset: $0.location), reason: configuration.message) }).filter { violation in diff --git a/Source/SwiftLintCoreMacros/RuleConfigurationMacros.swift b/Source/SwiftLintCoreMacros/RuleConfigurationMacros.swift index 029d449f0b..efb4b69bcf 100644 --- a/Source/SwiftLintCoreMacros/RuleConfigurationMacros.swift +++ b/Source/SwiftLintCoreMacros/RuleConfigurationMacros.swift @@ -41,8 +41,8 @@ enum AutoApply: MemberMacro { $0.type.as(IdentifierTypeSyntax.self)?.name.text == "SeverityBasedRuleConfiguration" } if isSeverityBased == true { - if nonInlinedOptions.contains("severityConfiguration") { - inlinedOptions.append("severityConfiguration") + if nonInlinedOptions.contains("severity") { + inlinedOptions.append("severity") } else { context.diagnose(SwiftLintCoreMacroError.severityBasedWithoutProperty.diagnose(at: configuration.name)) } diff --git a/Source/SwiftLintCoreMacros/SwiftLintCoreMacros.swift b/Source/SwiftLintCoreMacros/SwiftLintCoreMacros.swift index 90e85cd26d..52a959dac0 100644 --- a/Source/SwiftLintCoreMacros/SwiftLintCoreMacros.swift +++ b/Source/SwiftLintCoreMacros/SwiftLintCoreMacros.swift @@ -14,9 +14,7 @@ struct SwiftLintCoreMacros: CompilerPlugin { enum SwiftLintCoreMacroError: String, DiagnosticMessage { case notStruct = "Attribute can only be applied to structs" - case severityBasedWithoutProperty = """ - Severity-based configuration without a 'severityConfiguration' property is invalid - """ + case severityBasedWithoutProperty = "Severity-based configuration without a 'severity' property is invalid" case notEnum = "Attribute can only be applied to enums" case noStringRawType = "Attribute can only be applied to enums with a 'String' raw type" case noBooleanLiteral = "Macro argument must be a boolean literal" diff --git a/Tests/MacroTests/AutoApplyTests.swift b/Tests/MacroTests/AutoApplyTests.swift index 45b132e668..087260828e 100644 --- a/Tests/MacroTests/AutoApplyTests.swift +++ b/Tests/MacroTests/AutoApplyTests.swift @@ -182,13 +182,12 @@ final class AutoApplyTests: XCTestCase { } func testSeverityAppliedTwice() { - // swiftlint:disable line_length assertMacroExpansion( """ @AutoApply struct S: SeverityBasedRuleConfiguration { @ConfigurationElement - var severityConfiguration = .warning + var severity = .warning @ConfigurationElement var foo = 2 } @@ -197,28 +196,28 @@ final class AutoApplyTests: XCTestCase { """ struct S: SeverityBasedRuleConfiguration { @ConfigurationElement - var severityConfiguration = .warning + var severity = .warning @ConfigurationElement var foo = 2 mutating func apply(configuration: Any) throws { - if $severityConfiguration.key.isEmpty { - $severityConfiguration.key = "severity_configuration" + if $severity.key.isEmpty { + $severity.key = "severity" } if $foo.key.isEmpty { $foo.key = "foo" } do { - try severityConfiguration.apply(configuration, ruleID: Parent.identifier) - try $severityConfiguration.performAfterParseOperations() + try severity.apply(configuration, ruleID: Parent.identifier) + try $severity.performAfterParseOperations() } catch let issue as Issue where issue == Issue.nothingApplied(ruleID: Parent.identifier) { // Acceptable. Continue. } guard let configuration = configuration as? [String: Any] else { return } - try severityConfiguration.apply(configuration[$severityConfiguration.key], ruleID: Parent.identifier) - try $severityConfiguration.performAfterParseOperations() + try severity.apply(configuration[$severity.key], ruleID: Parent.identifier) + try $severity.performAfterParseOperations() try foo.apply(configuration[$foo.key], ruleID: Parent.identifier) try $foo.performAfterParseOperations() if !supportedKeys.isSuperset(of: configuration.keys) { @@ -230,6 +229,5 @@ final class AutoApplyTests: XCTestCase { """, macros: macros ) - // swiftlint:enable line_length } } diff --git a/Tests/SwiftLintFrameworkTests/ConfigurationTests+MultipleConfigs.swift b/Tests/SwiftLintFrameworkTests/ConfigurationTests+MultipleConfigs.swift index d0220008a3..5240755f44 100644 --- a/Tests/SwiftLintFrameworkTests/ConfigurationTests+MultipleConfigs.swift +++ b/Tests/SwiftLintFrameworkTests/ConfigurationTests+MultipleConfigs.swift @@ -170,7 +170,7 @@ extension ConfigurationTests { XCTFail("Custom rule is expected to be present") return } - XCTAssertEqual(customRule.severityConfiguration.severity, .error) + XCTAssertEqual(customRule.severity.severity, .error) } // MARK: - Nested Configurations diff --git a/Tests/SwiftLintFrameworkTests/CustomRulesTests.swift b/Tests/SwiftLintFrameworkTests/CustomRulesTests.swift index 169310247b..ff9d9cf8f9 100644 --- a/Tests/SwiftLintFrameworkTests/CustomRulesTests.swift +++ b/Tests/SwiftLintFrameworkTests/CustomRulesTests.swift @@ -18,7 +18,7 @@ class CustomRulesTests: SwiftLintTestCase { comp.name = "MyCustomRule" comp.message = "Message" comp.regex = "regex" - comp.severityConfiguration = SeverityConfiguration(.error) + comp.severity = SeverityConfiguration(.error) comp.excludedMatchKinds = SyntaxKind.allKinds.subtracting([.comment]) var compRules = CustomRulesConfiguration() compRules.customRuleConfigurations = [comp] @@ -45,7 +45,7 @@ class CustomRulesTests: SwiftLintTestCase { comp.name = "MyCustomRule" comp.message = "Message" comp.regex = "regex" - comp.severityConfiguration = SeverityConfiguration(.error) + comp.severity = SeverityConfiguration(.error) comp.excludedMatchKinds = Set([.comment]) var compRules = CustomRulesConfiguration() compRules.customRuleConfigurations = [comp] diff --git a/Tests/SwiftLintFrameworkTests/DeploymentTargetConfigurationTests.swift b/Tests/SwiftLintFrameworkTests/DeploymentTargetConfigurationTests.swift index d3619248b0..0cf304a60b 100644 --- a/Tests/SwiftLintFrameworkTests/DeploymentTargetConfigurationTests.swift +++ b/Tests/SwiftLintFrameworkTests/DeploymentTargetConfigurationTests.swift @@ -17,7 +17,7 @@ class DeploymentTargetConfigurationTests: SwiftLintTestCase { configuration.iOSAppExtensionDeploymentTarget, Version(platform: .iOSApplicationExtension, major: 10, minor: 1) ) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.severity.violationSeverity, .error) try configuration.apply(configuration: ["iOSApplicationExtension_deployment_target": "13.0"]) XCTAssertEqual( @@ -28,7 +28,7 @@ class DeploymentTargetConfigurationTests: SwiftLintTestCase { configuration.iOSAppExtensionDeploymentTarget, Version(platform: .iOSApplicationExtension, major: 13, minor: 0) ) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.severity.violationSeverity, .error) try configuration.apply(configuration: ["macOS_deployment_target": "10.11.3"]) XCTAssertEqual( @@ -47,7 +47,7 @@ class DeploymentTargetConfigurationTests: SwiftLintTestCase { configuration.macOSAppExtensionDeploymentTarget, Version(platform: .macOSApplicationExtension, major: 10, minor: 11, patch: 3) ) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.severity.violationSeverity, .error) try configuration.apply(configuration: ["macOSApplicationExtension_deployment_target": "12.4"]) XCTAssertEqual( @@ -66,7 +66,7 @@ class DeploymentTargetConfigurationTests: SwiftLintTestCase { configuration.macOSAppExtensionDeploymentTarget, Version(platform: .macOSApplicationExtension, major: 12, minor: 4) ) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.severity.violationSeverity, .error) try configuration.apply(configuration: ["severity": "warning"]) XCTAssertEqual( @@ -85,7 +85,7 @@ class DeploymentTargetConfigurationTests: SwiftLintTestCase { configuration.macOSAppExtensionDeploymentTarget, Version(platform: .macOSApplicationExtension, major: 12, minor: 4) ) - XCTAssertEqual(configuration.severityConfiguration.severity, .warning) + XCTAssertEqual(configuration.severity.violationSeverity, .warning) try configuration.apply(configuration: ["tvOS_deployment_target": 10.2, "tvOSApplicationExtension_deployment_target": 9.1, @@ -123,7 +123,7 @@ class DeploymentTargetConfigurationTests: SwiftLintTestCase { configuration.watchOSAppExtensionDeploymentTarget, Version(platform: .watchOSApplicationExtension, major: 2, minor: 2) ) - XCTAssertEqual(configuration.severityConfiguration.severity, .warning) + XCTAssertEqual(configuration.severity.violationSeverity, .warning) } func testThrowsOnBadConfig() { diff --git a/Tests/SwiftLintFrameworkTests/ExpiringTodoRuleTests.swift b/Tests/SwiftLintFrameworkTests/ExpiringTodoRuleTests.swift index cbc059c260..430d1f83de 100644 --- a/Tests/SwiftLintFrameworkTests/ExpiringTodoRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/ExpiringTodoRuleTests.swift @@ -178,9 +178,9 @@ class ExpiringTodoRuleTests: SwiftLintTestCase { if let config = ruleConfiguration { serializedConfig = [ - "expired_severity": config.expiredSeverity.severity.rawValue, - "approaching_expiry_severity": config.approachingExpirySeverity.severity.rawValue, - "bad_formatting_severity": config.badFormattingSeverity.severity.rawValue, + "expired_severity": config.expiredSeverity.violationSeverity.rawValue, + "approaching_expiry_severity": config.approachingExpirySeverity.violationSeverity.rawValue, + "bad_formatting_severity": config.badFormattingSeverity.violationSeverity.rawValue, "approaching_expiry_threshold": config.approachingExpiryThreshold, "date_format": config.dateFormat, "date_delimiters": [ diff --git a/Tests/SwiftLintFrameworkTests/ExplicitTypeInterfaceConfigurationTests.swift b/Tests/SwiftLintFrameworkTests/ExplicitTypeInterfaceConfigurationTests.swift index 5affea03a3..75ec3e5545 100644 --- a/Tests/SwiftLintFrameworkTests/ExplicitTypeInterfaceConfigurationTests.swift +++ b/Tests/SwiftLintFrameworkTests/ExplicitTypeInterfaceConfigurationTests.swift @@ -5,7 +5,7 @@ import XCTest class ExplicitTypeInterfaceConfigurationTests: SwiftLintTestCase { func testDefaultConfiguration() { let config = ExplicitTypeInterfaceConfiguration() - XCTAssertEqual(config.severityConfiguration.severity, .warning) + XCTAssertEqual(config.severity.severity, .warning) XCTAssertEqual(config.allowedKinds, Set([.instance, .class, .static, .local])) } @@ -14,7 +14,7 @@ class ExplicitTypeInterfaceConfigurationTests: SwiftLintTestCase { try config.apply(configuration: ["severity": "error", "excluded": ["local"], "allow_redundancy": true] as [String: any Sendable]) - XCTAssertEqual(config.severityConfiguration.severity, .error) + XCTAssertEqual(config.severity.severity, .error) XCTAssertEqual(config.allowedKinds, Set([.instance, .class, .static])) XCTAssertTrue(config.allowRedundancy) } diff --git a/Tests/SwiftLintFrameworkTests/ImplicitReturnConfigurationTests.swift b/Tests/SwiftLintFrameworkTests/ImplicitReturnConfigurationTests.swift index cf72c7363d..1825ea3dbe 100644 --- a/Tests/SwiftLintFrameworkTests/ImplicitReturnConfigurationTests.swift +++ b/Tests/SwiftLintFrameworkTests/ImplicitReturnConfigurationTests.swift @@ -23,7 +23,7 @@ class ImplicitReturnConfigurationTests: SwiftLintTestCase { .initializer, .subscript ]) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.severity.violationSeverity, .error) XCTAssertEqual(configuration.includedKinds, expectedKinds) } diff --git a/Tests/SwiftLintFrameworkTests/ImplicitlyUnwrappedOptionalConfigurationTests.swift b/Tests/SwiftLintFrameworkTests/ImplicitlyUnwrappedOptionalConfigurationTests.swift index 1ce962efcb..927ec2276b 100644 --- a/Tests/SwiftLintFrameworkTests/ImplicitlyUnwrappedOptionalConfigurationTests.swift +++ b/Tests/SwiftLintFrameworkTests/ImplicitlyUnwrappedOptionalConfigurationTests.swift @@ -5,25 +5,25 @@ import XCTest class ImplicitlyUnwrappedOptionalConfigurationTests: SwiftLintTestCase { func testImplicitlyUnwrappedOptionalConfigurationProperlyAppliesConfigurationFromDictionary() throws { var configuration = ImplicitlyUnwrappedOptionalConfiguration( - severityConfiguration: SeverityConfiguration(.warning), + severity: .warning, mode: .allExceptIBOutlets ) try configuration.apply(configuration: ["mode": "all", "severity": "error"]) XCTAssertEqual(configuration.mode, .all) - XCTAssertEqual(configuration.severity, .error) + XCTAssertEqual(configuration.violationSeverity, .error) try configuration.apply(configuration: ["mode": "all_except_iboutlets"]) XCTAssertEqual(configuration.mode, .allExceptIBOutlets) - XCTAssertEqual(configuration.severity, .error) + XCTAssertEqual(configuration.violationSeverity, .error) try configuration.apply(configuration: ["severity": "warning"]) XCTAssertEqual(configuration.mode, .allExceptIBOutlets) - XCTAssertEqual(configuration.severity, .warning) + XCTAssertEqual(configuration.violationSeverity, .warning) try configuration.apply(configuration: ["mode": "all", "severity": "warning"]) XCTAssertEqual(configuration.mode, .all) - XCTAssertEqual(configuration.severity, .warning) + XCTAssertEqual(configuration.violationSeverity, .warning) } func testImplicitlyUnwrappedOptionalConfigurationThrowsOnBadConfig() { @@ -35,7 +35,7 @@ class ImplicitlyUnwrappedOptionalConfigurationTests: SwiftLintTestCase { for badConfig in badConfigs { var configuration = ImplicitlyUnwrappedOptionalConfiguration( - severityConfiguration: SeverityConfiguration(.warning), + severity: .warning, mode: .allExceptIBOutlets ) diff --git a/Tests/SwiftLintFrameworkTests/ImplicitlyUnwrappedOptionalRuleTests.swift b/Tests/SwiftLintFrameworkTests/ImplicitlyUnwrappedOptionalRuleTests.swift index b9245c2035..85f3d180e4 100644 --- a/Tests/SwiftLintFrameworkTests/ImplicitlyUnwrappedOptionalRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/ImplicitlyUnwrappedOptionalRuleTests.swift @@ -5,7 +5,7 @@ class ImplicitlyUnwrappedOptionalRuleTests: SwiftLintTestCase { func testImplicitlyUnwrappedOptionalRuleDefaultConfiguration() { let rule = ImplicitlyUnwrappedOptionalRule() XCTAssertEqual(rule.configuration.mode, .allExceptIBOutlets) - XCTAssertEqual(rule.configuration.severity, .warning) + XCTAssertEqual(rule.configuration.violationSeverity, .warning) } func testImplicitlyUnwrappedOptionalRuleWarnsOnOutletsInAllMode() { diff --git a/Tests/SwiftLintFrameworkTests/RuleConfigurationTests.swift b/Tests/SwiftLintFrameworkTests/RuleConfigurationTests.swift index 29996cc2f3..6ecd472146 100644 --- a/Tests/SwiftLintFrameworkTests/RuleConfigurationTests.swift +++ b/Tests/SwiftLintFrameworkTests/RuleConfigurationTests.swift @@ -216,14 +216,14 @@ class RuleConfigurationTests: SwiftLintTestCase { func testTrailingWhitespaceConfigurationApplyConfigurationUpdatesSeverityConfiguration() { var configuration = TrailingWhitespaceConfiguration( - severityConfiguration: .warning, + severity: .warning, ignoresEmptyLines: false, ignoresComments: true ) do { try configuration.apply(configuration: ["severity": "error"]) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.violationSeverity, .error) } catch { XCTFail("Failed to apply severity") } @@ -236,7 +236,7 @@ class RuleConfigurationTests: SwiftLintTestCase { let conf1 = ["severity": "error", "excluded": "viewWillAppear(_:)"] do { try configuration.apply(configuration: conf1) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.severity.severity, .error) XCTAssertFalse(configuration.resolvedMethodNames.contains("*")) XCTAssertFalse(configuration.resolvedMethodNames.contains("viewWillAppear(_:)")) XCTAssertTrue(configuration.resolvedMethodNames.contains("viewWillDisappear(_:)")) @@ -251,7 +251,7 @@ class RuleConfigurationTests: SwiftLintTestCase { ] as [String: any Sendable] do { try configuration.apply(configuration: conf2) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.severity.severity, .error) XCTAssertFalse(configuration.resolvedMethodNames.contains("*")) XCTAssertFalse(configuration.resolvedMethodNames.contains("viewWillAppear(_:)")) XCTAssertTrue(configuration.resolvedMethodNames.contains("viewWillDisappear(_:)")) @@ -268,7 +268,7 @@ class RuleConfigurationTests: SwiftLintTestCase { ] as [String: any Sendable] do { try configuration.apply(configuration: conf3) - XCTAssertEqual(configuration.severityConfiguration.severity, .warning) + XCTAssertEqual(configuration.severity.severity, .warning) XCTAssertEqual(configuration.resolvedMethodNames.count, 2) XCTAssertFalse(configuration.resolvedMethodNames.contains("*")) XCTAssertTrue(configuration.resolvedMethodNames.contains("testMethod1()")) @@ -311,7 +311,7 @@ class RuleConfigurationTests: SwiftLintTestCase { .lazy, .dynamic ] - XCTAssertEqual(configuration.severityConfiguration.severity, .warning) + XCTAssertEqual(configuration.severity.severity, .warning) XCTAssertEqual(configuration.preferredModifierOrder, expected) } @@ -337,7 +337,7 @@ class RuleConfigurationTests: SwiftLintTestCase { let config = ["severity": "error", "order": "set_get"] try configuration.apply(configuration: config) - XCTAssertEqual(configuration.severityConfiguration.severity, .error) + XCTAssertEqual(configuration.severity.severity, .error) XCTAssertEqual(configuration.order, .setGet) XCTAssertEqual( diff --git a/Tests/SwiftLintFrameworkTests/TrailingClosureConfigurationTests.swift b/Tests/SwiftLintFrameworkTests/TrailingClosureConfigurationTests.swift index 5614353b7b..fe1148aad6 100644 --- a/Tests/SwiftLintFrameworkTests/TrailingClosureConfigurationTests.swift +++ b/Tests/SwiftLintFrameworkTests/TrailingClosureConfigurationTests.swift @@ -4,7 +4,7 @@ import XCTest class TrailingClosureConfigurationTests: SwiftLintTestCase { func testDefaultConfiguration() { let config = TrailingClosureConfiguration() - XCTAssertEqual(config.severityConfiguration.severity, .warning) + XCTAssertEqual(config.severity.violationSeverity, .warning) XCTAssertFalse(config.onlySingleMutedParameter) } @@ -12,7 +12,7 @@ class TrailingClosureConfigurationTests: SwiftLintTestCase { var config = TrailingClosureConfiguration() try config.apply(configuration: ["severity": "error", "only_single_muted_parameter": true] as [String: any Sendable]) - XCTAssertEqual(config.severityConfiguration.severity, .error) + XCTAssertEqual(config.severity.violationSeverity, .error) XCTAssertTrue(config.onlySingleMutedParameter) } } diff --git a/Tests/SwiftLintFrameworkTests/UnusedDeclarationConfigurationTests.swift b/Tests/SwiftLintFrameworkTests/UnusedDeclarationConfigurationTests.swift index f677fbe9bf..8f26d5e6f8 100644 --- a/Tests/SwiftLintFrameworkTests/UnusedDeclarationConfigurationTests.swift +++ b/Tests/SwiftLintFrameworkTests/UnusedDeclarationConfigurationTests.swift @@ -12,7 +12,7 @@ class UnusedDeclarationConfigurationTests: XCTestCase { try testee.apply(configuration: config) - XCTAssertEqual(testee.severityConfiguration.severity, .warning) + XCTAssertEqual(testee.severity.violationSeverity, .warning) XCTAssertTrue(testee.includePublicAndOpen) XCTAssertEqual(testee.relatedUSRsToSkip, ["a", "b", "s:7SwiftUI15PreviewProviderP"]) }