diff --git a/swiftlang/src/main/resources/com/sonar/sqale/swiftlint-model.xml b/swiftlang/src/main/resources/com/sonar/sqale/swiftlint-model.xml index 9380684c..9d8b42d9 100644 --- a/swiftlang/src/main/resources/com/sonar/sqale/swiftlint-model.xml +++ b/swiftlang/src/main/resources/com/sonar/sqale/swiftlint-model.xml @@ -889,6 +889,71 @@ 5 min + + + SwiftLint + file_types_order + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + legacy_multiple + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + type_contents_order + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + unused_capture_list + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + unused_declaration + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + @@ -1505,6 +1570,45 @@ min + + SwiftLint + duplicate_enum_cases + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + empty_collection_literal + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + no_space_in_method_call + + remediationFunction + CONSTANT_ISSUE + + + offset + 10 + min + + @@ -1624,6 +1728,32 @@ MEMORY_EFFICIENCY Memory use + + SwiftLint + reduce_into + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + unowned_variable_capture + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + CPU_EFFICIENCY @@ -1654,6 +1784,45 @@ min + + SwiftLint + reduce_boolean + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + contains_over_filter_count + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + contains_over_filter_is_empty + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + @@ -1888,6 +2057,32 @@ 10 min + + + SwiftLint + nslocalizedstring_require_bundle + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + + + + SwiftLint + nsobject_prefer_isequal + + remediationFunction + CONSTANT_ISSUE + + + offset + 5 + min + diff --git a/swiftlang/src/main/resources/org/sonar/plugins/swiftlint/profile-swiftlint.xml b/swiftlang/src/main/resources/org/sonar/plugins/swiftlint/profile-swiftlint.xml index de0a28ee..f6bcf4f0 100644 --- a/swiftlang/src/main/resources/org/sonar/plugins/swiftlint/profile-swiftlint.xml +++ b/swiftlang/src/main/resources/org/sonar/plugins/swiftlint/profile-swiftlint.xml @@ -63,6 +63,14 @@ SwiftLint conditional_returns_on_newline + + SwiftLint + contains_over_filter_count + + + SwiftLint + contains_over_filter_is_empty + SwiftLint contains_over_first_not_nil @@ -107,6 +115,10 @@ SwiftLint discouraged_optional_collection + + SwiftLint + duplicate_enum_cases + SwiftLint duplicate_imports @@ -115,6 +127,10 @@ SwiftLint dynamic_inline + + SwiftLint + empty_collection_literal + SwiftLint empty_count @@ -187,6 +203,10 @@ SwiftLint file_name + + SwiftLint + file_types_order + SwiftLint first_where @@ -283,6 +303,10 @@ SwiftLint legacy_hashing + + SwiftLint + legacy_multiple + SwiftLint legacy_nsgeometry_functions @@ -367,6 +391,10 @@ SwiftLint no_grouping_extension + + SwiftLint + no_space_in_method_call + SwiftLint notification_center_detachment @@ -375,6 +403,14 @@ SwiftLint nslocalizedstring_key + + SwiftLint + nslocalizedstring_require_bundle + + + SwiftLint + nsobject_prefer_isequal + SwiftLint number_separator @@ -451,6 +487,14 @@ SwiftLint quick_discouraged_pending_test + + SwiftLint + reduce_boolean + + + SwiftLint + reduce_into + SwiftLint redundant_discardable_let @@ -575,6 +619,10 @@ SwiftLint type_body_length + + SwiftLint + type_contents_order + SwiftLint type_name @@ -591,10 +639,18 @@ SwiftLint unneeded_parentheses_in_closure_argument + + SwiftLint + unowned_variable_capture + SwiftLint untyped_error_in_catch + + SwiftLint + unused_capture_list + SwiftLint unused_closure_parameter @@ -605,19 +661,19 @@ SwiftLint - unused_enumerated + unused_declaration SwiftLint - unused_import + unused_enumerated SwiftLint - unused_optional_binding + unused_import SwiftLint - unused_private_declaration + unused_optional_binding SwiftLint @@ -655,10 +711,6 @@ SwiftLint void_return - - SwiftLint - weak_computed_property - SwiftLint weak_delegate diff --git a/swiftlang/src/main/resources/org/sonar/plugins/swiftlint/rules.json b/swiftlang/src/main/resources/org/sonar/plugins/swiftlint/rules.json index 5e795581..10739e1a 100644 --- a/swiftlang/src/main/resources/org/sonar/plugins/swiftlint/rules.json +++ b/swiftlang/src/main/resources/org/sonar/plugins/swiftlint/rules.json @@ -104,11 +104,25 @@ "description": "Conditional statements should always return on the next line", "severity": "MINOR" }, + { + "key": "contains_over_filter_count", + "category": "SwiftLint", + "name": "Contains Over Filter Count", + "description": "Prefer `contains` over comparing `filter(where:).count` to 0.", + "severity": "MINOR" + }, + { + "key": "contains_over_filter_is_empty", + "category": "SwiftLint", + "name": "Contains Over Filter Is Empty", + "description": "Prefer `contains` over using `filter(where:).isEmpty`", + "severity": "MINOR" + }, { "key": "contains_over_first_not_nil", "category": "SwiftLint", "name": "Contains over first not nil", - "description": "Prefer `contains` over `first(where:) != nil`", + "description": "Prefer `contains` over `first(where:) != nil` and `firstIndex(where:) != nil`.", "severity": "MINOR" }, { @@ -181,6 +195,13 @@ "description": "Prefer empty collection over optional collection.", "severity": "MINOR" }, + { + "key": "duplicate_enum_cases", + "category": "SwiftLint", + "name": "Duplicate Enum Cases", + "description": "Enum can't contain multiple cases with the same name.", + "severity": "MINOR" + }, { "key": "duplicate_imports", "category": "SwiftLint", @@ -195,6 +216,13 @@ "description": "Avoid using 'dynamic' and '@inline(__always)' together.", "severity": "MINOR" }, + { + "key": "empty_collection_literal", + "category": "SwiftLint", + "name": "Empty Collection Literal", + "description": "Prefer checking `isEmpty` over comparing collection to an empty array or dictionary literal.", + "severity": "MINOR" + }, { "key": "empty_count", "category": "SwiftLint", @@ -321,6 +349,13 @@ "description": "File name should match a type or extension declared in the file (if any).", "severity": "MINOR" }, + { + "key": "file_types_order", + "category": "SwiftLint", + "name": "File Types Order", + "description": "Specifies how the types within a file should be ordered.", + "severity": "MINOR" + }, { "key": "first_where", "category": "SwiftLint", @@ -489,6 +524,13 @@ "description": "Prefer using the `hash(into:)` function instead of overriding `hashValue`", "severity": "MINOR" }, + { + "key": "legacy_multiple", + "category": "SwiftLint", + "name": "Legacy Multiple", + "description": "Prefer using the `isMultiple(of:)` function instead of using the remainder operator (`%`).", + "severity": "MINOR" + }, { "key": "legacy_nsgeometry_functions", "category": "SwiftLint", @@ -636,6 +678,13 @@ "description": "Extensions shouldn't be used to group code within the same source file.", "severity": "MINOR" }, + { + "key": "no_space_in_method_call", + "category": "SwiftLint", + "name": "No Space in Method Call", + "description": "Don't add a space between the method name and the parentheses.", + "severity": "MINOR" + }, { "key": "notification_center_detachment", "category": "SwiftLint", @@ -650,6 +699,20 @@ "description": "Static strings should be used as key in NSLocalizedString in order to genstrings work.", "severity": "MINOR" }, + { + "key": "nslocalizedstring_require_bundle", + "category": "SwiftLint", + "name": "NSLocalizedString Require Bundle", + "description": "Calls to NSLocalizedString should specify the bundle which contains the strings file.", + "severity": "MINOR" + }, + { + "key": "nsobject_prefer_isequal", + "category": "SwiftLint", + "name": "NSObject Prefer isEqual", + "description": "NSObject subclasses should implement isEqual instead of ==.", + "severity": "MINOR" + }, { "key": "number_separator", "category": "SwiftLint", @@ -783,6 +846,20 @@ "description": "Discouraged pending test. This test won't run while it's marked as pending.", "severity": "MINOR" }, + { + "key": "reduce_boolean", + "category": "SwiftLint", + "name": "Reduce Boolean", + "description": "Prefer using `.allSatisfy()` or `.contains()` over `reduce(true)` or `reduce(false)`", + "severity": "MINOR" + }, + { + "key": "reduce_into", + "category": "SwiftLint", + "name": "Reduce Into", + "description": "Prefer `reduce(into:_:)` over `reduce(_:_:)` for copy-on-write types", + "severity": "MINOR" + }, { "key": "redundant_discardable_let", "category": "SwiftLint", @@ -920,7 +997,7 @@ "key": "superfluous_disable_command", "category": "SwiftLint", "name": "Superfluous Disable Command", - "description": "SwiftLint 'disable' commands are superfluous when the disabled rule would not have triggered a violation in the disabled region.", + "description": "SwiftLint 'disable' commands are superfluous when the disabled rule would not have triggered a violation in the disabled region. Use \" - \" if you wish to document a command.", "severity": "MINOR" }, { @@ -1000,6 +1077,13 @@ "description": "Type bodies should not span too many lines.", "severity": "MAJOR" }, + { + "key": "type_contents_order", + "category": "SwiftLint", + "name": "Type Contents Order", + "description": "Specifies the order of subtypes, properties, methods & more within a type.", + "severity": "MINOR" + }, { "key": "type_name", "category": "SwiftLint", @@ -1028,6 +1112,13 @@ "description": "Parentheses are not needed when declaring closure arguments.", "severity": "MINOR" }, + { + "key": "unowned_variable_capture", + "category": "SwiftLint", + "name": "Unowned Variable Capture", + "description": "Prefer capturing references as weak to avoid potential crashes.", + "severity": "MINOR" + }, { "key": "untyped_error_in_catch", "category": "SwiftLint", @@ -1035,6 +1126,13 @@ "description": "Catch statements should not declare error variables without type casting.", "severity": "MINOR" }, + { + "key": "unused_capture_list", + "category": "SwiftLint", + "name": "Unused Capture List", + "description": "Unused reference in a capture list should be removed.", + "severity": "MINOR" + }, { "key": "unused_closure_parameter", "category": "SwiftLint", @@ -1049,6 +1147,13 @@ "description": "Unused control flow label should be removed.", "severity": "MINOR" }, + { + "key": "unused_declaration", + "category": "SwiftLint", + "name": "Unused Declaration", + "description": "Declarations should be referenced at least once within all files linted.", + "severity": "MINOR" + }, { "key": "unused_enumerated", "category": "SwiftLint", @@ -1070,13 +1175,6 @@ "description": "Prefer `!= nil` over `let _ =`", "severity": "MINOR" }, - { - "key": "unused_private_declaration", - "category": "SwiftLint", - "name": "Unused Private Declaration", - "description": "Private declarations should be referenced in that file.", - "severity": "MINOR" - }, { "key": "unused_setter_value", "category": "SwiftLint", @@ -1140,13 +1238,6 @@ "description": "Prefer `-> Void` over `-> ()`.", "severity": "MINOR" }, - { - "key": "weak_computed_property", - "category": "SwiftLint", - "name": "Weak Computed Property", - "description": "Adding weak to a computed property has no effect.", - "severity": "MINOR" - }, { "key": "weak_delegate", "category": "SwiftLint",