diff --git a/.swp b/.swp new file mode 100644 index 000000000..e52f4ba25 Binary files /dev/null and b/.swp differ diff --git a/Source/SwiftLintFramework/Models/ImportUsage.swift b/Source/SwiftLintFramework/Models/ImportUsage.swift index 1176542c0..496a44ada 100644 --- a/Source/SwiftLintFramework/Models/ImportUsage.swift +++ b/Source/SwiftLintFramework/Models/ImportUsage.swift @@ -23,7 +23,7 @@ enum ImportUsage { case .unused: return nil case .missing(let module): - return "Missing import for referenced module '\(module)'." + return "Missing import for referenced module '\(module)'" } } } diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/BlockBasedKVORule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/BlockBasedKVORule.swift index 30c3ee604..b4ad6b77a 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/BlockBasedKVORule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/BlockBasedKVORule.swift @@ -8,7 +8,7 @@ struct BlockBasedKVORule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "block_based_kvo", name: "Block Based KVO", - description: "Prefer the new block based KVO API with keypaths when using Swift 3.2 or later.", + description: "Prefer the new block based KVO API with keypaths when using Swift 3.2 or later", kind: .idiomatic, nonTriggeringExamples: [ Example(#""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ConvenienceTypeRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ConvenienceTypeRule.swift index 7f9a4e60c..8726f2aa8 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ConvenienceTypeRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ConvenienceTypeRule.swift @@ -9,7 +9,7 @@ struct ConvenienceTypeRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRul identifier: "convenience_type", name: "Convenience Type", description: "Types used for hosting only static members should be implemented as a caseless enum " + - "to avoid instantiation.", + "to avoid instantiation", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedNoneNameRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedNoneNameRule.swift index 73ec00439..a9935bd2c 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedNoneNameRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedNoneNameRule.swift @@ -224,9 +224,9 @@ private extension DiscouragedNoneNameRule { } private func reason(type: String) -> String { - let reason = "Avoid naming \(type) `none` as the compiler can think you mean `Optional.none`." - let recommendation = "Consider using an Optional value instead." - return "\(reason) \(recommendation)" + let reason = "Avoid naming \(type) `none` as the compiler can think you mean `Optional.none`" + let recommendation = "consider using an Optional value instead" + return "\(reason); \(recommendation)" } } } diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedObjectLiteralRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedObjectLiteralRule.swift index d099f3991..f75f81f19 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedObjectLiteralRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedObjectLiteralRule.swift @@ -8,7 +8,7 @@ struct DiscouragedObjectLiteralRule: SwiftSyntaxRule, OptInRule, ConfigurationPr static let description = RuleDescription( identifier: "discouraged_object_literal", name: "Discouraged Object Literal", - description: "Prefer initializers over object literals.", + description: "Prefer initializers over object literals", kind: .idiomatic, nonTriggeringExamples: [ Example("let image = UIImage(named: aVariable)"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedOptionalBooleanRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedOptionalBooleanRule.swift index d2cef7c9b..46a437ee0 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedOptionalBooleanRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedOptionalBooleanRule.swift @@ -8,7 +8,7 @@ struct DiscouragedOptionalBooleanRule: OptInRule, ConfigurationProviderRule, Swi static let description = RuleDescription( identifier: "discouraged_optional_boolean", name: "Discouraged Optional Boolean", - description: "Prefer non-optional booleans over optional booleans.", + description: "Prefer non-optional booleans over optional booleans", kind: .idiomatic, nonTriggeringExamples: DiscouragedOptionalBooleanRuleExamples.nonTriggeringExamples, triggeringExamples: DiscouragedOptionalBooleanRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedOptionalCollectionRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedOptionalCollectionRule.swift index e89760a28..1e6e92f66 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedOptionalCollectionRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/DiscouragedOptionalCollectionRule.swift @@ -8,7 +8,7 @@ struct DiscouragedOptionalCollectionRule: ASTRule, OptInRule, ConfigurationProvi static let description = RuleDescription( identifier: "discouraged_optional_collection", name: "Discouraged Optional Collection", - description: "Prefer empty collection over optional collection.", + description: "Prefer empty collection over optional collection", kind: .idiomatic, nonTriggeringExamples: DiscouragedOptionalCollectionExamples.nonTriggeringExamples, triggeringExamples: DiscouragedOptionalCollectionExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/DuplicateImportsRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/DuplicateImportsRule.swift index daaa123b3..220265db4 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/DuplicateImportsRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/DuplicateImportsRule.swift @@ -16,7 +16,7 @@ struct DuplicateImportsRule: ConfigurationProviderRule, CorrectableRule { static let description = RuleDescription( identifier: "duplicate_imports", name: "Duplicate Imports", - description: "Imports should be unique.", + description: "Imports should be unique", kind: .idiomatic, nonTriggeringExamples: DuplicateImportsRuleExamples.nonTriggeringExamples, triggeringExamples: DuplicateImportsRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitACLRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitACLRule.swift index 3753e0461..3682db294 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitACLRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitACLRule.swift @@ -11,7 +11,7 @@ struct ExplicitACLRule: OptInRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "explicit_acl", name: "Explicit ACL", - description: "All declarations should specify Access Control Level keywords explicitly.", + description: "All declarations should specify Access Control Level keywords explicitly", kind: .idiomatic, nonTriggeringExamples: [ Example("internal enum A {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitEnumRawValueRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitEnumRawValueRule.swift index 1b3ba29a1..dc965565c 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitEnumRawValueRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitEnumRawValueRule.swift @@ -8,7 +8,7 @@ struct ExplicitEnumRawValueRule: SwiftSyntaxRule, OptInRule, ConfigurationProvid static let description = RuleDescription( identifier: "explicit_enum_raw_value", name: "Explicit Enum Raw Value", - description: "Enums should be explicitly assigned their raw values.", + description: "Enums should be explicitly assigned their raw values", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitInitRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitInitRule.swift index 9040f5791..f57f1c7b6 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitInitRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitInitRule.swift @@ -9,7 +9,7 @@ struct ExplicitInitRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule, static let description = RuleDescription( identifier: "explicit_init", name: "Explicit Init", - description: "Explicitly calling .init() should be avoided.", + description: "Explicitly calling .init() should be avoided", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitTopLevelACLRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitTopLevelACLRule.swift index e002766e6..2a65e7460 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitTopLevelACLRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ExplicitTopLevelACLRule.swift @@ -8,7 +8,7 @@ struct ExplicitTopLevelACLRule: SwiftSyntaxRule, OptInRule, ConfigurationProvide static let description = RuleDescription( identifier: "explicit_top_level_acl", name: "Explicit Top Level ACL", - description: "Top-level declarations should specify Access Control Level keywords explicitly.", + description: "Top-level declarations should specify Access Control Level keywords explicitly", kind: .idiomatic, nonTriggeringExamples: [ Example("internal enum A {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/FallthroughRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/FallthroughRule.swift index 7235fba62..604a9c7e8 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/FallthroughRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/FallthroughRule.swift @@ -8,7 +8,7 @@ struct FallthroughRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInRule { static let description = RuleDescription( identifier: "fallthrough", name: "Fallthrough", - description: "Fallthrough should be avoided.", + description: "Fallthrough should be avoided", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/FatalErrorMessageRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/FatalErrorMessageRule.swift index f3c139053..63b438cb4 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/FatalErrorMessageRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/FatalErrorMessageRule.swift @@ -8,7 +8,7 @@ struct FatalErrorMessageRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInR static let description = RuleDescription( identifier: "fatal_error_message", name: "Fatal Error Message", - description: "A fatalError call should have a message.", + description: "A fatalError call should have a message", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/FileNameNoSpaceRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/FileNameNoSpaceRule.swift index eb099cffe..5a063edac 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/FileNameNoSpaceRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/FileNameNoSpaceRule.swift @@ -12,7 +12,7 @@ struct FileNameNoSpaceRule: ConfigurationProviderRule, OptInRule, SourceKitFreeR static let description = RuleDescription( identifier: "file_name_no_space", name: "File Name no Space", - description: "File name should not contain any whitespace.", + description: "File name should not contain any whitespace", kind: .idiomatic ) diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/FileNameRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/FileNameRule.swift index b288598e0..fda4725eb 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/FileNameRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/FileNameRule.swift @@ -14,7 +14,7 @@ struct FileNameRule: ConfigurationProviderRule, OptInRule, SourceKitFreeRule { static let description = RuleDescription( identifier: "file_name", name: "File Name", - description: "File name should match a type or extension declared in the file (if any).", + description: "File name should match a type or extension declared in the file (if any)", kind: .idiomatic ) diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ForWhereRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ForWhereRule.swift index e53238008..c6a1c8c23 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ForWhereRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ForWhereRule.swift @@ -8,7 +8,7 @@ struct ForWhereRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "for_where", name: "Prefer For-Where", - description: "`where` clauses are preferred over a single `if` inside a `for`.", + description: "`where` clauses are preferred over a single `if` inside a `for`", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ForceCastRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ForceCastRule.swift index 9f231196f..14c840d6a 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ForceCastRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ForceCastRule.swift @@ -8,7 +8,7 @@ struct ForceCastRule: ConfigurationProviderRule, SwiftSyntaxRule { static let description = RuleDescription( identifier: "force_cast", name: "Force Cast", - description: "Force casts should be avoided.", + description: "Force casts should be avoided", kind: .idiomatic, nonTriggeringExamples: [ Example("NSNumber() as? Int\n") diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ForceTryRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ForceTryRule.swift index 33c565a36..8658fb391 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ForceTryRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ForceTryRule.swift @@ -8,7 +8,7 @@ struct ForceTryRule: ConfigurationProviderRule, SwiftSyntaxRule { static let description = RuleDescription( identifier: "force_try", name: "Force Try", - description: "Force tries should be avoided.", + description: "Force tries should be avoided", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ForceUnwrappingRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ForceUnwrappingRule.swift index f807aa356..aa323fcac 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ForceUnwrappingRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ForceUnwrappingRule.swift @@ -8,7 +8,7 @@ struct ForceUnwrappingRule: OptInRule, SwiftSyntaxRule, ConfigurationProviderRul static let description = RuleDescription( identifier: "force_unwrapping", name: "Force Unwrapping", - description: "Force unwrapping should be avoided.", + description: "Force unwrapping should be avoided", kind: .idiomatic, nonTriggeringExamples: [ Example("if let url = NSURL(string: query)"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/FunctionDefaultParameterAtEndRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/FunctionDefaultParameterAtEndRule.swift index d7cae61d3..a59d6c897 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/FunctionDefaultParameterAtEndRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/FunctionDefaultParameterAtEndRule.swift @@ -8,7 +8,7 @@ struct FunctionDefaultParameterAtEndRule: SwiftSyntaxRule, ConfigurationProvider static let description = RuleDescription( identifier: "function_default_parameter_at_end", name: "Function Default Parameter at End", - description: "Prefer to locate parameters with defaults toward the end of the parameter list.", + description: "Prefer to locate parameters with defaults toward the end of the parameter list", kind: .idiomatic, nonTriggeringExamples: [ Example("func foo(baz: String, bar: Int = 0) {}"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ImplicitlyUnwrappedOptionalRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ImplicitlyUnwrappedOptionalRule.swift index 9d4ab5f7b..318299a5f 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ImplicitlyUnwrappedOptionalRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ImplicitlyUnwrappedOptionalRule.swift @@ -11,7 +11,7 @@ struct ImplicitlyUnwrappedOptionalRule: SwiftSyntaxRule, ConfigurationProviderRu static let description = RuleDescription( identifier: "implicitly_unwrapped_optional", name: "Implicitly Unwrapped Optional", - description: "Implicitly unwrapped optionals should be avoided when possible.", + description: "Implicitly unwrapped optionals should be avoided when possible", kind: .idiomatic, nonTriggeringExamples: [ Example("@IBOutlet private var label: UILabel!"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/IsDisjointRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/IsDisjointRule.swift index c223d15a3..624d2871f 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/IsDisjointRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/IsDisjointRule.swift @@ -8,7 +8,7 @@ struct IsDisjointRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "is_disjoint", name: "Is Disjoint", - description: "Prefer using `Set.isDisjoint(with:)` over `Set.intersection(_:).isEmpty`.", + description: "Prefer using `Set.isDisjoint(with:)` over `Set.intersection(_:).isEmpty`", kind: .idiomatic, nonTriggeringExamples: [ Example("_ = Set(syntaxKinds).isDisjoint(with: commentAndStringKindsSet)"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/JoinedDefaultParameterRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/JoinedDefaultParameterRule.swift index 60b5c3771..364be009d 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/JoinedDefaultParameterRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/JoinedDefaultParameterRule.swift @@ -8,7 +8,7 @@ struct JoinedDefaultParameterRule: SwiftSyntaxCorrectableRule, ConfigurationProv static let description = RuleDescription( identifier: "joined_default_parameter", name: "Joined Default Parameter", - description: "Discouraged explicit usage of the default separator.", + description: "Discouraged explicit usage of the default separator", kind: .idiomatic, nonTriggeringExamples: [ Example("let foo = bar.joined()"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/LegacyConstantRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/LegacyConstantRule.swift index cd378cfc5..595bfe930 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/LegacyConstantRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/LegacyConstantRule.swift @@ -9,7 +9,7 @@ struct LegacyConstantRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "legacy_constant", name: "Legacy Constant", - description: "Struct-scoped constants are preferred over legacy global constants.", + description: "Struct-scoped constants are preferred over legacy global constants", kind: .idiomatic, nonTriggeringExamples: LegacyConstantRuleExamples.nonTriggeringExamples, triggeringExamples: LegacyConstantRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/LegacyConstructorRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/LegacyConstructorRule.swift index 776c9b30a..23aa5069e 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/LegacyConstructorRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/LegacyConstructorRule.swift @@ -8,7 +8,7 @@ struct LegacyConstructorRule: SwiftSyntaxCorrectableRule, ConfigurationProviderR static let description = RuleDescription( identifier: "legacy_constructor", name: "Legacy Constructor", - description: "Swift constructors are preferred over legacy convenience functions.", + description: "Swift constructors are preferred over legacy convenience functions", kind: .idiomatic, nonTriggeringExamples: [ Example("CGPoint(x: 10, y: 10)"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/LegacyMultipleRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/LegacyMultipleRule.swift index 0b0514b0f..430c20b19 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/LegacyMultipleRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/LegacyMultipleRule.swift @@ -8,7 +8,7 @@ struct LegacyMultipleRule: OptInRule, ConfigurationProviderRule, SwiftSyntaxRule static let description = RuleDescription( identifier: "legacy_multiple", name: "Legacy Multiple", - description: "Prefer using the `isMultiple(of:)` function instead of using the remainder operator (`%`).", + description: "Prefer using the `isMultiple(of:)` function instead of using the remainder operator (`%`)", kind: .idiomatic, nonTriggeringExamples: [ Example("cell.contentView.backgroundColor = indexPath.row.isMultiple(of: 2) ? .gray : .white"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/LegacyRandomRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/LegacyRandomRule.swift index f3153fa9f..8dd4f712b 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/LegacyRandomRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/LegacyRandomRule.swift @@ -8,7 +8,7 @@ struct LegacyRandomRule: SwiftSyntaxRule, ConfigurationProviderRule { static var description = RuleDescription( identifier: "legacy_random", name: "Legacy Random", - description: "Prefer using `type.random(in:)` over legacy functions.", + description: "Prefer using `type.random(in:)` over legacy functions", kind: .idiomatic, nonTriggeringExamples: [ Example("Int.random(in: 0..<10)\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/NimbleOperatorRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/NimbleOperatorRule.swift index 254c07a05..7e3e4f5f8 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/NimbleOperatorRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/NimbleOperatorRule.swift @@ -9,7 +9,7 @@ struct NimbleOperatorRule: ConfigurationProviderRule, OptInRule, CorrectableRule static let description = RuleDescription( identifier: "nimble_operator", name: "Nimble Operator", - description: "Prefer Nimble operator overloads over free matcher functions.", + description: "Prefer Nimble operator overloads over free matcher functions", kind: .idiomatic, nonTriggeringExamples: [ Example("expect(seagull.squawk) != \"Hi!\"\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/NoFallthroughOnlyRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/NoFallthroughOnlyRule.swift index 537454f9a..6eec13580 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/NoFallthroughOnlyRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/NoFallthroughOnlyRule.swift @@ -8,7 +8,7 @@ struct NoFallthroughOnlyRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "no_fallthrough_only", name: "No Fallthrough only", - description: "Fallthroughs can only be used if the `case` contains at least one other statement.", + description: "Fallthroughs can only be used if the `case` contains at least one other statement", kind: .idiomatic, nonTriggeringExamples: NoFallthroughOnlyRuleExamples.nonTriggeringExamples, triggeringExamples: NoFallthroughOnlyRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/NoGroupingExtensionRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/NoGroupingExtensionRule.swift index e6851b194..2261d91e5 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/NoGroupingExtensionRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/NoGroupingExtensionRule.swift @@ -8,7 +8,7 @@ struct NoGroupingExtensionRule: OptInRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "no_grouping_extension", name: "No Grouping Extension", - description: "Extensions shouldn't be used to group code within the same source file.", + description: "Extensions shouldn't be used to group code within the same source file", kind: .idiomatic, nonTriggeringExamples: [ Example("protocol Food {}\nextension Food {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/NoMagicNumbersRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/NoMagicNumbersRule.swift index 7fac47660..f24fb69cf 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/NoMagicNumbersRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/NoMagicNumbersRule.swift @@ -8,7 +8,7 @@ struct NoMagicNumbersRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "no_magic_numbers", name: "No Magic Numbers", - description: "Magic numbers should be replaced by named constants.", + description: "Magic numbers should be replaced by named constants", kind: .idiomatic, nonTriggeringExamples: [ Example("var foo = 123"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ObjectLiteralRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ObjectLiteralRule.swift index 2e48deb75..e1a08e692 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ObjectLiteralRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ObjectLiteralRule.swift @@ -8,7 +8,7 @@ struct ObjectLiteralRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInRule static let description = RuleDescription( identifier: "object_literal", name: "Object Literal", - description: "Prefer object literals over image and color inits.", + description: "Prefer object literals over image and color inits", kind: .idiomatic, nonTriggeringExamples: [ Example("let image = #imageLiteral(resourceName: \"image.jpg\")"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/PatternMatchingKeywordsRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/PatternMatchingKeywordsRule.swift index 496d3fccb..b282a4034 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/PatternMatchingKeywordsRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/PatternMatchingKeywordsRule.swift @@ -8,7 +8,7 @@ struct PatternMatchingKeywordsRule: SwiftSyntaxRule, ConfigurationProviderRule, static let description = RuleDescription( identifier: "pattern_matching_keywords", name: "Pattern Matching Keywords", - description: "Combine multiple pattern matching bindings by moving keywords out of tuples.", + description: "Combine multiple pattern matching bindings by moving keywords out of tuples", kind: .idiomatic, nonTriggeringExamples: [ Example("default"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/PreferNimbleRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/PreferNimbleRule.swift index d039826dd..d93258901 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/PreferNimbleRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/PreferNimbleRule.swift @@ -8,7 +8,7 @@ struct PreferNimbleRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "prefer_nimble", name: "Prefer Nimble", - description: "Prefer Nimble matchers over XCTAssert functions.", + description: "Prefer Nimble matchers over XCTAssert functions", kind: .idiomatic, nonTriggeringExamples: [ Example("expect(foo) == 1"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/PrivateOverFilePrivateRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/PrivateOverFilePrivateRule.swift index fa53cf0dc..ac53d9dc3 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/PrivateOverFilePrivateRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/PrivateOverFilePrivateRule.swift @@ -8,7 +8,7 @@ struct PrivateOverFilePrivateRule: ConfigurationProviderRule, SwiftSyntaxCorrect static let description = RuleDescription( identifier: "private_over_fileprivate", name: "Private over Fileprivate", - description: "Prefer `private` over `fileprivate` declarations.", + description: "Prefer `private` over `fileprivate` declarations", kind: .idiomatic, nonTriggeringExamples: [ Example("extension String {}"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantObjcAttributeRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantObjcAttributeRule.swift index a2a45d37a..edc2a4470 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantObjcAttributeRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantObjcAttributeRule.swift @@ -13,7 +13,7 @@ struct RedundantObjcAttributeRule: SwiftSyntaxRule, SubstitutionCorrectableRule, static let description = RuleDescription( identifier: "redundant_objc_attribute", name: "Redundant @objc Attribute", - description: "Objective-C attribute (@objc) is redundant in declaration.", + description: "Objective-C attribute (@objc) is redundant in declaration", kind: .idiomatic, nonTriggeringExamples: RedundantObjcAttributeRuleExamples.nonTriggeringExamples, triggeringExamples: RedundantObjcAttributeRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantOptionalInitializationRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantOptionalInitializationRule.swift index e63738704..978e42a5d 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantOptionalInitializationRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantOptionalInitializationRule.swift @@ -8,7 +8,7 @@ struct RedundantOptionalInitializationRule: SwiftSyntaxCorrectableRule, Configur static let description = RuleDescription( identifier: "redundant_optional_initialization", name: "Redundant Optional Initialization", - description: "Initializing an optional variable with nil is redundant.", + description: "Initializing an optional variable with nil is redundant", kind: .idiomatic, nonTriggeringExamples: [ Example("var myVar: Int?\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantSetAccessControlRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantSetAccessControlRule.swift index 90526c23e..7477566e1 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantSetAccessControlRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantSetAccessControlRule.swift @@ -9,7 +9,7 @@ struct RedundantSetAccessControlRule: ConfigurationProviderRule, SwiftSyntaxRule identifier: "redundant_set_access_control", name: "Redundant Access Control for Setter", description: "Property setter access level shouldn't be explicit if " + - "it's the same as the variable access level.", + "it's the same as the variable access level", kind: .idiomatic, nonTriggeringExamples: [ Example("private(set) public var foo: Int"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantStringEnumValueRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantStringEnumValueRule.swift index 008868771..05e2f0375 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantStringEnumValueRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantStringEnumValueRule.swift @@ -8,7 +8,7 @@ struct RedundantStringEnumValueRule: SwiftSyntaxRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "redundant_string_enum_value", name: "Redundant String Enum Value", - description: "String enum values can be omitted when they are equal to the enumcase name.", + description: "String enum values can be omitted when they are equal to the enumcase name", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantVoidReturnRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantVoidReturnRule.swift index 97000418b..b437cdffa 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/RedundantVoidReturnRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/RedundantVoidReturnRule.swift @@ -9,7 +9,7 @@ struct RedundantVoidReturnRule: ConfigurationProviderRule, SubstitutionCorrectab static let description = RuleDescription( identifier: "redundant_void_return", name: "Redundant Void Return", - description: "Returning Void in a function declaration is redundant.", + description: "Returning Void in a function declaration is redundant", kind: .idiomatic, nonTriggeringExamples: [ Example("func foo() {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ReturnValueFromVoidFunctionRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ReturnValueFromVoidFunctionRule.swift index 64bced7da..03fdba8da 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ReturnValueFromVoidFunctionRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ReturnValueFromVoidFunctionRule.swift @@ -8,7 +8,7 @@ struct ReturnValueFromVoidFunctionRule: ConfigurationProviderRule, OptInRule, Sw static let description = RuleDescription( identifier: "return_value_from_void_function", name: "Return Value from Void Function", - description: "Returning values from Void functions should be avoided.", + description: "Returning values from Void functions should be avoided", kind: .idiomatic, minSwiftVersion: .fiveDotOne, nonTriggeringExamples: ReturnValueFromVoidFunctionRuleExamples.nonTriggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/StaticOperatorRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/StaticOperatorRule.swift index e63a9c4c8..429a21b89 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/StaticOperatorRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/StaticOperatorRule.swift @@ -8,7 +8,7 @@ struct StaticOperatorRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInRule static let description = RuleDescription( identifier: "static_operator", name: "Static Operator", - description: "Operators should be declared as static functions, not free functions.", + description: "Operators should be declared as static functions, not free functions", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/StrictFilePrivateRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/StrictFilePrivateRule.swift index e32031213..922efc6a4 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/StrictFilePrivateRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/StrictFilePrivateRule.swift @@ -8,7 +8,7 @@ struct StrictFilePrivateRule: OptInRule, ConfigurationProviderRule, SwiftSyntaxR static let description = RuleDescription( identifier: "strict_fileprivate", name: "Strict Fileprivate", - description: "`fileprivate` should be avoided.", + description: "`fileprivate` should be avoided", kind: .idiomatic, nonTriggeringExamples: [ Example("extension String {}"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/SyntacticSugarRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/SyntacticSugarRule.swift index 541d5c837..4e6688f92 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/SyntacticSugarRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/SyntacticSugarRule.swift @@ -83,7 +83,7 @@ private enum SugaredType: String { } var violationReason: String { - "Shorthand syntactic sugar should be used, i.e. \(sugaredExample) instead of \(desugaredExample)." + "Shorthand syntactic sugar should be used, i.e. \(sugaredExample) instead of \(desugaredExample)" } } diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/ToggleBoolRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/ToggleBoolRule.swift index 643fad3b2..22e26653a 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/ToggleBoolRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/ToggleBoolRule.swift @@ -9,7 +9,7 @@ struct ToggleBoolRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule, Op static var description = RuleDescription( identifier: "toggle_bool", name: "Toggle Bool", - description: "Prefer `someBool.toggle()` over `someBool = !someBool`.", + description: "Prefer `someBool.toggle()` over `someBool = !someBool`", kind: .idiomatic, nonTriggeringExamples: [ Example("isHidden.toggle()\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/TrailingSemicolonRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/TrailingSemicolonRule.swift index be2cf9f6a..b48704b80 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/TrailingSemicolonRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/TrailingSemicolonRule.swift @@ -8,7 +8,7 @@ struct TrailingSemicolonRule: SwiftSyntaxCorrectableRule, ConfigurationProviderR static let description = RuleDescription( identifier: "trailing_semicolon", name: "Trailing Semicolon", - description: "Lines should not have trailing semicolons.", + description: "Lines should not have trailing semicolons", kind: .idiomatic, nonTriggeringExamples: [ Example("let a = 0\n"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/UnavailableConditionRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/UnavailableConditionRule.swift index 3941965c4..f62f39b36 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/UnavailableConditionRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/UnavailableConditionRule.swift @@ -119,9 +119,9 @@ private final class UnavailableConditionRuleVisitor: ViolationsSyntaxVisitor { private func reason(for check: SyntaxProtocol) -> String { switch check { case is AvailabilityConditionSyntax: - return "Use #unavailable instead of #available with an empty body." + return "Use #unavailable instead of #available with an empty body" case is UnavailabilityConditionSyntax: - return "Use #available instead of #unavailable with an empty body." + return "Use #available instead of #unavailable with an empty body" default: queuedFatalError("Unknown availability check type.") } diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/UnavailableFunctionRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/UnavailableFunctionRule.swift index f37d436ee..a2d86402f 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/UnavailableFunctionRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/UnavailableFunctionRule.swift @@ -8,7 +8,7 @@ struct UnavailableFunctionRule: SwiftSyntaxRule, ConfigurationProviderRule, OptI static let description = RuleDescription( identifier: "unavailable_function", name: "Unavailable Function", - description: "Unimplemented functions should be marked as unavailable.", + description: "Unimplemented functions should be marked as unavailable", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/UnneededBreakInSwitchRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/UnneededBreakInSwitchRule.swift index f8d5a7399..2d6b44338 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/UnneededBreakInSwitchRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/UnneededBreakInSwitchRule.swift @@ -20,7 +20,7 @@ struct UnneededBreakInSwitchRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "unneeded_break_in_switch", name: "Unneeded Break in Switch", - description: "Avoid using unneeded break statements.", + description: "Avoid using unneeded break statements", kind: .idiomatic, nonTriggeringExamples: [ embedInSwitch("break"), diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/UntypedErrorInCatchRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/UntypedErrorInCatchRule.swift index e4bc19b14..b2b87d5c7 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/UntypedErrorInCatchRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/UntypedErrorInCatchRule.swift @@ -8,7 +8,7 @@ struct UntypedErrorInCatchRule: OptInRule, ConfigurationProviderRule, SwiftSynta static let description = RuleDescription( identifier: "untyped_error_in_catch", name: "Untyped Error in Catch", - description: "Catch statements should not declare error variables without type casting.", + description: "Catch statements should not declare error variables without type casting", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/UnusedEnumeratedRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/UnusedEnumeratedRule.swift index 1c73092d5..0a95728e1 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/UnusedEnumeratedRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/UnusedEnumeratedRule.swift @@ -53,10 +53,10 @@ private extension UnusedEnumeratedRule { let reason: String if firstTokenIsUnderscore { position = firstElement.positionAfterSkippingLeadingTrivia - reason = "When the index is not used, `.enumerated()` can be removed." + reason = "When the index is not used, `.enumerated()` can be removed" } else { position = secondElement.positionAfterSkippingLeadingTrivia - reason = "When the item is not used, `.indices` should be used instead of `.enumerated()`." + reason = "When the item is not used, `.indices` should be used instead of `.enumerated()`" } violations.append(ReasonedRuleViolation(position: position, reason: reason)) diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/VoidFunctionInTernaryConditionRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/VoidFunctionInTernaryConditionRule.swift index c675e5108..736783d2a 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/VoidFunctionInTernaryConditionRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/VoidFunctionInTernaryConditionRule.swift @@ -8,7 +8,7 @@ struct VoidFunctionInTernaryConditionRule: ConfigurationProviderRule, SwiftSynta static let description = RuleDescription( identifier: "void_function_in_ternary", name: "Void Function in Ternary", - description: "Using ternary to call Void functions should be avoided.", + description: "Using ternary to call Void functions should be avoided", kind: .idiomatic, minSwiftVersion: .fiveDotOne, nonTriggeringExamples: [ diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/XCTFailMessageRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/XCTFailMessageRule.swift index f0e22a19c..508a8cb4d 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/XCTFailMessageRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/XCTFailMessageRule.swift @@ -8,7 +8,7 @@ struct XCTFailMessageRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "xctfail_message", name: "XCTFail Message", - description: "An XCTFail call should include a description of the assertion.", + description: "An XCTFail call should include a description of the assertion", kind: .idiomatic, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Idiomatic/XCTSpecificMatcherRule.swift b/Source/SwiftLintFramework/Rules/Idiomatic/XCTSpecificMatcherRule.swift index 8be91a778..daa417878 100644 --- a/Source/SwiftLintFramework/Rules/Idiomatic/XCTSpecificMatcherRule.swift +++ b/Source/SwiftLintFramework/Rules/Idiomatic/XCTSpecificMatcherRule.swift @@ -8,7 +8,7 @@ struct XCTSpecificMatcherRule: SwiftSyntaxRule, OptInRule, ConfigurationProvider static let description = RuleDescription( identifier: "xct_specific_matcher", name: "XCTest Specific Matcher", - description: "Prefer specific XCTest matchers over `XCTAssertEqual` and `XCTAssertNotEqual`", + description: "Prefer specific XCTest matchers over `XCTAssertEqual` and `XCTAssertNotEqual`.", kind: .idiomatic, nonTriggeringExamples: XCTSpecificMatcherRuleExamples.nonTriggeringExamples, triggeringExamples: XCTSpecificMatcherRuleExamples.triggeringExamples @@ -72,7 +72,7 @@ private extension XCTSpecificMatcherRule { violations.append(ReasonedRuleViolation( position: node.positionAfterSkippingLeadingTrivia, - reason: "Prefer the specific matcher '\(suggestedMatcher)' instead." + reason: "Prefer the specific matcher '\(suggestedMatcher)' instead" )) } } diff --git a/Source/SwiftLintFramework/Rules/Lint/AccessibilityLabelForImageRule.swift b/Source/SwiftLintFramework/Rules/Lint/AccessibilityLabelForImageRule.swift index 22550c80a..49e440772 100644 --- a/Source/SwiftLintFramework/Rules/Lint/AccessibilityLabelForImageRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/AccessibilityLabelForImageRule.swift @@ -17,8 +17,8 @@ struct AccessibilityLabelForImageRule: ASTRule, ConfigurationProviderRule, OptIn static let description = RuleDescription( identifier: "accessibility_label_for_image", name: "Accessibility Label for Image", - description: "All Images that provide context should have an accessibility label. " + - "Purely decorative images can be hidden from accessibility.", + description: "Images that provide context should have an accessibility label or should be explicitly hidden " + + "from accessibility", kind: .lint, minSwiftVersion: .fiveDotOne, nonTriggeringExamples: AccessibilityLabelForImageRuleExamples.nonTriggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Lint/AccessibilityTraitForButtonRule.swift b/Source/SwiftLintFramework/Rules/Lint/AccessibilityTraitForButtonRule.swift index d83e490c7..dab2a9d70 100644 --- a/Source/SwiftLintFramework/Rules/Lint/AccessibilityTraitForButtonRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/AccessibilityTraitForButtonRule.swift @@ -15,9 +15,8 @@ struct AccessibilityTraitForButtonRule: ASTRule, ConfigurationProviderRule, OptI static let description = RuleDescription( identifier: "accessibility_trait_for_button", name: "Accessibility Trait for Button", - description: "All views with tap gestures added should include the .isButton " + - "accessibility trait. If a tap opens an external link the .isLink " + - "trait should be used instead.", + description: "All views with tap gestures added should include the .isButton or the .isLink accessibility " + + "traits", kind: .lint, minSwiftVersion: .fiveDotOne, nonTriggeringExamples: AccessibilityTraitForButtonRuleExamples.nonTriggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Lint/AnyObjectProtocolRule.swift b/Source/SwiftLintFramework/Rules/Lint/AnyObjectProtocolRule.swift index d8b6d3549..792afd04d 100644 --- a/Source/SwiftLintFramework/Rules/Lint/AnyObjectProtocolRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/AnyObjectProtocolRule.swift @@ -19,7 +19,7 @@ struct AnyObjectProtocolRule: SwiftSyntaxCorrectableRule, OptInRule, Configurati static let description = RuleDescription( identifier: "anyobject_protocol", name: "AnyObject Protocol", - description: "Prefer using `AnyObject` over `class` for class-only protocols.", + description: "Prefer using `AnyObject` over `class` for class-only protocols", kind: .lint, nonTriggeringExamples: [ Example("protocol SomeProtocol {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Lint/ArrayInitRule.swift b/Source/SwiftLintFramework/Rules/Lint/ArrayInitRule.swift index 7b04ab503..91f095e37 100644 --- a/Source/SwiftLintFramework/Rules/Lint/ArrayInitRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/ArrayInitRule.swift @@ -8,7 +8,7 @@ struct ArrayInitRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInRule { static let description = RuleDescription( identifier: "array_init", name: "Array Init", - description: "Prefer using `Array(seq)` over `seq.map { $0 }` to convert a sequence into an Array.", + description: "Prefer using `Array(seq)` over `seq.map { $0 }` to convert a sequence into an Array", kind: .lint, nonTriggeringExamples: [ Example("Array(foo)\n"), diff --git a/Source/SwiftLintFramework/Rules/Lint/BalancedXCTestLifecycleRule.swift b/Source/SwiftLintFramework/Rules/Lint/BalancedXCTestLifecycleRule.swift index 75ee95efa..48246aa90 100644 --- a/Source/SwiftLintFramework/Rules/Lint/BalancedXCTestLifecycleRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/BalancedXCTestLifecycleRule.swift @@ -8,7 +8,7 @@ struct BalancedXCTestLifecycleRule: SwiftSyntaxRule, OptInRule, ConfigurationPro static let description = RuleDescription( identifier: "balanced_xctest_lifecycle", name: "Balanced XCTest Life Cycle", - description: "Test classes must implement balanced setUp and tearDown methods.", + description: "Test classes must implement balanced setUp and tearDown methods", kind: .lint, nonTriggeringExamples: [ Example(#""" diff --git a/Source/SwiftLintFramework/Rules/Lint/CaptureVariableRule.swift b/Source/SwiftLintFramework/Rules/Lint/CaptureVariableRule.swift index d7d3321ef..b5f8e4bd1 100644 --- a/Source/SwiftLintFramework/Rules/Lint/CaptureVariableRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/CaptureVariableRule.swift @@ -13,7 +13,7 @@ struct CaptureVariableRule: ConfigurationProviderRule, AnalyzerRule, CollectingR identifier: "capture_variable", name: "Capture Variable", description: "Non-constant variables should not be listed in a closure's capture list" + - " to avoid confusion about closures capturing variables at creation time.", + " to avoid confusion about closures capturing variables at creation time", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/ClassDelegateProtocolRule.swift b/Source/SwiftLintFramework/Rules/Lint/ClassDelegateProtocolRule.swift index 098cd73bb..906aa1ecb 100644 --- a/Source/SwiftLintFramework/Rules/Lint/ClassDelegateProtocolRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/ClassDelegateProtocolRule.swift @@ -8,7 +8,7 @@ struct ClassDelegateProtocolRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "class_delegate_protocol", name: "Class Delegate Protocol", - description: "Delegate protocols should be class-only so they can be weakly referenced.", + description: "Delegate protocols should be class-only so they can be weakly referenced", kind: .lint, nonTriggeringExamples: [ Example("protocol FooDelegate: class {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Lint/CommentSpacingRule.swift b/Source/SwiftLintFramework/Rules/Lint/CommentSpacingRule.swift index 426c62889..dc42e598b 100644 --- a/Source/SwiftLintFramework/Rules/Lint/CommentSpacingRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/CommentSpacingRule.swift @@ -10,7 +10,7 @@ struct CommentSpacingRule: SourceKitFreeRule, ConfigurationProviderRule, Substit static let description = RuleDescription( identifier: "comment_spacing", name: "Comment Spacing", - description: "Prefer at least one space after slashes for comments.", + description: "Prefer at least one space after slashes for comments", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/CompilerProtocolInitRule.swift b/Source/SwiftLintFramework/Rules/Lint/CompilerProtocolInitRule.swift index 838ad4e8f..304a85266 100644 --- a/Source/SwiftLintFramework/Rules/Lint/CompilerProtocolInitRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/CompilerProtocolInitRule.swift @@ -8,10 +8,8 @@ struct CompilerProtocolInitRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "compiler_protocol_init", name: "Compiler Protocol Init", - description: Self.violationReason( - protocolName: "such as `ExpressibleByArrayLiteral`", - isPlural: true - ), + description: "The initializers declared in compiler protocols such as `ExpressibleByArrayLiteral` " + + "shouldn't be called directly.", kind: .lint, nonTriggeringExamples: [ Example("let set: Set = [1, 2]\n"), @@ -25,11 +23,6 @@ struct CompilerProtocolInitRule: SwiftSyntaxRule, ConfigurationProviderRule { ] ) - private static func violationReason(protocolName: String, isPlural: Bool = false) -> String { - return "The initializers declared in compiler protocol\(isPlural ? "s" : "") \(protocolName) " + - "shouldn't be called directly." - } - func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor { Visitor(viewMode: .sourceAccurate) } @@ -60,7 +53,8 @@ private extension CompilerProtocolInitRule { violations.append(ReasonedRuleViolation( position: node.positionAfterSkippingLeadingTrivia, - reason: violationReason(protocolName: compilerProtocol.protocolName) + reason: "Initializers declared in compiler protocol \(compilerProtocol.protocolName) " + + "shouldn't be called directly" )) return } diff --git a/Source/SwiftLintFramework/Rules/Lint/DeploymentTargetRule.swift b/Source/SwiftLintFramework/Rules/Lint/DeploymentTargetRule.swift index c63a588a4..3c30d58be 100644 --- a/Source/SwiftLintFramework/Rules/Lint/DeploymentTargetRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/DeploymentTargetRule.swift @@ -134,7 +134,7 @@ private extension DeploymentTargetRule { return """ Availability \(violationType.displayString) is using a version (\(versionString)) that is \ - satisfied by the deployment target (\(minVersion.stringValue)) for platform \(platform.rawValue). + satisfied by the deployment target (\(minVersion.stringValue)) for platform \(platform.rawValue) """ } } diff --git a/Source/SwiftLintFramework/Rules/Lint/DiscardedNotificationCenterObserverRule.swift b/Source/SwiftLintFramework/Rules/Lint/DiscardedNotificationCenterObserverRule.swift index 8ee3c9425..da9624325 100644 --- a/Source/SwiftLintFramework/Rules/Lint/DiscardedNotificationCenterObserverRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/DiscardedNotificationCenterObserverRule.swift @@ -9,7 +9,7 @@ struct DiscardedNotificationCenterObserverRule: SwiftSyntaxRule, ConfigurationPr identifier: "discarded_notification_center_observer", name: "Discarded Notification Center Observer", description: "When registering for a notification using a block, the opaque observer that is " + - "returned should be stored so it can be removed later.", + "returned should be stored so it can be removed later", kind: .lint, nonTriggeringExamples: [ Example("let foo = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }\n"), diff --git a/Source/SwiftLintFramework/Rules/Lint/DiscouragedDirectInitRule.swift b/Source/SwiftLintFramework/Rules/Lint/DiscouragedDirectInitRule.swift index 8ce89e557..e85f120be 100644 --- a/Source/SwiftLintFramework/Rules/Lint/DiscouragedDirectInitRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/DiscouragedDirectInitRule.swift @@ -8,7 +8,7 @@ struct DiscouragedDirectInitRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "discouraged_direct_init", name: "Discouraged Direct Initialization", - description: "Discouraged direct initialization of types that can be harmful.", + description: "Discouraged direct initialization of types that can be harmful", kind: .lint, nonTriggeringExamples: [ Example("let foo = UIDevice.current"), diff --git a/Source/SwiftLintFramework/Rules/Lint/DuplicateEnumCasesRule.swift b/Source/SwiftLintFramework/Rules/Lint/DuplicateEnumCasesRule.swift index df3ad3958..2c60924cb 100644 --- a/Source/SwiftLintFramework/Rules/Lint/DuplicateEnumCasesRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/DuplicateEnumCasesRule.swift @@ -8,7 +8,7 @@ struct DuplicateEnumCasesRule: ConfigurationProviderRule, SwiftSyntaxRule { static let description = RuleDescription( identifier: "duplicate_enum_cases", name: "Duplicate Enum Cases", - description: "Enum can't contain multiple cases with the same name.", + description: "Enum can't contain multiple cases with the same name", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/DuplicatedKeyInDictionaryLiteralRule.swift b/Source/SwiftLintFramework/Rules/Lint/DuplicatedKeyInDictionaryLiteralRule.swift index a2ed080a7..736dbf312 100644 --- a/Source/SwiftLintFramework/Rules/Lint/DuplicatedKeyInDictionaryLiteralRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/DuplicatedKeyInDictionaryLiteralRule.swift @@ -8,7 +8,7 @@ struct DuplicatedKeyInDictionaryLiteralRule: SwiftSyntaxRule, ConfigurationProvi static var description = RuleDescription( identifier: "duplicated_key_in_dictionary_literal", name: "Duplicated Key in Dictionary Literal", - description: "Dictionary literals with duplicated keys will crash in runtime.", + description: "Dictionary literals with duplicated keys will crash in runtime", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/DynamicInlineRule.swift b/Source/SwiftLintFramework/Rules/Lint/DynamicInlineRule.swift index e08b9b77d..4316a07f2 100644 --- a/Source/SwiftLintFramework/Rules/Lint/DynamicInlineRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/DynamicInlineRule.swift @@ -8,7 +8,7 @@ struct DynamicInlineRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "dynamic_inline", name: "Dynamic Inline", - description: "Avoid using 'dynamic' and '@inline(__always)' together.", + description: "Avoid using 'dynamic' and '@inline(__always)' together", kind: .lint, nonTriggeringExamples: [ Example("class C {\ndynamic func f() {}}"), diff --git a/Source/SwiftLintFramework/Rules/Lint/EmptyXCTestMethodRule.swift b/Source/SwiftLintFramework/Rules/Lint/EmptyXCTestMethodRule.swift index 4e3c6afbd..7c7ead6e6 100644 --- a/Source/SwiftLintFramework/Rules/Lint/EmptyXCTestMethodRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/EmptyXCTestMethodRule.swift @@ -8,7 +8,7 @@ struct EmptyXCTestMethodRule: OptInRule, ConfigurationProviderRule, SwiftSyntaxR static let description = RuleDescription( identifier: "empty_xctest_method", name: "Empty XCTest Method", - description: "Empty XCTest method should be avoided.", + description: "Empty XCTest method should be avoided", kind: .lint, nonTriggeringExamples: EmptyXCTestMethodRuleExamples.nonTriggeringExamples, triggeringExamples: EmptyXCTestMethodRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Lint/ExpiringTodoRule.swift b/Source/SwiftLintFramework/Rules/Lint/ExpiringTodoRule.swift index acd3d1292..03e6ebaee 100644 --- a/Source/SwiftLintFramework/Rules/Lint/ExpiringTodoRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/ExpiringTodoRule.swift @@ -10,11 +10,11 @@ struct ExpiringTodoRule: ConfigurationProviderRule, OptInRule { var reason: String { switch self { case .approachingExpiry: - return "TODO/FIXME is approaching its expiry and should be resolved soon." + return "TODO/FIXME is approaching its expiry and should be resolved soon" case .expired: - return "TODO/FIXME has expired and must be resolved." + return "TODO/FIXME has expired and must be resolved" case .badFormatting: - return "Expiring TODO/FIXME is incorrectly formatted." + return "Expiring TODO/FIXME is incorrectly formatted" } } } diff --git a/Source/SwiftLintFramework/Rules/Lint/IBInspectableInExtensionRule.swift b/Source/SwiftLintFramework/Rules/Lint/IBInspectableInExtensionRule.swift index b4057834e..724afa778 100644 --- a/Source/SwiftLintFramework/Rules/Lint/IBInspectableInExtensionRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/IBInspectableInExtensionRule.swift @@ -8,7 +8,7 @@ struct IBInspectableInExtensionRule: SwiftSyntaxRule, ConfigurationProviderRule, static let description = RuleDescription( identifier: "ibinspectable_in_extension", name: "IBInspectable in Extension", - description: "Extensions shouldn't add @IBInspectable properties.", + description: "Extensions shouldn't add @IBInspectable properties", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/IdenticalOperandsRule.swift b/Source/SwiftLintFramework/Rules/Lint/IdenticalOperandsRule.swift index caccd2cab..160b9c09b 100644 --- a/Source/SwiftLintFramework/Rules/Lint/IdenticalOperandsRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/IdenticalOperandsRule.swift @@ -10,7 +10,7 @@ struct IdenticalOperandsRule: ConfigurationProviderRule, SwiftSyntaxRule, OptInR static let description = RuleDescription( identifier: "identical_operands", name: "Identical Operands", - description: "Comparing two identical operands is likely a mistake.", + description: "Comparing two identical operands is likely a mistake", kind: .lint, nonTriggeringExamples: operators.flatMap { operation in [ diff --git a/Source/SwiftLintFramework/Rules/Lint/InertDeferRule.swift b/Source/SwiftLintFramework/Rules/Lint/InertDeferRule.swift index b62834048..34f0520db 100644 --- a/Source/SwiftLintFramework/Rules/Lint/InertDeferRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/InertDeferRule.swift @@ -20,7 +20,7 @@ struct InertDeferRule: ConfigurationProviderRule, SwiftSyntaxRule, OptInRule { static let description = RuleDescription( identifier: "inert_defer", name: "Inert Defer", - description: "If defer is at the end of its parent scope, it will be executed right where it is anyway.", + description: "If defer is at the end of its parent scope, it will be executed right where it is anyway", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/LocalDocCommentRule.swift b/Source/SwiftLintFramework/Rules/Lint/LocalDocCommentRule.swift index 84a0edcc9..faacacb08 100644 --- a/Source/SwiftLintFramework/Rules/Lint/LocalDocCommentRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/LocalDocCommentRule.swift @@ -9,7 +9,7 @@ struct LocalDocCommentRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInRul static let description = RuleDescription( identifier: "local_doc_comment", name: "Local Doc Comment", - description: "Doc comments shouldn't be used in local scopes. Use regular comments.", + description: "Prefer regular comments over doc comments in local scopes", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/MissingDocsRule.swift b/Source/SwiftLintFramework/Rules/Lint/MissingDocsRule.swift index 53b675196..1f9278085 100644 --- a/Source/SwiftLintFramework/Rules/Lint/MissingDocsRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/MissingDocsRule.swift @@ -132,7 +132,7 @@ struct MissingDocsRule: OptInRule, ConfigurationProviderRule { StyleViolation(ruleDescription: Self.description, severity: configuration.parameters.first { $0.value == acl }?.severity ?? .warning, location: Location(file: file, byteOffset: offset), - reason: "\(acl.description) declarations should be documented.") + reason: "\(acl.description) declarations should be documented") } } } diff --git a/Source/SwiftLintFramework/Rules/Lint/NSLocalizedStringKeyRule.swift b/Source/SwiftLintFramework/Rules/Lint/NSLocalizedStringKeyRule.swift index 330e1e6c9..8ff99422e 100644 --- a/Source/SwiftLintFramework/Rules/Lint/NSLocalizedStringKeyRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/NSLocalizedStringKeyRule.swift @@ -9,7 +9,7 @@ struct NSLocalizedStringKeyRule: SwiftSyntaxRule, OptInRule, ConfigurationProvid identifier: "nslocalizedstring_key", name: "NSLocalizedString Key", description: "Static strings should be used as key/comment" + - " in NSLocalizedString in order for genstrings to work.", + " in NSLocalizedString in order for genstrings to work", kind: .lint, nonTriggeringExamples: [ Example("NSLocalizedString(\"key\", comment: \"\")"), diff --git a/Source/SwiftLintFramework/Rules/Lint/NSLocalizedStringRequireBundleRule.swift b/Source/SwiftLintFramework/Rules/Lint/NSLocalizedStringRequireBundleRule.swift index 97d7ff5fb..a9be1f62f 100644 --- a/Source/SwiftLintFramework/Rules/Lint/NSLocalizedStringRequireBundleRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/NSLocalizedStringRequireBundleRule.swift @@ -8,7 +8,7 @@ struct NSLocalizedStringRequireBundleRule: SwiftSyntaxRule, OptInRule, Configura static let description = RuleDescription( identifier: "nslocalizedstring_require_bundle", name: "NSLocalizedString Require Bundle", - description: "Calls to NSLocalizedString should specify the bundle which contains the strings file.", + description: "Calls to NSLocalizedString should specify the bundle which contains the strings file", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/NSNumberInitAsFunctionReferenceRule.swift b/Source/SwiftLintFramework/Rules/Lint/NSNumberInitAsFunctionReferenceRule.swift index e5a7924d1..11a6ca565 100644 --- a/Source/SwiftLintFramework/Rules/Lint/NSNumberInitAsFunctionReferenceRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/NSNumberInitAsFunctionReferenceRule.swift @@ -10,7 +10,7 @@ struct NSNumberInitAsFunctionReferenceRule: SwiftSyntaxRule, ConfigurationProvid identifier: "ns_number_init_as_function_reference", name: "NSNumber Init as Function Reference", description: "Passing `NSNumber.init` or `NSDecimalNumber.init` as a function reference is dangerous " + - "as it can cause the wrong initializer to be used, causing crashes. Use `.init(value:)` instead.", + "as it can cause the wrong initializer to be used, causing crashes; use `.init(value:)` instead", kind: .lint, nonTriggeringExamples: [ Example("[0, 0.2].map(NSNumber.init(value:))"), diff --git a/Source/SwiftLintFramework/Rules/Lint/NSObjectPreferIsEqualRule.swift b/Source/SwiftLintFramework/Rules/Lint/NSObjectPreferIsEqualRule.swift index 231e10055..e4aaacbf5 100644 --- a/Source/SwiftLintFramework/Rules/Lint/NSObjectPreferIsEqualRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/NSObjectPreferIsEqualRule.swift @@ -8,7 +8,7 @@ struct NSObjectPreferIsEqualRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "nsobject_prefer_isequal", name: "NSObject Prefer isEqual", - description: "NSObject subclasses should implement isEqual instead of ==.", + description: "NSObject subclasses should implement isEqual instead of ==", kind: .lint, nonTriggeringExamples: NSObjectPreferIsEqualRuleExamples.nonTriggeringExamples, triggeringExamples: NSObjectPreferIsEqualRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Lint/NotificationCenterDetachmentRule.swift b/Source/SwiftLintFramework/Rules/Lint/NotificationCenterDetachmentRule.swift index 0f6231874..7150d182b 100644 --- a/Source/SwiftLintFramework/Rules/Lint/NotificationCenterDetachmentRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/NotificationCenterDetachmentRule.swift @@ -8,7 +8,7 @@ struct NotificationCenterDetachmentRule: SwiftSyntaxRule, ConfigurationProviderR static let description = RuleDescription( identifier: "notification_center_detachment", name: "Notification Center Detachment", - description: "An object should only remove itself as an observer in `deinit`.", + description: "An object should only remove itself as an observer in `deinit`", kind: .lint, nonTriggeringExamples: NotificationCenterDetachmentRuleExamples.nonTriggeringExamples, triggeringExamples: NotificationCenterDetachmentRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Lint/OrphanedDocCommentRule.swift b/Source/SwiftLintFramework/Rules/Lint/OrphanedDocCommentRule.swift index 0bc44db94..aa25f08fd 100644 --- a/Source/SwiftLintFramework/Rules/Lint/OrphanedDocCommentRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/OrphanedDocCommentRule.swift @@ -8,7 +8,7 @@ struct OrphanedDocCommentRule: SourceKitFreeRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "orphaned_doc_comment", name: "Orphaned Doc Comment", - description: "A doc comment should be attached to a declaration.", + description: "A doc comment should be attached to a declaration", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/OverriddenSuperCallRule.swift b/Source/SwiftLintFramework/Rules/Lint/OverriddenSuperCallRule.swift index c72254217..ac42c4fe7 100644 --- a/Source/SwiftLintFramework/Rules/Lint/OverriddenSuperCallRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/OverriddenSuperCallRule.swift @@ -8,7 +8,7 @@ struct OverriddenSuperCallRule: ConfigurationProviderRule, SwiftSyntaxRule, OptI static let description = RuleDescription( identifier: "overridden_super_call", name: "Overridden Method Calls Super", - description: "Some overridden methods should always call super", + description: "Some overridden methods should always call super.", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/OverrideInExtensionRule.swift b/Source/SwiftLintFramework/Rules/Lint/OverrideInExtensionRule.swift index 6fd1dc7f7..224191bef 100644 --- a/Source/SwiftLintFramework/Rules/Lint/OverrideInExtensionRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/OverrideInExtensionRule.swift @@ -8,7 +8,7 @@ struct OverrideInExtensionRule: ConfigurationProviderRule, OptInRule, SwiftSynta static let description = RuleDescription( identifier: "override_in_extension", name: "Override in Extension", - description: "Extensions shouldn't override declarations.", + description: "Extensions shouldn't override declarations", kind: .lint, nonTriggeringExamples: [ Example("extension Person {\n var age: Int { return 42 }\n}\n"), diff --git a/Source/SwiftLintFramework/Rules/Lint/PeriodSpacingRule.swift b/Source/SwiftLintFramework/Rules/Lint/PeriodSpacingRule.swift index 12a4c6a34..2b10a4c79 100644 --- a/Source/SwiftLintFramework/Rules/Lint/PeriodSpacingRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/PeriodSpacingRule.swift @@ -10,7 +10,7 @@ struct PeriodSpacingRule: SourceKitFreeRule, ConfigurationProviderRule, OptInRul static let description = RuleDescription( identifier: "period_spacing", name: "Period Spacing", - description: "Periods should not be followed by more than one space.", + description: "Periods should not be followed by more than one space", kind: .style, nonTriggeringExamples: [ Example("let pi = 3.2"), diff --git a/Source/SwiftLintFramework/Rules/Lint/PrivateActionRule.swift b/Source/SwiftLintFramework/Rules/Lint/PrivateActionRule.swift index 9480aba09..3795ce47e 100644 --- a/Source/SwiftLintFramework/Rules/Lint/PrivateActionRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/PrivateActionRule.swift @@ -8,7 +8,7 @@ struct PrivateActionRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "private_action", name: "Private Actions", - description: "IBActions should be private.", + description: "IBActions should be private", kind: .lint, nonTriggeringExamples: [ Example("class Foo {\n\t@IBAction private func barButtonTapped(_ sender: UIButton) {}\n}\n"), diff --git a/Source/SwiftLintFramework/Rules/Lint/PrivateOutletRule.swift b/Source/SwiftLintFramework/Rules/Lint/PrivateOutletRule.swift index 7939334e6..0f99c2a10 100644 --- a/Source/SwiftLintFramework/Rules/Lint/PrivateOutletRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/PrivateOutletRule.swift @@ -8,7 +8,7 @@ struct PrivateOutletRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "private_outlet", name: "Private Outlets", - description: "IBOutlets should be private to avoid leaking UIKit to higher layers.", + description: "IBOutlets should be private to avoid leaking UIKit to higher layers", kind: .lint, nonTriggeringExamples: [ Example("class Foo {\n @IBOutlet private var label: UILabel?\n}\n"), diff --git a/Source/SwiftLintFramework/Rules/Lint/PrivateSubjectRule.swift b/Source/SwiftLintFramework/Rules/Lint/PrivateSubjectRule.swift index cf87dfb19..ab583a8a5 100644 --- a/Source/SwiftLintFramework/Rules/Lint/PrivateSubjectRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/PrivateSubjectRule.swift @@ -8,7 +8,7 @@ struct PrivateSubjectRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "private_subject", name: "Private Combine Subject", - description: "Combine Subject should be private.", + description: "Combine Subject should be private", kind: .lint, nonTriggeringExamples: PrivateSubjectRuleExamples.nonTriggeringExamples, triggeringExamples: PrivateSubjectRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Lint/PrivateUnitTestRule.swift b/Source/SwiftLintFramework/Rules/Lint/PrivateUnitTestRule.swift index 0e52a545c..7ea916fd2 100644 --- a/Source/SwiftLintFramework/Rules/Lint/PrivateUnitTestRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/PrivateUnitTestRule.swift @@ -18,7 +18,7 @@ struct PrivateUnitTestRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRul static let description = RuleDescription( identifier: "private_unit_test", name: "Private Unit Test", - description: "Unit tests marked private are silently skipped.", + description: "Unit tests marked private are silently skipped", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/ProhibitedInterfaceBuilderRule.swift b/Source/SwiftLintFramework/Rules/Lint/ProhibitedInterfaceBuilderRule.swift index e96592202..d17e56870 100644 --- a/Source/SwiftLintFramework/Rules/Lint/ProhibitedInterfaceBuilderRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/ProhibitedInterfaceBuilderRule.swift @@ -8,7 +8,7 @@ struct ProhibitedInterfaceBuilderRule: ConfigurationProviderRule, SwiftSyntaxRul static let description = RuleDescription( identifier: "prohibited_interface_builder", name: "Prohibited Interface Builder", - description: "Creating views using Interface Builder should be avoided.", + description: "Creating views using Interface Builder should be avoided", kind: .lint, nonTriggeringExamples: [ wrapExample("var label: UILabel!"), diff --git a/Source/SwiftLintFramework/Rules/Lint/ProhibitedSuperRule.swift b/Source/SwiftLintFramework/Rules/Lint/ProhibitedSuperRule.swift index 96ce0856a..91a1ff758 100644 --- a/Source/SwiftLintFramework/Rules/Lint/ProhibitedSuperRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/ProhibitedSuperRule.swift @@ -8,7 +8,7 @@ struct ProhibitedSuperRule: ConfigurationProviderRule, SwiftSyntaxRule, OptInRul static let description = RuleDescription( identifier: "prohibited_super_call", name: "Prohibited Calls to Super", - description: "Some methods should not call super", + description: "Some methods should not call super.", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedCallRule.swift b/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedCallRule.swift index 5e9223d22..f5b1f6f9d 100644 --- a/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedCallRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedCallRule.swift @@ -56,7 +56,7 @@ struct QuickDiscouragedCallRule: OptInRule, ConfigurationProviderRule { StyleViolation(ruleDescription: Self.description, severity: configuration.severity, location: Location(file: file, byteOffset: $0), - reason: "Discouraged call inside a '\(name)' block.") + reason: "Discouraged call inside a '\(name)' block") } } diff --git a/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedFocusedTestRule.swift b/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedFocusedTestRule.swift index ab2e17aea..55125768d 100644 --- a/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedFocusedTestRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedFocusedTestRule.swift @@ -8,7 +8,7 @@ struct QuickDiscouragedFocusedTestRule: OptInRule, ConfigurationProviderRule, Sw static let description = RuleDescription( identifier: "quick_discouraged_focused_test", name: "Quick Discouraged Focused Test", - description: "Discouraged focused test. Other tests won't run while this one is focused.", + description: "Non-focused tests won't run as long as this test is focused", kind: .lint, nonTriggeringExamples: QuickDiscouragedFocusedTestRuleExamples.nonTriggeringExamples, triggeringExamples: QuickDiscouragedFocusedTestRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedPendingTestRule.swift b/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedPendingTestRule.swift index d9ee0e78a..f6591eb72 100644 --- a/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedPendingTestRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/QuickDiscouragedPendingTestRule.swift @@ -8,7 +8,7 @@ struct QuickDiscouragedPendingTestRule: OptInRule, ConfigurationProviderRule, Sw static let description = RuleDescription( identifier: "quick_discouraged_pending_test", name: "Quick Discouraged Pending Test", - description: "Discouraged pending test. This test won't run while it's marked as pending.", + description: "This test won't run as long as it's marked pending", kind: .lint, nonTriggeringExamples: QuickDiscouragedPendingTestRuleExamples.nonTriggeringExamples, triggeringExamples: QuickDiscouragedPendingTestRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Lint/RawValueForCamelCasedCodableEnumRule.swift b/Source/SwiftLintFramework/Rules/Lint/RawValueForCamelCasedCodableEnumRule.swift index 0cc193d82..15d2378e6 100644 --- a/Source/SwiftLintFramework/Rules/Lint/RawValueForCamelCasedCodableEnumRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/RawValueForCamelCasedCodableEnumRule.swift @@ -8,7 +8,7 @@ struct RawValueForCamelCasedCodableEnumRule: SwiftSyntaxRule, OptInRule, Configu static let description = RuleDescription( identifier: "raw_value_for_camel_cased_codable_enum", name: "Raw Value for Camel Cased Codable Enum", - description: "Camel cased cases of Codable String enums should have raw value.", + description: "Camel cased cases of Codable String enums should have raw value", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/RequiredDeinitRule.swift b/Source/SwiftLintFramework/Rules/Lint/RequiredDeinitRule.swift index 3867c5883..3fd1fe65d 100644 --- a/Source/SwiftLintFramework/Rules/Lint/RequiredDeinitRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/RequiredDeinitRule.swift @@ -12,7 +12,7 @@ struct RequiredDeinitRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "required_deinit", name: "Required Deinit", - description: "Classes should have an explicit deinit method.", + description: "Classes should have an explicit deinit method", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/SelfInPropertyInitializationRule.swift b/Source/SwiftLintFramework/Rules/Lint/SelfInPropertyInitializationRule.swift index 621a08145..b55af881a 100644 --- a/Source/SwiftLintFramework/Rules/Lint/SelfInPropertyInitializationRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/SelfInPropertyInitializationRule.swift @@ -8,8 +8,8 @@ struct SelfInPropertyInitializationRule: ConfigurationProviderRule, SwiftSyntaxR static let description = RuleDescription( identifier: "self_in_property_initialization", name: "Self in Property Initialization", - description: "`self` refers to the unapplied `NSObject.self()` method, which is likely not expected. " + - "Make the variable `lazy` to be able to refer to the current instance or use `ClassName.self`.", + description: "`self` refers to the unapplied `NSObject.self()` method, which is likely not expected; " + + "make the variable `lazy` to be able to refer to the current instance or use `ClassName.self`", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/StrongIBOutletRule.swift b/Source/SwiftLintFramework/Rules/Lint/StrongIBOutletRule.swift index 0d9c7b616..f505d53b3 100644 --- a/Source/SwiftLintFramework/Rules/Lint/StrongIBOutletRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/StrongIBOutletRule.swift @@ -8,7 +8,7 @@ struct StrongIBOutletRule: ConfigurationProviderRule, SwiftSyntaxCorrectableRule static let description = RuleDescription( identifier: "strong_iboutlet", name: "Strong IBOutlet", - description: "@IBOutlets shouldn't be declared as weak.", + description: "@IBOutlets shouldn't be declared as weak", kind: .lint, nonTriggeringExamples: [ wrapExample("@IBOutlet var label: UILabel?"), diff --git a/Source/SwiftLintFramework/Rules/Lint/SuperfluousDisableCommandRule.swift b/Source/SwiftLintFramework/Rules/Lint/SuperfluousDisableCommandRule.swift index a9405f80a..328f974d2 100644 --- a/Source/SwiftLintFramework/Rules/Lint/SuperfluousDisableCommandRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/SuperfluousDisableCommandRule.swift @@ -20,16 +20,13 @@ public struct SuperfluousDisableCommandRule: ConfigurationProviderRule, SourceKi } func reason(for rule: Rule.Type) -> String { - return self.reason(for: rule.description.identifier) - } - - func reason(for rule: String) -> String { """ - SwiftLint rule '\(rule)' did not trigger a violation in the disabled region. Please remove the disable command. + SwiftLint rule '\(rule.description.identifier)' did not trigger a violation in the disabled region; \ + remove the disable command """ } func reason(forNonExistentRule rule: String) -> String { - return "'\(rule)' is not a valid SwiftLint rule. Please remove it from the disable command." + return "'\(rule)' is not a valid SwiftLint rule; remove it from the disable command" } } diff --git a/Source/SwiftLintFramework/Rules/Lint/TestCaseAccessibilityRule.swift b/Source/SwiftLintFramework/Rules/Lint/TestCaseAccessibilityRule.swift index c0efa363a..25d149776 100644 --- a/Source/SwiftLintFramework/Rules/Lint/TestCaseAccessibilityRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/TestCaseAccessibilityRule.swift @@ -10,7 +10,7 @@ struct TestCaseAccessibilityRule: SwiftSyntaxRule, OptInRule, static let description = RuleDescription( identifier: "test_case_accessibility", name: "Test Case Accessibility", - description: "Test cases should only contain private non-test members.", + description: "Test cases should only contain private non-test members", kind: .lint, nonTriggeringExamples: TestCaseAccessibilityRuleExamples.nonTriggeringExamples, triggeringExamples: TestCaseAccessibilityRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Lint/TodoRule.swift b/Source/SwiftLintFramework/Rules/Lint/TodoRule.swift index 8d527c0e2..f83fef82e 100644 --- a/Source/SwiftLintFramework/Rules/Lint/TodoRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/TodoRule.swift @@ -63,9 +63,9 @@ struct TodoRule: ConfigurationProviderRule { } if message.isEmpty { - reason = "\(kind) should be resolved." + reason = "\(kind) should be resolved" } else { - reason = "\(kind) should be resolved (\(message))." + reason = "\(kind) should be resolved (\(message))" } return reason diff --git a/Source/SwiftLintFramework/Rules/Lint/UnownedVariableCaptureRule.swift b/Source/SwiftLintFramework/Rules/Lint/UnownedVariableCaptureRule.swift index b9be9bf28..547eab00f 100644 --- a/Source/SwiftLintFramework/Rules/Lint/UnownedVariableCaptureRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/UnownedVariableCaptureRule.swift @@ -8,7 +8,7 @@ struct UnownedVariableCaptureRule: SwiftSyntaxRule, OptInRule, ConfigurationProv static let description = RuleDescription( identifier: "unowned_variable_capture", name: "Unowned Variable Capture", - description: "Prefer capturing references as weak to avoid potential crashes.", + description: "Prefer capturing references as weak to avoid potential crashes", kind: .lint, nonTriggeringExamples: [ Example("foo { [weak self] in _ }"), diff --git a/Source/SwiftLintFramework/Rules/Lint/UnusedCaptureListRule.swift b/Source/SwiftLintFramework/Rules/Lint/UnusedCaptureListRule.swift index af33352f5..ec9045c2c 100644 --- a/Source/SwiftLintFramework/Rules/Lint/UnusedCaptureListRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/UnusedCaptureListRule.swift @@ -20,7 +20,7 @@ struct UnusedCaptureListRule: SwiftSyntaxRule, ConfigurationProviderRule, OptInR static var description = RuleDescription( identifier: "unused_capture_list", name: "Unused Capture List", - description: "Unused reference in a capture list should be removed.", + description: "Unused reference in a capture list should be removed", kind: .lint, nonTriggeringExamples: [ Example(""" @@ -181,12 +181,7 @@ private extension UnusedCaptureListRule { } for entry in captureItemsWithNames where missingIdentifiers.contains(entry.name) { - violations.append( - ReasonedRuleViolation( - position: entry.item.positionAfterSkippingLeadingTrivia, - reason: "Unused reference \(entry.name) in a capture list should be removed." - ) - ) + violations.append(entry.item.positionAfterSkippingLeadingTrivia) } } } diff --git a/Source/SwiftLintFramework/Rules/Lint/UnusedClosureParameterRule.swift b/Source/SwiftLintFramework/Rules/Lint/UnusedClosureParameterRule.swift index b16019cbc..160482820 100644 --- a/Source/SwiftLintFramework/Rules/Lint/UnusedClosureParameterRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/UnusedClosureParameterRule.swift @@ -9,7 +9,7 @@ struct UnusedClosureParameterRule: SwiftSyntaxCorrectableRule, ConfigurationProv static let description = RuleDescription( identifier: "unused_closure_parameter", name: "Unused Closure Parameter", - description: "Unused parameter in a closure should be replaced with _.", + description: "Unused parameter in a closure should be replaced with _", kind: .lint, nonTriggeringExamples: UnusedClosureParameterRuleExamples.nonTriggering, triggeringExamples: UnusedClosureParameterRuleExamples.triggering, @@ -40,11 +40,7 @@ private extension UnusedClosureParameterRule { .walk(tree: node.statements, handler: \.identifiers) for parameter in namedParameters where !referencedIdentifiers.contains(parameter.name) { - let violation = ReasonedRuleViolation( - position: parameter.position, - reason: #"Unused parameter "\#(parameter.name)" in a closure should be replaced with _."# - ) - violations.append(violation) + violations.append(parameter.position) } } } diff --git a/Source/SwiftLintFramework/Rules/Lint/UnusedControlFlowLabelRule.swift b/Source/SwiftLintFramework/Rules/Lint/UnusedControlFlowLabelRule.swift index 094e4fc91..afb865e1c 100644 --- a/Source/SwiftLintFramework/Rules/Lint/UnusedControlFlowLabelRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/UnusedControlFlowLabelRule.swift @@ -8,7 +8,7 @@ struct UnusedControlFlowLabelRule: SwiftSyntaxCorrectableRule, ConfigurationProv static let description = RuleDescription( identifier: "unused_control_flow_label", name: "Unused Control Flow Label", - description: "Unused control flow label should be removed.", + description: "Unused control flow label should be removed", kind: .lint, nonTriggeringExamples: [ Example("loop: while true { break loop }"), diff --git a/Source/SwiftLintFramework/Rules/Lint/UnusedDeclarationRule.swift b/Source/SwiftLintFramework/Rules/Lint/UnusedDeclarationRule.swift index ca51c0c6d..9391977ba 100644 --- a/Source/SwiftLintFramework/Rules/Lint/UnusedDeclarationRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/UnusedDeclarationRule.swift @@ -27,7 +27,7 @@ struct UnusedDeclarationRule: ConfigurationProviderRule, AnalyzerRule, Collectin static let description = RuleDescription( identifier: "unused_declaration", name: "Unused Declaration", - description: "Declarations should be referenced at least once within all files linted.", + description: "Declarations should be referenced at least once within all files linted", kind: .lint, nonTriggeringExamples: UnusedDeclarationRuleExamples.nonTriggeringExamples, triggeringExamples: UnusedDeclarationRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Lint/UnusedImportRule.swift b/Source/SwiftLintFramework/Rules/Lint/UnusedImportRule.swift index 28594e5fb..8c008068c 100644 --- a/Source/SwiftLintFramework/Rules/Lint/UnusedImportRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/UnusedImportRule.swift @@ -12,7 +12,7 @@ struct UnusedImportRule: CorrectableRule, ConfigurationProviderRule, AnalyzerRul static let description = RuleDescription( identifier: "unused_import", name: "Unused Import", - description: "All imported modules should be required to make the file compile.", + description: "All imported modules should be required to make the file compile", kind: .lint, nonTriggeringExamples: UnusedImportRuleExamples.nonTriggeringExamples, triggeringExamples: UnusedImportRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Lint/UnusedSetterValueRule.swift b/Source/SwiftLintFramework/Rules/Lint/UnusedSetterValueRule.swift index 6906f226a..cb8269794 100644 --- a/Source/SwiftLintFramework/Rules/Lint/UnusedSetterValueRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/UnusedSetterValueRule.swift @@ -8,7 +8,7 @@ struct UnusedSetterValueRule: ConfigurationProviderRule, SwiftSyntaxRule { static let description = RuleDescription( identifier: "unused_setter_value", name: "Unused Setter Value", - description: "Setter value is not used.", + description: "Setter value is not used", kind: .lint, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Lint/WeakDelegateRule.swift b/Source/SwiftLintFramework/Rules/Lint/WeakDelegateRule.swift index a08085454..e67998ecb 100644 --- a/Source/SwiftLintFramework/Rules/Lint/WeakDelegateRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/WeakDelegateRule.swift @@ -8,7 +8,7 @@ struct WeakDelegateRule: OptInRule, SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "weak_delegate", name: "Weak Delegate", - description: "Delegates should be weak to avoid reference cycles.", + description: "Delegates should be weak to avoid reference cycles", kind: .lint, nonTriggeringExamples: [ Example("class Foo {\n weak var delegate: SomeProtocol?\n}\n"), diff --git a/Source/SwiftLintFramework/Rules/Lint/YodaConditionRule.swift b/Source/SwiftLintFramework/Rules/Lint/YodaConditionRule.swift index 40b0f5b41..39a3c0475 100644 --- a/Source/SwiftLintFramework/Rules/Lint/YodaConditionRule.swift +++ b/Source/SwiftLintFramework/Rules/Lint/YodaConditionRule.swift @@ -8,7 +8,7 @@ struct YodaConditionRule: OptInRule, ConfigurationProviderRule, SwiftSyntaxRule static let description = RuleDescription( identifier: "yoda_condition", name: "Yoda Condition", - description: "The constant literal should be placed on the right-hand side of the comparison operator.", + description: "The constant literal should be placed on the right-hand side of the comparison operator", kind: .lint, nonTriggeringExamples: [ Example("if foo == 42 {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Metrics/ClosureBodyLengthRule.swift b/Source/SwiftLintFramework/Rules/Metrics/ClosureBodyLengthRule.swift index e1870f26e..15ce4e846 100644 --- a/Source/SwiftLintFramework/Rules/Metrics/ClosureBodyLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/Metrics/ClosureBodyLengthRule.swift @@ -6,7 +6,7 @@ struct ClosureBodyLengthRule: OptInRule, SwiftSyntaxRule, ConfigurationProviderR static let description = RuleDescription( identifier: "closure_body_length", name: "Closure Body Length", - description: "Closure bodies should not span too many lines.", + description: "Closure bodies should not span too many lines", kind: .metrics, nonTriggeringExamples: ClosureBodyLengthRuleExamples.nonTriggeringExamples, triggeringExamples: ClosureBodyLengthRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Metrics/CyclomaticComplexityRule.swift b/Source/SwiftLintFramework/Rules/Metrics/CyclomaticComplexityRule.swift index 4a4da1e56..67a0c88b1 100644 --- a/Source/SwiftLintFramework/Rules/Metrics/CyclomaticComplexityRule.swift +++ b/Source/SwiftLintFramework/Rules/Metrics/CyclomaticComplexityRule.swift @@ -82,8 +82,8 @@ struct CyclomaticComplexityRule: ASTRule, ConfigurationProviderRule { for parameter in configuration.params where complexity > parameter.value { let offset = dictionary.offset ?? 0 - let reason = "Function should have complexity \(configuration.length.warning) or less: " + - "currently complexity equals \(complexity)" + let reason = "Function should have complexity \(configuration.length.warning) or less; " + + "currently complexity is \(complexity)" return [StyleViolation(ruleDescription: Self.description, severity: parameter.severity, location: Location(file: file, byteOffset: offset), diff --git a/Source/SwiftLintFramework/Rules/Metrics/EnumCaseAssociatedValuesLengthRule.swift b/Source/SwiftLintFramework/Rules/Metrics/EnumCaseAssociatedValuesLengthRule.swift index 8d5f323a6..350c471cc 100644 --- a/Source/SwiftLintFramework/Rules/Metrics/EnumCaseAssociatedValuesLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/Metrics/EnumCaseAssociatedValuesLengthRule.swift @@ -8,7 +8,7 @@ struct EnumCaseAssociatedValuesLengthRule: SwiftSyntaxRule, OptInRule, Configura static let description = RuleDescription( identifier: "enum_case_associated_values_count", name: "Enum Case Associated Values Count", - description: "Number of associated values in an enum case should be low", + description: "The number of associated values in an enum case should be low.", kind: .metrics, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Metrics/FunctionBodyLengthRule.swift b/Source/SwiftLintFramework/Rules/Metrics/FunctionBodyLengthRule.swift index 6aa52cb46..69aa5b7b9 100644 --- a/Source/SwiftLintFramework/Rules/Metrics/FunctionBodyLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/Metrics/FunctionBodyLengthRule.swift @@ -6,7 +6,7 @@ struct FunctionBodyLengthRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "function_body_length", name: "Function Body Length", - description: "Functions bodies should not span too many lines.", + description: "Functions bodies should not span too many lines", kind: .metrics ) diff --git a/Source/SwiftLintFramework/Rules/Metrics/LargeTupleRule.swift b/Source/SwiftLintFramework/Rules/Metrics/LargeTupleRule.swift index 46488db9f..2b6f09bae 100644 --- a/Source/SwiftLintFramework/Rules/Metrics/LargeTupleRule.swift +++ b/Source/SwiftLintFramework/Rules/Metrics/LargeTupleRule.swift @@ -20,7 +20,7 @@ struct LargeTupleRule: SourceKitFreeRule, ConfigurationProviderRule { .sorted(by: { $0.position < $1.position }) .compactMap { position, size in for parameter in configuration.params where size > parameter.value { - let reason = "Tuples should have at most \(configuration.warning) members." + let reason = "Tuples should have at most \(configuration.warning) members" return StyleViolation(ruleDescription: Self.description, severity: parameter.severity, location: Location(file: file, position: position), diff --git a/Source/SwiftLintFramework/Rules/Metrics/LineLengthRule.swift b/Source/SwiftLintFramework/Rules/Metrics/LineLengthRule.swift index 509ddc161..f3abe7838 100644 --- a/Source/SwiftLintFramework/Rules/Metrics/LineLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/Metrics/LineLengthRule.swift @@ -76,7 +76,7 @@ struct LineLengthRule: ConfigurationProviderRule { let length = strippedString.count for param in configuration.params where length > param.value { - let reason = "Line should be \(param.value) characters or less: currently \(length) characters" + let reason = "Line should be \(param.value) characters or less; currently it has \(length) characters" return StyleViolation(ruleDescription: Self.description, severity: param.severity, location: Location(file: file.path, line: line.index), diff --git a/Source/SwiftLintFramework/Rules/Metrics/TypeBodyLengthRule.swift b/Source/SwiftLintFramework/Rules/Metrics/TypeBodyLengthRule.swift index 388140f4c..205173c35 100644 --- a/Source/SwiftLintFramework/Rules/Metrics/TypeBodyLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/Metrics/TypeBodyLengthRule.swift @@ -18,7 +18,7 @@ struct TypeBodyLengthRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "type_body_length", name: "Type Body Length", - description: "Type bodies should not span too many lines.", + description: "Type bodies should not span too many lines", kind: .metrics, nonTriggeringExamples: ["class", "struct", "enum", "actor"].flatMap({ type in [ diff --git a/Source/SwiftLintFramework/Rules/Performance/ContainsOverFilterCountRule.swift b/Source/SwiftLintFramework/Rules/Performance/ContainsOverFilterCountRule.swift index e40495216..d230799d5 100644 --- a/Source/SwiftLintFramework/Rules/Performance/ContainsOverFilterCountRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/ContainsOverFilterCountRule.swift @@ -8,7 +8,7 @@ struct ContainsOverFilterCountRule: SwiftSyntaxRule, OptInRule, ConfigurationPro static let description = RuleDescription( identifier: "contains_over_filter_count", name: "Contains over Filter Count", - description: "Prefer `contains` over comparing `filter(where:).count` to 0.", + description: "Prefer `contains` over comparing `filter(where:).count` to 0", kind: .performance, nonTriggeringExamples: [">", "==", "!="].flatMap { operation in return [ diff --git a/Source/SwiftLintFramework/Rules/Performance/ContainsOverRangeNilComparisonRule.swift b/Source/SwiftLintFramework/Rules/Performance/ContainsOverRangeNilComparisonRule.swift index 7799ae6eb..e2d1159fe 100644 --- a/Source/SwiftLintFramework/Rules/Performance/ContainsOverRangeNilComparisonRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/ContainsOverRangeNilComparisonRule.swift @@ -8,7 +8,7 @@ struct ContainsOverRangeNilComparisonRule: SwiftSyntaxRule, OptInRule, Configura static let description = RuleDescription( identifier: "contains_over_range_nil_comparison", name: "Contains over Range Comparision to Nil", - description: "Prefer `contains` over `range(of:) != nil` and `range(of:) == nil`.", + description: "Prefer `contains` over `range(of:) != nil` and `range(of:) == nil`", kind: .performance, nonTriggeringExamples: [ Example("let range = myString.range(of: \"Test\")"), diff --git a/Source/SwiftLintFramework/Rules/Performance/EmptyCollectionLiteralRule.swift b/Source/SwiftLintFramework/Rules/Performance/EmptyCollectionLiteralRule.swift index 06d58a77a..8ef25f353 100644 --- a/Source/SwiftLintFramework/Rules/Performance/EmptyCollectionLiteralRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/EmptyCollectionLiteralRule.swift @@ -8,7 +8,7 @@ struct EmptyCollectionLiteralRule: SwiftSyntaxRule, ConfigurationProviderRule, O static let description = RuleDescription( identifier: "empty_collection_literal", name: "Empty Collection Literal", - description: "Prefer checking `isEmpty` over comparing collection to an empty array or dictionary literal.", + description: "Prefer checking `isEmpty` over comparing collection to an empty array or dictionary literal", kind: .performance, nonTriggeringExamples: [ Example("myArray = []"), diff --git a/Source/SwiftLintFramework/Rules/Performance/EmptyCountRule.swift b/Source/SwiftLintFramework/Rules/Performance/EmptyCountRule.swift index 3bb3787e8..223d7b6b2 100644 --- a/Source/SwiftLintFramework/Rules/Performance/EmptyCountRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/EmptyCountRule.swift @@ -8,7 +8,7 @@ struct EmptyCountRule: ConfigurationProviderRule, OptInRule, SwiftSyntaxRule { static let description = RuleDescription( identifier: "empty_count", name: "Empty Count", - description: "Prefer checking `isEmpty` over comparing `count` to zero.", + description: "Prefer checking `isEmpty` over comparing `count` to zero", kind: .performance, nonTriggeringExamples: [ Example("var count = 0\n"), diff --git a/Source/SwiftLintFramework/Rules/Performance/EmptyStringRule.swift b/Source/SwiftLintFramework/Rules/Performance/EmptyStringRule.swift index b6959bca8..e87418643 100644 --- a/Source/SwiftLintFramework/Rules/Performance/EmptyStringRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/EmptyStringRule.swift @@ -8,7 +8,7 @@ struct EmptyStringRule: ConfigurationProviderRule, OptInRule, SwiftSyntaxRule { static let description = RuleDescription( identifier: "empty_string", name: "Empty String", - description: "Prefer checking `isEmpty` over comparing `string` to an empty string literal.", + description: "Prefer checking `isEmpty` over comparing `string` to an empty string literal", kind: .performance, nonTriggeringExamples: [ Example("myString.isEmpty"), diff --git a/Source/SwiftLintFramework/Rules/Performance/FirstWhereRule.swift b/Source/SwiftLintFramework/Rules/Performance/FirstWhereRule.swift index a8f119df2..eb3a81c25 100644 --- a/Source/SwiftLintFramework/Rules/Performance/FirstWhereRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/FirstWhereRule.swift @@ -8,7 +8,7 @@ struct FirstWhereRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "first_where", name: "First Where", - description: "Prefer using `.first(where:)` over `.filter { }.first` in collections.", + description: "Prefer using `.first(where:)` over `.filter { }.first` in collections", kind: .performance, nonTriggeringExamples: [ Example("kinds.filter(excludingKinds.contains).isEmpty && kinds.first == .identifier\n"), diff --git a/Source/SwiftLintFramework/Rules/Performance/FlatMapOverMapReduceRule.swift b/Source/SwiftLintFramework/Rules/Performance/FlatMapOverMapReduceRule.swift index ace63ac12..afaf81fd2 100644 --- a/Source/SwiftLintFramework/Rules/Performance/FlatMapOverMapReduceRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/FlatMapOverMapReduceRule.swift @@ -8,7 +8,7 @@ struct FlatMapOverMapReduceRule: SwiftSyntaxRule, OptInRule, ConfigurationProvid static let description = RuleDescription( identifier: "flatmap_over_map_reduce", name: "Flat Map over Map Reduce", - description: "Prefer `flatMap` over `map` followed by `reduce([], +)`.", + description: "Prefer `flatMap` over `map` followed by `reduce([], +)`", kind: .performance, nonTriggeringExamples: [ Example("let foo = bar.map { $0.count }.reduce(0, +)"), diff --git a/Source/SwiftLintFramework/Rules/Performance/LastWhereRule.swift b/Source/SwiftLintFramework/Rules/Performance/LastWhereRule.swift index eee744e00..eefc604b7 100644 --- a/Source/SwiftLintFramework/Rules/Performance/LastWhereRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/LastWhereRule.swift @@ -8,7 +8,7 @@ struct LastWhereRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "last_where", name: "Last Where", - description: "Prefer using `.last(where:)` over `.filter { }.last` in collections.", + description: "Prefer using `.last(where:)` over `.filter { }.last` in collections", kind: .performance, nonTriggeringExamples: [ Example("kinds.filter(excludingKinds.contains).isEmpty && kinds.last == .identifier\n"), diff --git a/Source/SwiftLintFramework/Rules/Performance/ReduceBooleanRule.swift b/Source/SwiftLintFramework/Rules/Performance/ReduceBooleanRule.swift index 0a17282d1..7603db7ee 100644 --- a/Source/SwiftLintFramework/Rules/Performance/ReduceBooleanRule.swift +++ b/Source/SwiftLintFramework/Rules/Performance/ReduceBooleanRule.swift @@ -8,7 +8,7 @@ struct ReduceBooleanRule: SwiftSyntaxRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "reduce_boolean", name: "Reduce Boolean", - description: "Prefer using `.allSatisfy()` or `.contains()` over `reduce(true)` or `reduce(false)`", + description: "Prefer using `.allSatisfy()` or `.contains()` over `reduce(true)` or `reduce(false)`.", kind: .performance, nonTriggeringExamples: [ Example("nums.reduce(0) { $0.0 + $0.1 }"), diff --git a/Source/SwiftLintFramework/Rules/RuleConfigurations/RegexConfiguration.swift b/Source/SwiftLintFramework/Rules/RuleConfigurations/RegexConfiguration.swift index 5e12fbb20..a1d8e2592 100644 --- a/Source/SwiftLintFramework/Rules/RuleConfigurations/RegexConfiguration.swift +++ b/Source/SwiftLintFramework/Rules/RuleConfigurations/RegexConfiguration.swift @@ -4,7 +4,7 @@ import SourceKittenFramework public struct RegexConfiguration: SeverityBasedRuleConfiguration, Hashable, CacheDescriptionProvider { public let identifier: String public var name: String? - public var message = "Regex matched." + public var message = "Regex matched" public var regex: NSRegularExpression! public var included: [NSRegularExpression] = [] public var excluded: [NSRegularExpression] = [] diff --git a/Source/SwiftLintFramework/Rules/Style/AttributesRule.swift b/Source/SwiftLintFramework/Rules/Style/AttributesRule.swift index 8e8114d93..fc32ce7cd 100644 --- a/Source/SwiftLintFramework/Rules/Style/AttributesRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/AttributesRule.swift @@ -10,7 +10,7 @@ struct AttributesRule: SwiftSyntaxRule, OptInRule, ConfigurationProviderRule { name: "Attributes", description: """ Attributes should be on their own lines in functions and types, but on the same line as variables and \ - imports. + imports """, kind: .style, nonTriggeringExamples: AttributesRuleExamples.nonTriggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Style/ClosingBraceRule.swift b/Source/SwiftLintFramework/Rules/Style/ClosingBraceRule.swift index c0e527d14..df62c13fc 100644 --- a/Source/SwiftLintFramework/Rules/Style/ClosingBraceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ClosingBraceRule.swift @@ -8,7 +8,7 @@ struct ClosingBraceRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "closing_brace", name: "Closing Brace Spacing", - description: "Closing brace with closing parenthesis should not have any whitespaces in the middle.", + description: "Closing brace with closing parenthesis should not have any whitespaces in the middle", kind: .style, nonTriggeringExamples: [ Example("[].map({ })"), diff --git a/Source/SwiftLintFramework/Rules/Style/ClosureEndIndentationRule.swift b/Source/SwiftLintFramework/Rules/Style/ClosureEndIndentationRule.swift index b7bf6db62..747990954 100644 --- a/Source/SwiftLintFramework/Rules/Style/ClosureEndIndentationRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ClosureEndIndentationRule.swift @@ -25,9 +25,9 @@ struct ClosureEndIndentationRule: Rule, OptInRule, ConfigurationProviderRule { } private func styleViolation(for violation: Violation, in file: SwiftLintFile) -> StyleViolation { - let reason = "Closure end should have the same indentation as the line that started it. " + - "Expected \(violation.indentationRanges.expected.length), " + - "got \(violation.indentationRanges.actual.length)." + let reason = "Closure end should have the same indentation as the line that started it; " + + "expected \(violation.indentationRanges.expected.length), " + + "got \(violation.indentationRanges.actual.length)" return StyleViolation(ruleDescription: Self.description, severity: configuration.severity, diff --git a/Source/SwiftLintFramework/Rules/Style/ClosureParameterPositionRule.swift b/Source/SwiftLintFramework/Rules/Style/ClosureParameterPositionRule.swift index ee38a265d..d708a0318 100644 --- a/Source/SwiftLintFramework/Rules/Style/ClosureParameterPositionRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ClosureParameterPositionRule.swift @@ -8,7 +8,7 @@ struct ClosureParameterPositionRule: SwiftSyntaxRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "closure_parameter_position", name: "Closure Parameter Position", - description: "Closure parameters should be on the same line as opening brace.", + description: "Closure parameters should be on the same line as opening brace", kind: .style, nonTriggeringExamples: [ Example("[1, 2].map { $0 + 1 }\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/ClosureSpacingRule.swift b/Source/SwiftLintFramework/Rules/Style/ClosureSpacingRule.swift index d40c02474..411c1a963 100644 --- a/Source/SwiftLintFramework/Rules/Style/ClosureSpacingRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ClosureSpacingRule.swift @@ -10,7 +10,7 @@ struct ClosureSpacingRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRule static let description = RuleDescription( identifier: "closure_spacing", name: "Closure Spacing", - description: "Closure expressions should have a single space inside each brace.", + description: "Closure expressions should have a single space inside each brace", kind: .style, nonTriggeringExamples: [ Example("[].map ({ $0.description })"), diff --git a/Source/SwiftLintFramework/Rules/Style/ColonRule.swift b/Source/SwiftLintFramework/Rules/Style/ColonRule.swift index 8014718be..c6699b365 100644 --- a/Source/SwiftLintFramework/Rules/Style/ColonRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ColonRule.swift @@ -11,7 +11,7 @@ struct ColonRule: SubstitutionCorrectableRule, ConfigurationProviderRule, Source identifier: "colon", name: "Colon Spacing", description: """ - Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. + Colons should be next to the identifier when specifying a type and next to the key in dictionary literals """, kind: .style, nonTriggeringExamples: ColonRuleExamples.nonTriggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Style/CommaRule.swift b/Source/SwiftLintFramework/Rules/Style/CommaRule.swift index 9b6e8a143..3ec9fe0f8 100644 --- a/Source/SwiftLintFramework/Rules/Style/CommaRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/CommaRule.swift @@ -10,7 +10,7 @@ struct CommaRule: CorrectableRule, ConfigurationProviderRule, SourceKitFreeRule static let description = RuleDescription( identifier: "comma", name: "Comma Spacing", - description: "There should be no space before and one after any comma.", + description: "There should be no space before and one after any comma", kind: .style, nonTriggeringExamples: [ Example("func abc(a: String, b: String) { }"), diff --git a/Source/SwiftLintFramework/Rules/Style/ComputedAccessorsOrderRule.swift b/Source/SwiftLintFramework/Rules/Style/ComputedAccessorsOrderRule.swift index 6bec813cb..aa86ec32d 100644 --- a/Source/SwiftLintFramework/Rules/Style/ComputedAccessorsOrderRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ComputedAccessorsOrderRule.swift @@ -56,7 +56,7 @@ private final class ComputedAccessorsOrderRuleVisitor: ViolationsSyntaxVisitor { case .setGet: orderString = "setter and then the getter" } - return "Computed \(kindString) should declare first the \(orderString)." + return "Computed \(kindString) should first declare the \(orderString)" } } diff --git a/Source/SwiftLintFramework/Rules/Style/ControlStatementRule.swift b/Source/SwiftLintFramework/Rules/Style/ControlStatementRule.swift index e96137dd9..96a553a24 100644 --- a/Source/SwiftLintFramework/Rules/Style/ControlStatementRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ControlStatementRule.swift @@ -11,7 +11,7 @@ struct ControlStatementRule: ConfigurationProviderRule, SubstitutionCorrectableR name: "Control Statement", description: "`if`, `for`, `guard`, `switch`, `while`, and `catch` statements shouldn't unnecessarily wrap their " + - "conditionals or arguments in parentheses.", + "conditionals or arguments in parentheses", kind: .style, nonTriggeringExamples: [ Example("if condition {\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/EmptyEnumArgumentsRule.swift b/Source/SwiftLintFramework/Rules/Style/EmptyEnumArgumentsRule.swift index 72b20d043..9a334a3c8 100644 --- a/Source/SwiftLintFramework/Rules/Style/EmptyEnumArgumentsRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/EmptyEnumArgumentsRule.swift @@ -31,7 +31,7 @@ struct EmptyEnumArgumentsRule: SwiftSyntaxCorrectableRule, ConfigurationProvider static let description = RuleDescription( identifier: "empty_enum_arguments", name: "Empty Enum Arguments", - description: "Arguments can be omitted when matching enums with associated values if they are not used.", + description: "Arguments can be omitted when matching enums with associated values if they are not used", kind: .style, nonTriggeringExamples: [ wrapInSwitch("case .bar"), diff --git a/Source/SwiftLintFramework/Rules/Style/EmptyParametersRule.swift b/Source/SwiftLintFramework/Rules/Style/EmptyParametersRule.swift index 528506693..64248d790 100644 --- a/Source/SwiftLintFramework/Rules/Style/EmptyParametersRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/EmptyParametersRule.swift @@ -8,7 +8,7 @@ struct EmptyParametersRule: SwiftSyntaxCorrectableRule, ConfigurationProviderRul static let description = RuleDescription( identifier: "empty_parameters", name: "Empty Parameters", - description: "Prefer `() -> ` over `Void -> `.", + description: "Prefer `() -> ` over `Void -> `", kind: .style, nonTriggeringExamples: [ Example("let abc: () -> Void = {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/EmptyParenthesesWithTrailingClosureRule.swift b/Source/SwiftLintFramework/Rules/Style/EmptyParenthesesWithTrailingClosureRule.swift index d538f64cc..80b3a0d0e 100644 --- a/Source/SwiftLintFramework/Rules/Style/EmptyParenthesesWithTrailingClosureRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/EmptyParenthesesWithTrailingClosureRule.swift @@ -9,7 +9,7 @@ struct EmptyParenthesesWithTrailingClosureRule: SwiftSyntaxCorrectableRule, Conf identifier: "empty_parentheses_with_trailing_closure", name: "Empty Parentheses with Trailing Closure", description: "When using trailing closures, empty parentheses should be avoided " + - "after the method call.", + "after the method call", kind: .style, nonTriggeringExamples: [ Example("[1, 2].map { $0 + 1 }\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/ExplicitSelfRule.swift b/Source/SwiftLintFramework/Rules/Style/ExplicitSelfRule.swift index 9047f6a90..18c197b31 100644 --- a/Source/SwiftLintFramework/Rules/Style/ExplicitSelfRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ExplicitSelfRule.swift @@ -9,7 +9,7 @@ struct ExplicitSelfRule: CorrectableRule, ConfigurationProviderRule, AnalyzerRul static let description = RuleDescription( identifier: "explicit_self", name: "Explicit Self", - description: "Instance variables and functions should be explicitly accessed with 'self.'.", + description: "Instance variables and functions should be explicitly accessed with 'self.'", kind: .style, nonTriggeringExamples: ExplicitSelfRuleExamples.nonTriggeringExamples, triggeringExamples: ExplicitSelfRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Style/FileHeaderRule.swift b/Source/SwiftLintFramework/Rules/Style/FileHeaderRule.swift index b3e59f263..f150b48f9 100644 --- a/Source/SwiftLintFramework/Rules/Style/FileHeaderRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/FileHeaderRule.swift @@ -33,8 +33,6 @@ struct FileHeaderRule: ConfigurationProviderRule, OptInRule { ].skipWrappingInCommentTests() ) - private static let reason = "Header comments should be consistent with project patterns." - func validate(file: SwiftLintFile) -> [StyleViolation] { var firstToken: SwiftLintSyntaxToken? var lastToken: SwiftLintSyntaxToken? @@ -102,7 +100,7 @@ struct FileHeaderRule: ConfigurationProviderRule, OptInRule { return StyleViolation(ruleDescription: Self.description, severity: configuration.severityConfiguration.severity, location: location, - reason: Self.reason) + reason: "Header comments should be consistent with project patterns") } } diff --git a/Source/SwiftLintFramework/Rules/Style/FileTypesOrderRule.swift b/Source/SwiftLintFramework/Rules/Style/FileTypesOrderRule.swift index f7b84d3e0..f781469ae 100644 --- a/Source/SwiftLintFramework/Rules/Style/FileTypesOrderRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/FileTypesOrderRule.swift @@ -83,7 +83,7 @@ struct FileTypesOrderRule: ConfigurationProviderRule, OptInRule { ruleDescription: Self.description, severity: configuration.severityConfiguration.severity, location: Location(file: file, byteOffset: fileTypeOffset.offset), - reason: "\(article) '\(fileType)' should not be placed amongst the file type(s) '\(expected)'." + reason: "\(article) '\(fileType)' should not be placed amongst the file type(s) '\(expected)'" ) violations.append(styleViolation) } diff --git a/Source/SwiftLintFramework/Rules/Style/ImplicitGetterRule.swift b/Source/SwiftLintFramework/Rules/Style/ImplicitGetterRule.swift index a1c915c42..8e7dae6f3 100644 --- a/Source/SwiftLintFramework/Rules/Style/ImplicitGetterRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ImplicitGetterRule.swift @@ -26,9 +26,9 @@ private final class ImplicitGetterRuleVisitor: ViolationsSyntaxVisitor { var violationDescription: String { switch self { case .subscript: - return "Computed read-only subscripts should avoid using the get keyword." + return "Computed read-only subscripts should avoid using the get keyword" case .property: - return "Computed read-only properties should avoid using the get keyword." + return "Computed read-only properties should avoid using the get keyword" } } } diff --git a/Source/SwiftLintFramework/Rules/Style/ImplicitReturnRule.swift b/Source/SwiftLintFramework/Rules/Style/ImplicitReturnRule.swift index 997e03f67..e0c37ad62 100644 --- a/Source/SwiftLintFramework/Rules/Style/ImplicitReturnRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ImplicitReturnRule.swift @@ -9,7 +9,7 @@ struct ImplicitReturnRule: ConfigurationProviderRule, SubstitutionCorrectableRul static let description = RuleDescription( identifier: "implicit_return", name: "Implicit Return", - description: "Prefer implicit returns in closures, functions and getters.", + description: "Prefer implicit returns in closures, functions and getters", kind: .style, nonTriggeringExamples: ImplicitReturnRuleExamples.nonTriggeringExamples, triggeringExamples: ImplicitReturnRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Style/InclusiveLanguageRule.swift b/Source/SwiftLintFramework/Rules/Style/InclusiveLanguageRule.swift index 9b51e1f4d..5c03f84cd 100644 --- a/Source/SwiftLintFramework/Rules/Style/InclusiveLanguageRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/InclusiveLanguageRule.swift @@ -10,7 +10,7 @@ struct InclusiveLanguageRule: SwiftSyntaxRule, ConfigurationProviderRule { name: "Inclusive Language", description: """ Identifiers should use inclusive language that avoids discrimination against groups of people based on \ - race, gender, or socioeconomic status + race, gender, or socioeconomic status. """, kind: .style, nonTriggeringExamples: InclusiveLanguageRuleExamples.nonTriggeringExamples, @@ -126,7 +126,7 @@ private extension InclusiveLanguageRule { return ReasonedRuleViolation( position: node.positionAfterSkippingLeadingTrivia, - reason: "Declaration \(name) contains the term \"\(term)\" which is not considered inclusive." + reason: "Declaration \(name) contains the term \"\(term)\" which is not considered inclusive" ) } diff --git a/Source/SwiftLintFramework/Rules/Style/IndentationWidthRule.swift b/Source/SwiftLintFramework/Rules/Style/IndentationWidthRule.swift index 0b118d55d..a37a6ce5d 100644 --- a/Source/SwiftLintFramework/Rules/Style/IndentationWidthRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/IndentationWidthRule.swift @@ -75,7 +75,7 @@ struct IndentationWidthRule: ConfigurationProviderRule, OptInRule { severity: configuration.severityConfiguration.severity, 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." + "\(configuration.indentationWidth) spaces, but not both in the same line" ) ) @@ -98,7 +98,7 @@ struct IndentationWidthRule: ConfigurationProviderRule, OptInRule { ruleDescription: Self.description, severity: configuration.severityConfiguration.severity, location: Location(file: file, characterOffset: line.range.location), - reason: "The first line shall not be indented." + reason: "The first line shall not be indented" ) ) } @@ -124,8 +124,8 @@ struct IndentationWidthRule: ConfigurationProviderRule, OptInRule { severity: configuration.severityConfiguration.severity, location: Location(file: file, characterOffset: line.range.location), reason: isIndentation ? - "Code should be indented using one tab or \(indentWidth) spaces." : - "Code should be unindented by multiples of one tab or multiples of \(indentWidth) spaces." + "Code should be indented using one tab or \(indentWidth) spaces" : + "Code should be unindented by multiples of one tab or multiples of \(indentWidth) spaces" ) ) } diff --git a/Source/SwiftLintFramework/Rules/Style/LeadingWhitespaceRule.swift b/Source/SwiftLintFramework/Rules/Style/LeadingWhitespaceRule.swift index cedd91fde..8e0edc0bb 100644 --- a/Source/SwiftLintFramework/Rules/Style/LeadingWhitespaceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/LeadingWhitespaceRule.swift @@ -9,7 +9,7 @@ struct LeadingWhitespaceRule: CorrectableRule, ConfigurationProviderRule, Source static let description = RuleDescription( identifier: "leading_whitespace", name: "Leading Whitespace", - description: "Files should not contain leading whitespace.", + description: "Files should not contain leading whitespace", kind: .style, nonTriggeringExamples: [ Example("//\n") @@ -29,13 +29,9 @@ struct LeadingWhitespaceRule: CorrectableRule, ConfigurationProviderRule, Source return [] } - let reason = "File shouldn't start with whitespace: " + - "currently starts with \(countOfLeadingWhitespace) whitespace characters" - return [StyleViolation(ruleDescription: Self.description, severity: configuration.severity, - location: Location(file: file.path, line: 1), - reason: reason)] + location: Location(file: file.path, line: 1))] } func correct(file: SwiftLintFile) -> [Correction] { diff --git a/Source/SwiftLintFramework/Rules/Style/LetVarWhitespaceRule.swift b/Source/SwiftLintFramework/Rules/Style/LetVarWhitespaceRule.swift index 1b400ca0a..d0178c782 100644 --- a/Source/SwiftLintFramework/Rules/Style/LetVarWhitespaceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/LetVarWhitespaceRule.swift @@ -9,7 +9,7 @@ struct LetVarWhitespaceRule: ConfigurationProviderRule, OptInRule { static let description = RuleDescription( identifier: "let_var_whitespace", name: "Variable Declaration Whitespace", - description: "Let and var should be separated from other statements by a blank line.", + description: "Let and var should be separated from other statements by a blank line", kind: .style, nonTriggeringExamples: [ Example("let a = 0\nvar x = 1\n\nx = 2\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/LiteralExpressionEndIdentationRule.swift b/Source/SwiftLintFramework/Rules/Style/LiteralExpressionEndIdentationRule.swift index cd4139e4e..a46aa9d1d 100644 --- a/Source/SwiftLintFramework/Rules/Style/LiteralExpressionEndIdentationRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/LiteralExpressionEndIdentationRule.swift @@ -9,7 +9,7 @@ struct LiteralExpressionEndIdentationRule: Rule, ConfigurationProviderRule, OptI static let description = RuleDescription( identifier: "literal_expression_end_indentation", name: "Literal Expression End Indentation", - description: "Array and dictionary literal end should have the same indentation as the line that started it.", + description: "Array and dictionary literal end should have the same indentation as the line that started it", kind: .style, nonTriggeringExamples: [ Example(""" @@ -130,9 +130,9 @@ struct LiteralExpressionEndIdentationRule: Rule, ConfigurationProviderRule, OptI } private func styleViolation(for violation: Violation, in file: SwiftLintFile) -> StyleViolation { - let reason = "\(Self.description.description) " + - "Expected \(violation.indentationRanges.expected.length), " + - "got \(violation.indentationRanges.actual.length)." + let reason = "\(Self.description.description); " + + "expected \(violation.indentationRanges.expected.length), " + + "got \(violation.indentationRanges.actual.length)" return StyleViolation(ruleDescription: Self.description, severity: configuration.severity, diff --git a/Source/SwiftLintFramework/Rules/Style/ModifierOrderRule.swift b/Source/SwiftLintFramework/Rules/Style/ModifierOrderRule.swift index 9e6db43d5..09be3bbc0 100644 --- a/Source/SwiftLintFramework/Rules/Style/ModifierOrderRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ModifierOrderRule.swift @@ -41,7 +41,7 @@ struct ModifierOrderRule: ASTRule, OptInRule, ConfigurationProviderRule, Correct if let first = violatingModifiers.first { let preferredModifier = first.0 let declaredModifier = first.1 - let reason = "\(preferredModifier.keyword) modifier should be before \(declaredModifier.keyword)." + let reason = "\(preferredModifier.keyword) modifier should come before \(declaredModifier.keyword)" return [ StyleViolation( ruleDescription: Self.description, diff --git a/Source/SwiftLintFramework/Rules/Style/MultilineArgumentsBracketsRule.swift b/Source/SwiftLintFramework/Rules/Style/MultilineArgumentsBracketsRule.swift index 1a8d6281b..dfc5d9ade 100644 --- a/Source/SwiftLintFramework/Rules/Style/MultilineArgumentsBracketsRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/MultilineArgumentsBracketsRule.swift @@ -8,7 +8,7 @@ struct MultilineArgumentsBracketsRule: SwiftSyntaxRule, OptInRule, Configuration static let description = RuleDescription( identifier: "multiline_arguments_brackets", name: "Multiline Arguments Brackets", - description: "Multiline arguments should have their surrounding brackets in a new line.", + description: "Multiline arguments should have their surrounding brackets in a new line", kind: .style, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Style/MultilineArgumentsRule.swift b/Source/SwiftLintFramework/Rules/Style/MultilineArgumentsRule.swift index c78b5932f..fb422f17d 100644 --- a/Source/SwiftLintFramework/Rules/Style/MultilineArgumentsRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/MultilineArgumentsRule.swift @@ -9,7 +9,7 @@ struct MultilineArgumentsRule: ASTRule, OptInRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "multiline_arguments", name: "Multiline Arguments", - description: "Arguments should be either on the same line, or one per line.", + description: "Arguments should be either on the same line, or one per line", kind: .style, nonTriggeringExamples: MultilineArgumentsRuleExamples.nonTriggeringExamples, triggeringExamples: MultilineArgumentsRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Style/MultilineFunctionChainsRule.swift b/Source/SwiftLintFramework/Rules/Style/MultilineFunctionChainsRule.swift index 9b6bafe32..59a77ac22 100644 --- a/Source/SwiftLintFramework/Rules/Style/MultilineFunctionChainsRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/MultilineFunctionChainsRule.swift @@ -9,7 +9,7 @@ struct MultilineFunctionChainsRule: ASTRule, OptInRule, ConfigurationProviderRul static let description = RuleDescription( identifier: "multiline_function_chains", name: "Multiline Function Chains", - description: "Chained function calls should be either on the same line, or one per line.", + description: "Chained function calls should be either on the same line, or one per line", kind: .style, nonTriggeringExamples: [ Example("let evenSquaresSum = [20, 17, 35, 4].filter { $0 % 2 == 0 }.map { $0 * $0 }.reduce(0, +)"), diff --git a/Source/SwiftLintFramework/Rules/Style/MultilineLiteralBracketsRule.swift b/Source/SwiftLintFramework/Rules/Style/MultilineLiteralBracketsRule.swift index fb1e5f2ad..3a2c1dcdb 100644 --- a/Source/SwiftLintFramework/Rules/Style/MultilineLiteralBracketsRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/MultilineLiteralBracketsRule.swift @@ -9,7 +9,7 @@ struct MultilineLiteralBracketsRule: ASTRule, OptInRule, ConfigurationProviderRu static let description = RuleDescription( identifier: "multiline_literal_brackets", name: "Multiline Literal Brackets", - description: "Multiline literals should have their surrounding brackets in a new line.", + description: "Multiline literals should have their surrounding brackets in a new line", kind: .style, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Style/MultilineParametersBracketsRule.swift b/Source/SwiftLintFramework/Rules/Style/MultilineParametersBracketsRule.swift index e837917a6..3fdbe5bfb 100644 --- a/Source/SwiftLintFramework/Rules/Style/MultilineParametersBracketsRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/MultilineParametersBracketsRule.swift @@ -9,7 +9,7 @@ struct MultilineParametersBracketsRule: OptInRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "multiline_parameters_brackets", name: "Multiline Parameters Brackets", - description: "Multiline parameters should have their surrounding brackets in a new line.", + description: "Multiline parameters should have their surrounding brackets in a new line", kind: .style, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Style/MultilineParametersRule.swift b/Source/SwiftLintFramework/Rules/Style/MultilineParametersRule.swift index 1df7f049f..04751271a 100644 --- a/Source/SwiftLintFramework/Rules/Style/MultilineParametersRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/MultilineParametersRule.swift @@ -8,7 +8,7 @@ struct MultilineParametersRule: SwiftSyntaxRule, OptInRule, ConfigurationProvide static let description = RuleDescription( identifier: "multiline_parameters", name: "Multiline Parameters", - description: "Functions and methods parameters should be either on the same line, or one per line.", + description: "Functions and methods parameters should be either on the same line, or one per line", kind: .style, nonTriggeringExamples: MultilineParametersRuleExamples.nonTriggeringExamples, triggeringExamples: MultilineParametersRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Style/MultipleClosuresWithTrailingClosureRule.swift b/Source/SwiftLintFramework/Rules/Style/MultipleClosuresWithTrailingClosureRule.swift index 8c2643e53..546e8660a 100644 --- a/Source/SwiftLintFramework/Rules/Style/MultipleClosuresWithTrailingClosureRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/MultipleClosuresWithTrailingClosureRule.swift @@ -8,7 +8,7 @@ struct MultipleClosuresWithTrailingClosureRule: SwiftSyntaxRule, ConfigurationPr static let description = RuleDescription( identifier: "multiple_closures_with_trailing_closure", name: "Multiple Closures with Trailing Closure", - description: "Trailing closure syntax should not be used when passing more than one closure argument.", + description: "Trailing closure syntax should not be used when passing more than one closure argument", kind: .style, nonTriggeringExamples: [ Example("foo.map { $0 + 1 }\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/NoSpaceInMethodCallRule.swift b/Source/SwiftLintFramework/Rules/Style/NoSpaceInMethodCallRule.swift index 036dbc044..547febf20 100644 --- a/Source/SwiftLintFramework/Rules/Style/NoSpaceInMethodCallRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/NoSpaceInMethodCallRule.swift @@ -8,7 +8,7 @@ struct NoSpaceInMethodCallRule: SwiftSyntaxCorrectableRule, ConfigurationProvide static let description = RuleDescription( identifier: "no_space_in_method_call", name: "No Space in Method Call", - description: "Don't add a space between the method name and the parentheses.", + description: "Don't add a space between the method name and the parentheses", kind: .style, nonTriggeringExamples: [ Example("foo()"), diff --git a/Source/SwiftLintFramework/Rules/Style/NumberSeparatorRule.swift b/Source/SwiftLintFramework/Rules/Style/NumberSeparatorRule.swift index 8a14b1815..937ab2c22 100644 --- a/Source/SwiftLintFramework/Rules/Style/NumberSeparatorRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/NumberSeparatorRule.swift @@ -13,7 +13,7 @@ struct NumberSeparatorRule: OptInRule, SwiftSyntaxCorrectableRule, Configuration static let description = RuleDescription( identifier: "number_separator", name: "Number Separator", - description: "Underscores should be used as thousand separator in large decimal numbers.", + description: "Underscores should be used as thousand separator in large decimal numbers", kind: .style, nonTriggeringExamples: NumberSeparatorRuleExamples.nonTriggeringExamples, triggeringExamples: NumberSeparatorRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Style/OpeningBraceRule.swift b/Source/SwiftLintFramework/Rules/Style/OpeningBraceRule.swift index c30456364..d38f27f1a 100644 --- a/Source/SwiftLintFramework/Rules/Style/OpeningBraceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/OpeningBraceRule.swift @@ -70,7 +70,7 @@ struct OpeningBraceRule: CorrectableRule, ConfigurationProviderRule { identifier: "opening_brace", name: "Opening Brace Spacing", description: "Opening braces should be preceded by a single space and on the same line " + - "as the declaration.", + "as the declaration", kind: .style, nonTriggeringExamples: [ Example("func abc() {\n}"), diff --git a/Source/SwiftLintFramework/Rules/Style/OperatorFunctionWhitespaceRule.swift b/Source/SwiftLintFramework/Rules/Style/OperatorFunctionWhitespaceRule.swift index 250a1dfff..1127aff6d 100644 --- a/Source/SwiftLintFramework/Rules/Style/OperatorFunctionWhitespaceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/OperatorFunctionWhitespaceRule.swift @@ -8,7 +8,7 @@ struct OperatorFunctionWhitespaceRule: ConfigurationProviderRule, SwiftSyntaxRul static let description = RuleDescription( identifier: "operator_whitespace", name: "Operator Function Whitespace", - description: "Operators should be surrounded by a single whitespace when defining them.", + description: "Operators should be surrounded by a single whitespace when defining them", kind: .style, nonTriggeringExamples: [ Example("func <| (lhs: Int, rhs: Int) -> Int {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/OperatorUsageWhitespaceRule.swift b/Source/SwiftLintFramework/Rules/Style/OperatorUsageWhitespaceRule.swift index 86148cfe5..25002cecf 100644 --- a/Source/SwiftLintFramework/Rules/Style/OperatorUsageWhitespaceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/OperatorUsageWhitespaceRule.swift @@ -10,7 +10,7 @@ struct OperatorUsageWhitespaceRule: OptInRule, CorrectableRule, ConfigurationPro static let description = RuleDescription( identifier: "operator_usage_whitespace", name: "Operator Usage Whitespace", - description: "Operators should be surrounded by a single whitespace when they are being used.", + description: "Operators should be surrounded by a single whitespace when they are being used", kind: .style, nonTriggeringExamples: OperatorUsageWhitespaceRuleExamples.nonTriggeringExamples, triggeringExamples: OperatorUsageWhitespaceRuleExamples.triggeringExamples, diff --git a/Source/SwiftLintFramework/Rules/Style/OptionalEnumCaseMatchingRule.swift b/Source/SwiftLintFramework/Rules/Style/OptionalEnumCaseMatchingRule.swift index f7b41495e..22f4cf36d 100644 --- a/Source/SwiftLintFramework/Rules/Style/OptionalEnumCaseMatchingRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/OptionalEnumCaseMatchingRule.swift @@ -8,7 +8,7 @@ struct OptionalEnumCaseMatchingRule: SwiftSyntaxCorrectableRule, ConfigurationPr static let description = RuleDescription( identifier: "optional_enum_case_matching", name: "Optional Enum Case Match", - description: "Matching an enum case against an optional enum without '?' is supported on Swift 5.1 and above.", + description: "Matching an enum case against an optional enum without '?' is supported on Swift 5.1 and above", kind: .style, minSwiftVersion: .fiveDotOne, nonTriggeringExamples: [ diff --git a/Source/SwiftLintFramework/Rules/Style/PreferSelfInStaticReferencesRule.swift b/Source/SwiftLintFramework/Rules/Style/PreferSelfInStaticReferencesRule.swift index af7ef9acf..dbb8484e0 100644 --- a/Source/SwiftLintFramework/Rules/Style/PreferSelfInStaticReferencesRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/PreferSelfInStaticReferencesRule.swift @@ -8,7 +8,7 @@ struct PreferSelfInStaticReferencesRule: SwiftSyntaxRule, CorrectableRule, Confi static var description = RuleDescription( identifier: "prefer_self_in_static_references", name: "Prefer Self in Static References", - description: "Use `Self` to refer to the surrounding type name.", + description: "Use `Self` to refer to the surrounding type name", kind: .style, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Style/PreferSelfTypeOverTypeOfSelfRule.swift b/Source/SwiftLintFramework/Rules/Style/PreferSelfTypeOverTypeOfSelfRule.swift index 95783d1c3..c6d22122e 100644 --- a/Source/SwiftLintFramework/Rules/Style/PreferSelfTypeOverTypeOfSelfRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/PreferSelfTypeOverTypeOfSelfRule.swift @@ -6,7 +6,7 @@ struct PreferSelfTypeOverTypeOfSelfRule: SwiftSyntaxCorrectableRule, OptInRule, static let description = RuleDescription( identifier: "prefer_self_type_over_type_of_self", name: "Prefer Self Type Over Type of Self", - description: "Prefer `Self` over `type(of: self)` when accessing properties or calling methods.", + description: "Prefer `Self` over `type(of: self)` when accessing properties or calling methods", kind: .style, minSwiftVersion: .fiveDotOne, nonTriggeringExamples: [ diff --git a/Source/SwiftLintFramework/Rules/Style/PrefixedTopLevelConstantRule.swift b/Source/SwiftLintFramework/Rules/Style/PrefixedTopLevelConstantRule.swift index 6b4a86d54..aa1f5a92d 100644 --- a/Source/SwiftLintFramework/Rules/Style/PrefixedTopLevelConstantRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/PrefixedTopLevelConstantRule.swift @@ -8,7 +8,7 @@ struct PrefixedTopLevelConstantRule: SwiftSyntaxRule, OptInRule, ConfigurationPr static let description = RuleDescription( identifier: "prefixed_toplevel_constant", name: "Prefixed Top-Level Constant", - description: "Top-level constants should be prefixed by `k`.", + description: "Top-level constants should be prefixed by `k`", kind: .style, nonTriggeringExamples: [ Example("private let kFoo = 20.0"), diff --git a/Source/SwiftLintFramework/Rules/Style/ProtocolPropertyAccessorsOrderRule.swift b/Source/SwiftLintFramework/Rules/Style/ProtocolPropertyAccessorsOrderRule.swift index 4f6b9121f..99d05682d 100644 --- a/Source/SwiftLintFramework/Rules/Style/ProtocolPropertyAccessorsOrderRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ProtocolPropertyAccessorsOrderRule.swift @@ -8,7 +8,7 @@ struct ProtocolPropertyAccessorsOrderRule: ConfigurationProviderRule, SwiftSynta static let description = RuleDescription( identifier: "protocol_property_accessors_order", name: "Protocol Property Accessors Order", - description: "When declaring properties in protocols, the order of accessors should be `get set`.", + description: "When declaring properties in protocols, the order of accessors should be `get set`", kind: .style, nonTriggeringExamples: [ Example("protocol Foo {\n var bar: String { get set }\n }"), diff --git a/Source/SwiftLintFramework/Rules/Style/RedundantDiscardableLetRule.swift b/Source/SwiftLintFramework/Rules/Style/RedundantDiscardableLetRule.swift index 94e7076fc..7d69ccba1 100644 --- a/Source/SwiftLintFramework/Rules/Style/RedundantDiscardableLetRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/RedundantDiscardableLetRule.swift @@ -8,7 +8,7 @@ struct RedundantDiscardableLetRule: SwiftSyntaxCorrectableRule, ConfigurationPro static let description = RuleDescription( identifier: "redundant_discardable_let", name: "Redundant Discardable Let", - description: "Prefer `_ = foo()` over `let _ = foo()` when discarding a result from a function.", + description: "Prefer `_ = foo()` over `let _ = foo()` when discarding a result from a function", kind: .style, nonTriggeringExamples: [ Example("_ = foo()\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/ReturnArrowWhitespaceRule.swift b/Source/SwiftLintFramework/Rules/Style/ReturnArrowWhitespaceRule.swift index e4c4682bf..0f9799151 100644 --- a/Source/SwiftLintFramework/Rules/Style/ReturnArrowWhitespaceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ReturnArrowWhitespaceRule.swift @@ -10,7 +10,7 @@ struct ReturnArrowWhitespaceRule: SwiftSyntaxRule, CorrectableRule, Configuratio identifier: "return_arrow_whitespace", name: "Returning Whitespace", description: "Return arrow and return type should be separated by a single space or on a " + - "separate line.", + "separate line", kind: .style, nonTriggeringExamples: [ Example("func abc() -> Int {}\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/ShorthandOperatorRule.swift b/Source/SwiftLintFramework/Rules/Style/ShorthandOperatorRule.swift index 3beea9a47..53474e86e 100644 --- a/Source/SwiftLintFramework/Rules/Style/ShorthandOperatorRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/ShorthandOperatorRule.swift @@ -8,7 +8,7 @@ struct ShorthandOperatorRule: ConfigurationProviderRule, SwiftSyntaxRule { static let description = RuleDescription( identifier: "shorthand_operator", name: "Shorthand Operator", - description: "Prefer shorthand operators (+=, -=, *=, /=) over doing the operation and assigning.", + description: "Prefer shorthand operators (+=, -=, *=, /=) over doing the operation and assigning", kind: .style, nonTriggeringExamples: allOperators.flatMap { operation in [ diff --git a/Source/SwiftLintFramework/Rules/Style/SingleTestClassRule.swift b/Source/SwiftLintFramework/Rules/Style/SingleTestClassRule.swift index 2440c493d..531bb7a75 100644 --- a/Source/SwiftLintFramework/Rules/Style/SingleTestClassRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/SingleTestClassRule.swift @@ -61,7 +61,7 @@ struct SingleTestClassRule: SourceKitFreeRule, OptInRule, ConfigurationProviderR return StyleViolation(ruleDescription: Self.description, severity: configuration.severity, location: Location(file: file, position: position.position), - reason: "\(classes.count) test classes found in this file.") + reason: "\(classes.count) test classes found in this file") } } } diff --git a/Source/SwiftLintFramework/Rules/Style/SortedImportsRule.swift b/Source/SwiftLintFramework/Rules/Style/SortedImportsRule.swift index 28da46ffc..d6f01d6df 100644 --- a/Source/SwiftLintFramework/Rules/Style/SortedImportsRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/SortedImportsRule.swift @@ -54,7 +54,7 @@ struct SortedImportsRule: CorrectableRule, ConfigurationProviderRule, OptInRule static let description = RuleDescription( identifier: "sorted_imports", name: "Sorted Imports", - description: "Imports should be sorted.", + description: "Imports should be sorted", kind: .style, nonTriggeringExamples: [ Example("import AAA\nimport BBB\nimport CCC\nimport DDD"), diff --git a/Source/SwiftLintFramework/Rules/Style/StatementPositionRule.swift b/Source/SwiftLintFramework/Rules/Style/StatementPositionRule.swift index cb45062c7..ff7856b73 100644 --- a/Source/SwiftLintFramework/Rules/Style/StatementPositionRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/StatementPositionRule.swift @@ -10,8 +10,7 @@ struct StatementPositionRule: CorrectableRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "statement_position", name: "Statement Position", - description: "Else and catch should be on the same line, one space after the previous " + - "declaration.", + description: "Else and catch should be on the same line, one space after the previous declaration", kind: .style, nonTriggeringExamples: [ Example("} else if {"), @@ -38,7 +37,7 @@ struct StatementPositionRule: CorrectableRule, ConfigurationProviderRule { identifier: "statement_position", name: "Statement Position", description: "Else and catch should be on the next line, with equal indentation to the " + - "previous declaration.", + "previous declaration", kind: .style, nonTriggeringExamples: [ Example(" }\n else if {"), diff --git a/Source/SwiftLintFramework/Rules/Style/SwitchCaseAlignmentRule.swift b/Source/SwiftLintFramework/Rules/Style/SwitchCaseAlignmentRule.swift index 31c28fc6d..67c8b9ee0 100644 --- a/Source/SwiftLintFramework/Rules/Style/SwitchCaseAlignmentRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/SwitchCaseAlignmentRule.swift @@ -84,7 +84,7 @@ extension SwitchCaseAlignmentRule { let reason = """ Case statements should \ \(indentedCases ? "be indented within" : "vertically align with") \ - their enclosing switch statement. + their enclosing switch statement """ violations.append(ReasonedRuleViolation(position: casePosition, reason: reason)) diff --git a/Source/SwiftLintFramework/Rules/Style/TrailingClosureRule.swift b/Source/SwiftLintFramework/Rules/Style/TrailingClosureRule.swift index d47914232..1170786ec 100644 --- a/Source/SwiftLintFramework/Rules/Style/TrailingClosureRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/TrailingClosureRule.swift @@ -9,7 +9,7 @@ struct TrailingClosureRule: OptInRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "trailing_closure", name: "Trailing Closure", - description: "Trailing closure syntax should be used whenever possible.", + description: "Trailing closure syntax should be used whenever possible", kind: .style, nonTriggeringExamples: [ Example("foo.map { $0 + 1 }\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/TrailingCommaRule.swift b/Source/SwiftLintFramework/Rules/Style/TrailingCommaRule.swift index afc65f4e5..d79a2b4b4 100644 --- a/Source/SwiftLintFramework/Rules/Style/TrailingCommaRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/TrailingCommaRule.swift @@ -108,8 +108,8 @@ private extension TrailingCommaRule { private func violation(for position: AbsolutePosition) -> ReasonedRuleViolation { let reason = mandatoryComma - ? "Multi-line collection literals should have trailing commas." - : "Collection literals should not have trailing commas." + ? "Multi-line collection literals should have trailing commas" + : "Collection literals should not have trailing commas" return ReasonedRuleViolation(position: position, reason: reason) } } diff --git a/Source/SwiftLintFramework/Rules/Style/TrailingNewlineRule.swift b/Source/SwiftLintFramework/Rules/Style/TrailingNewlineRule.swift index 3779974a2..d76a5cbb3 100644 --- a/Source/SwiftLintFramework/Rules/Style/TrailingNewlineRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/TrailingNewlineRule.swift @@ -26,7 +26,7 @@ struct TrailingNewlineRule: CorrectableRule, ConfigurationProviderRule, SourceKi static let description = RuleDescription( identifier: "trailing_newline", name: "Trailing Newline", - description: "Files should have a single trailing newline.", + description: "Files should have a single trailing newline", kind: .style, nonTriggeringExamples: [ Example("let a = 0\n") diff --git a/Source/SwiftLintFramework/Rules/Style/TrailingWhitespaceRule.swift b/Source/SwiftLintFramework/Rules/Style/TrailingWhitespaceRule.swift index 1b161a0c6..41dc4e870 100644 --- a/Source/SwiftLintFramework/Rules/Style/TrailingWhitespaceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/TrailingWhitespaceRule.swift @@ -10,7 +10,7 @@ struct TrailingWhitespaceRule: CorrectableRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "trailing_whitespace", name: "Trailing Whitespace", - description: "Lines should not have trailing whitespace.", + description: "Lines should not have trailing whitespace", kind: .style, nonTriggeringExamples: [ Example("let name: String\n"), Example("//\n"), Example("// \n"), diff --git a/Source/SwiftLintFramework/Rules/Style/TypeContentsOrderRule.swift b/Source/SwiftLintFramework/Rules/Style/TypeContentsOrderRule.swift index 1b83361c5..a2c47a0c9 100644 --- a/Source/SwiftLintFramework/Rules/Style/TypeContentsOrderRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/TypeContentsOrderRule.swift @@ -60,7 +60,7 @@ struct TypeContentsOrderRule: ConfigurationProviderRule, OptInRule { ruleDescription: Self.description, severity: configuration.severityConfiguration.severity, location: Location(file: file, byteOffset: typeContentOffset.offset), - reason: "\(article) '\(content)' should not be placed amongst the type content(s) '\(expected)'." + reason: "\(article) '\(content)' should not be placed amongst the type content(s) '\(expected)'" ) violations.append(styleViolation) } diff --git a/Source/SwiftLintFramework/Rules/Style/UnneededParenthesesInClosureArgumentRule.swift b/Source/SwiftLintFramework/Rules/Style/UnneededParenthesesInClosureArgumentRule.swift index de773d144..359ec18bb 100644 --- a/Source/SwiftLintFramework/Rules/Style/UnneededParenthesesInClosureArgumentRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/UnneededParenthesesInClosureArgumentRule.swift @@ -9,7 +9,7 @@ struct UnneededParenthesesInClosureArgumentRule: ConfigurationProviderRule, static let description = RuleDescription( identifier: "unneeded_parentheses_in_closure_argument", name: "Unneeded Parentheses in Closure Argument", - description: "Parentheses are not needed when declaring closure arguments.", + description: "Parentheses are not needed when declaring closure arguments", kind: .style, nonTriggeringExamples: [ Example("let foo = { (bar: Int) in }\n"), diff --git a/Source/SwiftLintFramework/Rules/Style/VerticalParameterAlignmentOnCallRule.swift b/Source/SwiftLintFramework/Rules/Style/VerticalParameterAlignmentOnCallRule.swift index 65c70037c..dd2e15ecb 100644 --- a/Source/SwiftLintFramework/Rules/Style/VerticalParameterAlignmentOnCallRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/VerticalParameterAlignmentOnCallRule.swift @@ -8,7 +8,7 @@ struct VerticalParameterAlignmentOnCallRule: ASTRule, ConfigurationProviderRule, static let description = RuleDescription( identifier: "vertical_parameter_alignment_on_call", name: "Vertical Parameter Alignment on Call", - description: "Function parameters should be aligned vertically if they're in multiple lines in a method call.", + description: "Function parameters should be aligned vertically if they're in multiple lines in a method call", kind: .style, nonTriggeringExamples: [ Example(""" diff --git a/Source/SwiftLintFramework/Rules/Style/VerticalParameterAlignmentRule.swift b/Source/SwiftLintFramework/Rules/Style/VerticalParameterAlignmentRule.swift index d9d1e9fb5..3e0dc4623 100644 --- a/Source/SwiftLintFramework/Rules/Style/VerticalParameterAlignmentRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/VerticalParameterAlignmentRule.swift @@ -8,7 +8,7 @@ struct VerticalParameterAlignmentRule: SwiftSyntaxRule, ConfigurationProviderRul static let description = RuleDescription( identifier: "vertical_parameter_alignment", name: "Vertical Parameter Alignment", - description: "Function parameters should be aligned vertically if they're in multiple lines in a declaration.", + description: "Function parameters should be aligned vertically if they're in multiple lines in a declaration", kind: .style, nonTriggeringExamples: VerticalParameterAlignmentRuleExamples.nonTriggeringExamples, triggeringExamples: VerticalParameterAlignmentRuleExamples.triggeringExamples diff --git a/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceBetweenCasesRule.swift b/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceBetweenCasesRule.swift index 2de935f93..5b3e8e472 100644 --- a/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceBetweenCasesRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceBetweenCasesRule.swift @@ -141,7 +141,7 @@ extension VerticalWhitespaceBetweenCasesRule: OptInRule { static let description = RuleDescription( identifier: "vertical_whitespace_between_cases", name: "Vertical Whitespace between Cases", - description: "Include a single empty line between switch cases.", + description: "Include a single empty line between switch cases", kind: .style, nonTriggeringExamples: (violatingToValidExamples.values + nonTriggeringExamples).sorted(), triggeringExamples: Array(violatingToValidExamples.keys).sorted(), diff --git a/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceClosingBracesRule.swift b/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceClosingBracesRule.swift index 91872125f..6bf6731c6 100644 --- a/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceClosingBracesRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceClosingBracesRule.swift @@ -61,7 +61,7 @@ extension VerticalWhitespaceClosingBracesRule: OptInRule { static let description = RuleDescription( identifier: "vertical_whitespace_closing_braces", name: "Vertical Whitespace before Closing Braces", - description: "Don't include vertical whitespace (empty line) before closing braces.", + description: "Don't include vertical whitespace (empty line) before closing braces", kind: .style, nonTriggeringExamples: (examples.violatingToValidExamples.values + examples.nonTriggeringExamples), diff --git a/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceOpeningBracesRule.swift b/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceOpeningBracesRule.swift index b310c7303..cf792815b 100644 --- a/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceOpeningBracesRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceOpeningBracesRule.swift @@ -148,7 +148,7 @@ extension VerticalWhitespaceOpeningBracesRule: OptInRule { static let description = RuleDescription( identifier: "vertical_whitespace_opening_braces", name: "Vertical Whitespace after Opening Braces", - description: "Don't include vertical whitespace (empty line) after opening braces.", + description: "Don't include vertical whitespace (empty line) after opening braces", kind: .style, nonTriggeringExamples: (violatingToValidExamples.values + nonTriggeringExamples).sorted(), triggeringExamples: Array(violatingToValidExamples.keys).sorted(), diff --git a/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceRule.swift b/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceRule.swift index acf31405e..06ba55e4d 100644 --- a/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/VerticalWhitespaceRule.swift @@ -1,7 +1,7 @@ import Foundation import SourceKittenFramework -private let defaultDescriptionReason = "Limit vertical whitespace to a single empty line." +private let defaultDescriptionReason = "Limit vertical whitespace to a single empty line" struct VerticalWhitespaceRule: CorrectableRule, ConfigurationProviderRule { var configuration = VerticalWhitespaceConfiguration(maxEmptyLines: 1) @@ -11,7 +11,7 @@ struct VerticalWhitespaceRule: CorrectableRule, ConfigurationProviderRule { static let description = RuleDescription( identifier: "vertical_whitespace", name: "Vertical Whitespace", - description: defaultDescriptionReason, + description: defaultDescriptionReason + ".", kind: .style, nonTriggeringExamples: [ Example("let abc = 0\n"), @@ -33,7 +33,7 @@ struct VerticalWhitespaceRule: CorrectableRule, ConfigurationProviderRule { private var configuredDescriptionReason: String { guard configuration.maxEmptyLines == 1 else { - return "Limit vertical whitespace to maximum \(configuration.maxEmptyLines) empty lines." + return "Limit vertical whitespace to maximum \(configuration.maxEmptyLines) empty lines" } return defaultDescriptionReason } @@ -49,7 +49,7 @@ struct VerticalWhitespaceRule: CorrectableRule, ConfigurationProviderRule { ruleDescription: Self.description, severity: configuration.severityConfiguration.severity, location: Location(file: file.path, line: eachLastLine.index), - reason: configuredDescriptionReason + " Currently \(eachSectionCount + 1)." + reason: configuredDescriptionReason + "; currently \(eachSectionCount + 1)" ) } } diff --git a/Source/SwiftLintFramework/Rules/Style/VoidReturnRule.swift b/Source/SwiftLintFramework/Rules/Style/VoidReturnRule.swift index 074cf91fb..4e369def9 100644 --- a/Source/SwiftLintFramework/Rules/Style/VoidReturnRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/VoidReturnRule.swift @@ -9,7 +9,7 @@ struct VoidReturnRule: ConfigurationProviderRule, SubstitutionCorrectableRule { static let description = RuleDescription( identifier: "void_return", name: "Void Return", - description: "Prefer `-> Void` over `-> ()`.", + description: "Prefer `-> Void` over `-> ()`", kind: .style, nonTriggeringExamples: [ Example("let abc: () -> Void = {}\n"), diff --git a/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift b/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift index b8c2b712f..5cd992a01 100644 --- a/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift +++ b/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift @@ -129,7 +129,7 @@ struct LintOrAnalyzeCommand { let description = RuleDescription( identifier: "warning_threshold", name: "Warning Threshold", - description: "Number of warnings thrown is above the threshold.", + description: "Number of warnings thrown is above the threshold", kind: .lint ) return StyleViolation( diff --git a/Tests/SwiftLintFrameworkTests/CommandTests.swift b/Tests/SwiftLintFrameworkTests/CommandTests.swift index 23e8c5b96..8305d8640 100644 --- a/Tests/SwiftLintFrameworkTests/CommandTests.swift +++ b/Tests/SwiftLintFrameworkTests/CommandTests.swift @@ -339,7 +339,7 @@ class CommandTests: XCTestCase { XCTAssertEqual( violations(Example("print(123)\n// swiftlint:disable:previous nesting_foo\n"))[0].reason, - "'nesting_foo' is not a valid SwiftLint rule. Please remove it from the disable command." + "'nesting_foo' is not a valid SwiftLint rule; remove it from the disable command" ) XCTAssertEqual(violations(Example("/* swiftlint:disable nesting */\n")).count, 1) diff --git a/Tests/SwiftLintFrameworkTests/CompilerProtocolInitRuleTests.swift b/Tests/SwiftLintFrameworkTests/CompilerProtocolInitRuleTests.swift index a30a3457d..ed90fb6c8 100644 --- a/Tests/SwiftLintFrameworkTests/CompilerProtocolInitRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/CompilerProtocolInitRuleTests.swift @@ -15,7 +15,7 @@ class CompilerProtocolInitRuleTests: XCTestCase { ) XCTAssertEqual( violation.reason, - "The initializers declared in compiler protocol ExpressibleByIntegerLiteral shouldn't be called directly." + "Initializers declared in compiler protocol ExpressibleByIntegerLiteral shouldn't be called directly" ) } } diff --git a/Tests/SwiftLintFrameworkTests/ComputedAccessorsOrderRuleTests.swift b/Tests/SwiftLintFrameworkTests/ComputedAccessorsOrderRuleTests.swift index e667e7857..bf6effbea 100644 --- a/Tests/SwiftLintFrameworkTests/ComputedAccessorsOrderRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/ComputedAccessorsOrderRuleTests.swift @@ -55,7 +55,7 @@ class ComputedAccessorsOrderRuleTests: XCTestCase { XCTAssertEqual( ruleViolations(example).first?.reason, - "Computed properties should declare first the getter and then the setter." + "Computed properties should first declare the getter and then the setter" ) } @@ -75,7 +75,7 @@ class ComputedAccessorsOrderRuleTests: XCTestCase { XCTAssertEqual( ruleViolations(example).first?.reason, - "Computed subscripts should declare first the getter and then the setter." + "Computed subscripts should first declare the getter and then the setter" ) } @@ -95,7 +95,7 @@ class ComputedAccessorsOrderRuleTests: XCTestCase { XCTAssertEqual( ruleViolations(example, ruleConfiguration: ["order": "set_get"]).first?.reason, - "Computed properties should declare first the setter and then the getter." + "Computed properties should first declare the setter and then the getter" ) } @@ -115,7 +115,7 @@ class ComputedAccessorsOrderRuleTests: XCTestCase { XCTAssertEqual( ruleViolations(example, ruleConfiguration: ["order": "set_get"]).first?.reason, - "Computed subscripts should declare first the setter and then the getter." + "Computed subscripts should first declare the setter and then the getter" ) } diff --git a/Tests/SwiftLintFrameworkTests/DeploymentTargetRuleTests.swift b/Tests/SwiftLintFrameworkTests/DeploymentTargetRuleTests.swift index 9dd27b1de..3d4d2305c 100644 --- a/Tests/SwiftLintFrameworkTests/DeploymentTargetRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/DeploymentTargetRuleTests.swift @@ -7,7 +7,7 @@ class DeploymentTargetRuleTests: XCTestCase { let violations = self.violations(example, config: ["macOS_deployment_target": "10.14.0"]) let expectedMessage = "Availability attribute is using a version (10.11) that is satisfied by " + - "the deployment target (10.14) for platform macOS." + "the deployment target (10.14) for platform macOS" XCTAssertEqual(violations.count, 1) XCTAssertEqual(violations.first?.reason, expectedMessage) } @@ -17,7 +17,7 @@ class DeploymentTargetRuleTests: XCTestCase { let violations = self.violations(example, config: ["watchOS_deployment_target": "5.0.1"]) let expectedMessage = "Availability condition is using a version (4) that is satisfied by " + - "the deployment target (5.0.1) for platform watchOS." + "the deployment target (5.0.1) for platform watchOS" XCTAssertEqual(violations.count, 1) XCTAssertEqual(violations.first?.reason, expectedMessage) } @@ -29,7 +29,7 @@ class DeploymentTargetRuleTests: XCTestCase { let violations = self.violations(example, config: ["iOS_deployment_target": "15.0"]) let expectedMessage = "Availability negative condition is using a version (14) that is satisfied by " + - "the deployment target (15.0) for platform iOS." + "the deployment target (15.0) for platform iOS" XCTAssertEqual(violations.count, 1) XCTAssertEqual(violations.first?.reason, expectedMessage) } diff --git a/Tests/SwiftLintFrameworkTests/ExpiringTodoRuleTests.swift b/Tests/SwiftLintFrameworkTests/ExpiringTodoRuleTests.swift index 324ea660a..637b64497 100644 --- a/Tests/SwiftLintFrameworkTests/ExpiringTodoRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/ExpiringTodoRuleTests.swift @@ -18,21 +18,21 @@ class ExpiringTodoRuleTests: XCTestCase { let example = Example("fatalError() // TODO: [\(dateString(for: .expired))] Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved") } func testExpiredFixMe() { let example = Example("fatalError() // FIXME: [\(dateString(for: .expired))] Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved") } func testApproachingExpiryTodo() { let example = Example("fatalError() // TODO: [\(dateString(for: .approachingExpiry))] Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first!.reason, "TODO/FIXME is approaching its expiry and should be resolved soon.") + XCTAssertEqual(violations.first!.reason, "TODO/FIXME is approaching its expiry and should be resolved soon") } func testNonExpiredTodo() { @@ -49,7 +49,7 @@ class ExpiringTodoRuleTests: XCTestCase { let example = Example("fatalError() // TODO: <\(dateString(for: .expired))> Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved") } func testExpiredCustomSeparator() { @@ -62,7 +62,7 @@ class ExpiringTodoRuleTests: XCTestCase { let example = Example("fatalError() // TODO: [\(dateString(for: .expired))] Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved") } func testExpiredCustomFormat() { @@ -74,7 +74,7 @@ class ExpiringTodoRuleTests: XCTestCase { let example = Example("fatalError() // TODO: [\(dateString(for: .expired))] Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations.first!.reason, "TODO/FIXME has expired and must be resolved") } func testMultipleExpiredTodos() { @@ -86,9 +86,9 @@ class ExpiringTodoRuleTests: XCTestCase { ) let violations = self.violations(example) XCTAssertEqual(violations.count, 2) - XCTAssertEqual(violations[0].reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations[0].reason, "TODO/FIXME has expired and must be resolved") XCTAssertEqual(violations[0].location.line, 1) - XCTAssertEqual(violations[1].reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations[1].reason, "TODO/FIXME has expired and must be resolved") XCTAssertEqual(violations[1].location.line, 2) } @@ -102,7 +102,7 @@ class ExpiringTodoRuleTests: XCTestCase { ) let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations[0].reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations[0].reason, "TODO/FIXME has expired and must be resolved") XCTAssertEqual(violations[0].location.line, 3) } @@ -117,7 +117,7 @@ class ExpiringTodoRuleTests: XCTestCase { ) let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations[0].reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations[0].reason, "TODO/FIXME has expired and must be resolved") XCTAssertEqual(violations[0].location.line, 3) } @@ -130,7 +130,7 @@ class ExpiringTodoRuleTests: XCTestCase { ) let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations[0].reason, "TODO/FIXME has expired and must be resolved.") + XCTAssertEqual(violations[0].reason, "TODO/FIXME has expired and must be resolved") XCTAssertEqual(violations[0].location.line, 2) } @@ -143,7 +143,7 @@ class ExpiringTodoRuleTests: XCTestCase { let example = Example("fatalError() // TODO: [31/01/2020] Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Expiring TODO/FIXME is incorrectly formatted.") + XCTAssertEqual(violations.first?.reason, "Expiring TODO/FIXME is incorrectly formatted") } private func violations(_ example: Example) -> [StyleViolation] { diff --git a/Tests/SwiftLintFrameworkTests/ImplicitGetterRuleTests.swift b/Tests/SwiftLintFrameworkTests/ImplicitGetterRuleTests.swift index 321e874d0..55a245f0a 100644 --- a/Tests/SwiftLintFrameworkTests/ImplicitGetterRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/ImplicitGetterRuleTests.swift @@ -16,7 +16,7 @@ final class ImplicitGetterRuleTests: XCTestCase { let violations = violations(example, config: config) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Computed read-only properties should avoid using the get keyword.") + XCTAssertEqual(violations.first?.reason, "Computed read-only properties should avoid using the get keyword") } func testSubscriptReason() throws { @@ -33,6 +33,6 @@ final class ImplicitGetterRuleTests: XCTestCase { let violations = violations(example, config: config) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Computed read-only subscripts should avoid using the get keyword.") + XCTAssertEqual(violations.first?.reason, "Computed read-only subscripts should avoid using the get keyword") } } diff --git a/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift b/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift index bf2d34510..3c9be122d 100644 --- a/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift +++ b/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift @@ -27,11 +27,11 @@ private struct CacheTestHelper { StyleViolation(ruleDescription: ruleDescription, severity: .warning, location: Location(file: file, line: 10, character: 2), - reason: "Something is not right."), + reason: "Something is not right"), StyleViolation(ruleDescription: ruleDescription, severity: .error, location: Location(file: file, line: 5, character: nil), - reason: "Something is wrong.") + reason: "Something is wrong") ] } diff --git a/Tests/SwiftLintFrameworkTests/ModifierOrderTests.swift b/Tests/SwiftLintFrameworkTests/ModifierOrderTests.swift index c9c0cb894..acc57f3c0 100644 --- a/Tests/SwiftLintFrameworkTests/ModifierOrderTests.swift +++ b/Tests/SwiftLintFrameworkTests/ModifierOrderTests.swift @@ -386,7 +386,7 @@ class ModifierOrderTests: XCTestCase { let allViolations = violations(Example("final public var foo: String"), config: config) let modifierOrderRuleViolation = allViolations.first { $0.ruleIdentifier == ruleID } if let violation = modifierOrderRuleViolation { - XCTAssertEqual(violation.reason, "public modifier should be before final.") + XCTAssertEqual(violation.reason, "public modifier should come before final") } else { XCTFail("A modifier order violation should have been triggered!") } diff --git a/Tests/SwiftLintFrameworkTests/ReporterTests.swift b/Tests/SwiftLintFrameworkTests/ReporterTests.swift index 028f6805e..51f340cbf 100644 --- a/Tests/SwiftLintFrameworkTests/ReporterTests.swift +++ b/Tests/SwiftLintFrameworkTests/ReporterTests.swift @@ -33,16 +33,16 @@ class ReporterTests: XCTestCase { return [ StyleViolation(ruleDescription: LineLengthRule.description, location: location, - reason: "Violation Reason."), + reason: "Violation Reason"), StyleViolation(ruleDescription: LineLengthRule.description, severity: .error, location: location, - reason: "Violation Reason."), + reason: "Violation Reason"), StyleViolation(ruleDescription: SyntacticSugarRule.description, severity: .error, location: location, reason: "Shorthand syntactic sugar should be used" + - ", i.e. [Int] instead of Array."), + ", i.e. [Int] instead of Array"), StyleViolation(ruleDescription: ColonRule.description, severity: .error, location: Location(file: nil), diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedCSVReporterOutput.csv b/Tests/SwiftLintFrameworkTests/Resources/CannedCSVReporterOutput.csv index 914113b20..3b59168ff 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedCSVReporterOutput.csv +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedCSVReporterOutput.csv @@ -1,5 +1,5 @@ file,line,character,severity,type,reason,rule_id -filename,1,2,Warning,Line Length,Violation Reason.,line_length -filename,1,2,Error,Line Length,Violation Reason.,line_length -filename,1,2,Error,Syntactic Sugar,"Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.",syntactic_sugar -,,,Error,Colon Spacing,Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.,colon \ No newline at end of file +filename,1,2,Warning,Line Length,Violation Reason,line_length +filename,1,2,Error,Line Length,Violation Reason,line_length +filename,1,2,Error,Syntactic Sugar,"Shorthand syntactic sugar should be used, i.e. [Int] instead of Array",syntactic_sugar +,,,Error,Colon Spacing,Colons should be next to the identifier when specifying a type and next to the key in dictionary literals,colon \ No newline at end of file diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedCheckstyleReporterOutput.xml b/Tests/SwiftLintFrameworkTests/Resources/CannedCheckstyleReporterOutput.xml index ad3097663..b5cd3c2cc 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedCheckstyleReporterOutput.xml +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedCheckstyleReporterOutput.xml @@ -1,11 +1,11 @@ - + - - - + + + \ No newline at end of file diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedCodeClimateReporterOutput.json b/Tests/SwiftLintFrameworkTests/Resources/CannedCodeClimateReporterOutput.json index c8d56f3b5..a091aa6bd 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedCodeClimateReporterOutput.json +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedCodeClimateReporterOutput.json @@ -1,7 +1,7 @@ [ { "check_name" : "Line Length", - "description" : "Violation Reason.", + "description" : "Violation Reason", "engine_name" : "SwiftLint", "fingerprint" : "917a85854a9500cfd28520fa4875a3ecbba171e522f13452c7adec71fc14497a", "location" : { @@ -16,7 +16,7 @@ }, { "check_name" : "Line Length", - "description" : "Violation Reason.", + "description" : "Violation Reason", "engine_name" : "SwiftLint", "fingerprint" : "917a85854a9500cfd28520fa4875a3ecbba171e522f13452c7adec71fc14497a", "location" : { @@ -31,7 +31,7 @@ }, { "check_name" : "Syntactic Sugar", - "description" : "Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.", + "description" : "Shorthand syntactic sugar should be used, i.e. [Int] instead of Array", "engine_name" : "SwiftLint", "fingerprint" : "6477f518963149b01807a31e7067be97dc39a30b93673e1e246f812e9ea5ef21", "location" : { @@ -46,7 +46,7 @@ }, { "check_name" : "Colon Spacing", - "description" : "Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.", + "description" : "Colons should be next to the identifier when specifying a type and next to the key in dictionary literals", "engine_name" : "SwiftLint", "fingerprint" : "9b1ddedc847d23a54124cb02a56452fc01c23df8f3babc07a6a68cf2449b14a6", "location" : { diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedEmojiReporterOutput.txt b/Tests/SwiftLintFrameworkTests/Resources/CannedEmojiReporterOutput.txt index 7b55f15b8..61e59c7f4 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedEmojiReporterOutput.txt +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedEmojiReporterOutput.txt @@ -1,6 +1,6 @@ Other -⛔️ Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. +⛔️ Colons should be next to the identifier when specifying a type and next to the key in dictionary literals filename -⛔️ Line 1: Violation Reason. -⛔️ Line 1: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array. -⚠️ Line 1: Violation Reason. \ No newline at end of file +⛔️ Line 1: Violation Reason +⛔️ Line 1: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array +⚠️ Line 1: Violation Reason \ No newline at end of file diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedGitHubActionsLoggingReporterOutput.txt b/Tests/SwiftLintFrameworkTests/Resources/CannedGitHubActionsLoggingReporterOutput.txt index 631e0cb8d..430309588 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedGitHubActionsLoggingReporterOutput.txt +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedGitHubActionsLoggingReporterOutput.txt @@ -1,4 +1,4 @@ -::warning file=filename,line=1,col=2::Violation Reason. (line_length) -::error file=filename,line=1,col=2::Violation Reason. (line_length) -::error file=filename,line=1,col=2::Shorthand syntactic sugar should be used, i.e. [Int] instead of Array. (syntactic_sugar) -::error file=,line=1,col=1::Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon) \ No newline at end of file +::warning file=filename,line=1,col=2::Violation Reason (line_length) +::error file=filename,line=1,col=2::Violation Reason (line_length) +::error file=filename,line=1,col=2::Shorthand syntactic sugar should be used, i.e. [Int] instead of Array (syntactic_sugar) +::error file=,line=1,col=1::Colons should be next to the identifier when specifying a type and next to the key in dictionary literals (colon) \ No newline at end of file diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedGitLabJUnitReporterOutput.xml b/Tests/SwiftLintFrameworkTests/Resources/CannedGitLabJUnitReporterOutput.xml index 060863836..339a7808d 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedGitLabJUnitReporterOutput.xml +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedGitLabJUnitReporterOutput.xml @@ -3,7 +3,7 @@ Severity: warning Rule: line_length -Reason: Violation Reason. +Reason: Violation Reason File: filename Line: 1 @@ -13,7 +13,7 @@ Column: 2 Severity: error Rule: line_length -Reason: Violation Reason. +Reason: Violation Reason File: filename Line: 1 @@ -23,7 +23,7 @@ Column: 2 Severity: error Rule: syntactic_sugar -Reason: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array<Int>. +Reason: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array<Int> File: filename Line: 1 @@ -33,7 +33,7 @@ Column: 2 Severity: error Rule: colon -Reason: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. +Reason: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals File: <nopath> Line: nil diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedHTMLReporterOutput.html b/Tests/SwiftLintFrameworkTests/Resources/CannedHTMLReporterOutput.html index 12db37c80..82cfc00a2 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedHTMLReporterOutput.html +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedHTMLReporterOutput.html @@ -80,28 +80,28 @@ filename 1:2 Warning - Violation Reason. + Violation Reason 2 filename 1:2 Error - Violation Reason. + Violation Reason 3 filename 1:2 Error - Shorthand syntactic sugar should be used, i.e. [Int] instead of Array<Int>. + Shorthand syntactic sugar should be used, i.e. [Int] instead of Array<Int> 4 <nopath> 0:0 Error - Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. + Colons should be next to the identifier when specifying a type and next to the key in dictionary literals diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedJSONReporterOutput.json b/Tests/SwiftLintFrameworkTests/Resources/CannedJSONReporterOutput.json index e3f6e244d..e20478afd 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedJSONReporterOutput.json +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedJSONReporterOutput.json @@ -1,6 +1,6 @@ [ { - "reason" : "Violation Reason.", + "reason" : "Violation Reason", "character" : 2, "file" : "filename", "rule_id" : "line_length", @@ -9,7 +9,7 @@ "type" : "Line Length" }, { - "reason" : "Violation Reason.", + "reason" : "Violation Reason", "character" : 2, "file" : "filename", "rule_id" : "line_length", @@ -18,7 +18,7 @@ "type" : "Line Length" }, { - "reason" : "Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.", + "reason" : "Shorthand syntactic sugar should be used, i.e. [Int] instead of Array", "character" : 2, "file" : "filename", "rule_id" : "syntactic_sugar", @@ -27,7 +27,7 @@ "type" : "Syntactic Sugar" }, { - "reason" : "Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.", + "reason" : "Colons should be next to the identifier when specifying a type and next to the key in dictionary literals", "character" : null, "file" : null, "rule_id" : "colon", diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedJunitReporterOutput.xml b/Tests/SwiftLintFrameworkTests/Resources/CannedJunitReporterOutput.xml index 25c4fc407..3f8f800b5 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedJunitReporterOutput.xml +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedJunitReporterOutput.xml @@ -1,15 +1,15 @@ -warning: +warning: Line:1 -error: +error: Line:1 -error: +error: Line:1 -error: +error: Line:0 \ No newline at end of file diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedMarkdownReporterOutput.md b/Tests/SwiftLintFrameworkTests/Resources/CannedMarkdownReporterOutput.md index a2495eee1..661089923 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedMarkdownReporterOutput.md +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedMarkdownReporterOutput.md @@ -1,6 +1,6 @@ file | line | severity | reason | rule_id --- | --- | --- | --- | --- -filename | 1 | :warning: | Line Length: Violation Reason. | line_length -filename | 1 | :stop\_sign: | Line Length: Violation Reason. | line_length -filename | 1 | :stop\_sign: | Syntactic Sugar: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array. | syntactic_sugar - | | :stop\_sign: | Colon Spacing: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. | colon \ No newline at end of file +filename | 1 | :warning: | Line Length: Violation Reason | line_length +filename | 1 | :stop\_sign: | Line Length: Violation Reason | line_length +filename | 1 | :stop\_sign: | Syntactic Sugar: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array | syntactic_sugar + | | :stop\_sign: | Colon Spacing: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals | colon \ No newline at end of file diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedSonarQubeReporterOutput.json b/Tests/SwiftLintFrameworkTests/Resources/CannedSonarQubeReporterOutput.json index 9fdb3625c..fb2472e4e 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedSonarQubeReporterOutput.json +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedSonarQubeReporterOutput.json @@ -4,7 +4,7 @@ "engineId":"SwiftLint", "primaryLocation":{ "filePath":"filename", - "message":"Violation Reason.", + "message":"Violation Reason", "textRange":{ "startLine":1 } @@ -17,7 +17,7 @@ "engineId":"SwiftLint", "primaryLocation":{ "filePath":"filename", - "message":"Violation Reason.", + "message":"Violation Reason", "textRange":{ "startLine":1 } @@ -30,7 +30,7 @@ "engineId":"SwiftLint", "primaryLocation":{ "filePath":"filename", - "message":"Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.", + "message":"Shorthand syntactic sugar should be used, i.e. [Int] instead of Array", "textRange":{ "startLine":1 } @@ -43,7 +43,7 @@ "engineId":"SwiftLint", "primaryLocation":{ "filePath":"", - "message":"Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.", + "message":"Colons should be next to the identifier when specifying a type and next to the key in dictionary literals", "textRange":{ "startLine":1 } diff --git a/Tests/SwiftLintFrameworkTests/Resources/CannedXcodeReporterOutput.txt b/Tests/SwiftLintFrameworkTests/Resources/CannedXcodeReporterOutput.txt index 29ca3f20b..cab4b2c63 100644 --- a/Tests/SwiftLintFrameworkTests/Resources/CannedXcodeReporterOutput.txt +++ b/Tests/SwiftLintFrameworkTests/Resources/CannedXcodeReporterOutput.txt @@ -1,4 +1,4 @@ -filename:1:2: warning: Line Length Violation: Violation Reason. (line_length) -filename:1:2: error: Line Length Violation: Violation Reason. (line_length) -filename:1:2: error: Syntactic Sugar Violation: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array. (syntactic_sugar) -:1:1: error: Colon Spacing Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon) \ No newline at end of file +filename:1:2: warning: Line Length Violation: Violation Reason (line_length) +filename:1:2: error: Line Length Violation: Violation Reason (line_length) +filename:1:2: error: Syntactic Sugar Violation: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array (syntactic_sugar) +:1:1: error: Colon Spacing Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals (colon) \ No newline at end of file diff --git a/Tests/SwiftLintFrameworkTests/TodoRuleTests.swift b/Tests/SwiftLintFrameworkTests/TodoRuleTests.swift index 429f7c91c..d3e68cbd3 100644 --- a/Tests/SwiftLintFrameworkTests/TodoRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/TodoRuleTests.swift @@ -10,14 +10,14 @@ class TodoRuleTests: XCTestCase { let example = Example("fatalError() // TODO: Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first!.reason, "TODOs should be resolved (Implement).") + XCTAssertEqual(violations.first!.reason, "TODOs should be resolved (Implement)") } func testFixMeMessage() { let example = Example("fatalError() // FIXME: Implement") let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first!.reason, "FIXMEs should be resolved (Implement).") + XCTAssertEqual(violations.first!.reason, "FIXMEs should be resolved (Implement)") } private func violations(_ example: Example) -> [StyleViolation] { diff --git a/Tests/SwiftLintFrameworkTests/TrailingCommaRuleTests.swift b/Tests/SwiftLintFrameworkTests/TrailingCommaRuleTests.swift index 512f970a9..74acfc71e 100644 --- a/Tests/SwiftLintFrameworkTests/TrailingCommaRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/TrailingCommaRuleTests.swift @@ -11,7 +11,7 @@ class TrailingCommaRuleTests: XCTestCase { // Ensure the rule produces the correct reason string. let failingCase = Example("let array = [\n\t1,\n\t2,\n]\n") XCTAssertEqual(trailingCommaViolations(failingCase).first?.reason, - "Collection literals should not have trailing commas.") + "Collection literals should not have trailing commas") } private static let triggeringExamples = [ @@ -65,7 +65,7 @@ class TrailingCommaRuleTests: XCTestCase { // Ensure the rule produces the correct reason string. let failingCase = Example("let array = [\n\t1,\n\t2\n]\n") XCTAssertEqual(trailingCommaViolations(failingCase, ruleConfiguration: ruleConfiguration).first?.reason, - "Multi-line collection literals should have trailing commas.") + "Multi-line collection literals should have trailing commas") } private func trailingCommaViolations(_ example: Example, ruleConfiguration: Any? = nil) -> [StyleViolation] { diff --git a/Tests/SwiftLintFrameworkTests/VerticalWhitespaceRuleTests.swift b/Tests/SwiftLintFrameworkTests/VerticalWhitespaceRuleTests.swift index d08c25394..716cc2508 100644 --- a/Tests/SwiftLintFrameworkTests/VerticalWhitespaceRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/VerticalWhitespaceRuleTests.swift @@ -37,7 +37,7 @@ class VerticalWhitespaceRuleTests: XCTestCase { let verticalWhiteSpaceViolation = allViolations.first { $0.ruleIdentifier == ruleID } if let violation = verticalWhiteSpaceViolation { - XCTAssertEqual(violation.reason, "Limit vertical whitespace to maximum 2 empty lines. Currently 3.") + XCTAssertEqual(violation.reason, "Limit vertical whitespace to maximum 2 empty lines; currently 3") } else { XCTFail("A vertical whitespace violation should have been triggered!") } @@ -47,7 +47,7 @@ class VerticalWhitespaceRuleTests: XCTestCase { let allViolations = violations(Example("let aaaa = 0\n\n\n\nlet bbb = 2\n")) let verticalWhiteSpaceViolation = allViolations.first(where: { $0.ruleIdentifier == ruleID }) if let violation = verticalWhiteSpaceViolation { - XCTAssertEqual(violation.reason, "Limit vertical whitespace to a single empty line. Currently 3.") + XCTAssertEqual(violation.reason, "Limit vertical whitespace to a single empty line; currently 3") } else { XCTFail("A vertical whitespace violation should have been triggered!") } diff --git a/Tests/SwiftLintFrameworkTests/XCTSpecificMatcherRuleTests.swift b/Tests/SwiftLintFrameworkTests/XCTSpecificMatcherRuleTests.swift index 3573c147a..9f2f240a2 100644 --- a/Tests/SwiftLintFrameworkTests/XCTSpecificMatcherRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/XCTSpecificMatcherRuleTests.swift @@ -7,7 +7,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertTrue' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertTrue' instead") } func testEqualFalse() { @@ -15,7 +15,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead") } func testEqualNil() { @@ -23,7 +23,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertNil' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertNil' instead") } func testNotEqualTrue() { @@ -31,7 +31,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead") } func testNotEqualFalse() { @@ -39,7 +39,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertTrue' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertTrue' instead") } func testNotEqualNil() { @@ -47,7 +47,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertNotNil' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertNotNil' instead") } // MARK: - Additional Tests @@ -64,7 +64,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead") } func testEqualNilNil() { @@ -72,7 +72,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertNil' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertNil' instead") } func testEqualTrueTrue() { @@ -80,7 +80,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertTrue' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertTrue' instead") } func testEqualFalseFalse() { @@ -88,7 +88,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead") } func testNotEqualNilNil() { @@ -96,7 +96,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertNotNil' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertNotNil' instead") } func testNotEqualTrueTrue() { @@ -104,7 +104,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertFalse' instead") } func testNotEqualFalseFalse() { @@ -112,7 +112,7 @@ class XCTSpecificMatcherRuleTests: XCTestCase { let violations = self.violations(example) XCTAssertEqual(violations.count, 1) - XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertTrue' instead.") + XCTAssertEqual(violations.first?.reason, "Prefer the specific matcher 'XCTAssertTrue' instead") } private func violations(_ example: Example) -> [StyleViolation] {