Skip to content

Instantly share code, notes, and snippets.

@amarcadet
Last active January 13, 2024 20:48
Show Gist options
  • Save amarcadet/40bbd809928b64dd54b92c5e2cd87437 to your computer and use it in GitHub Desktop.
Save amarcadet/40bbd809928b64dd54b92c5e2cd87437 to your computer and use it in GitHub Desktop.
swiftlint.schema.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://realm.github.io/SwiftLint/swiftlint.schema.json",
"title": "SwiftLint Configuration YAML Schema",
"type": "object",
"additionalProperties": false,
"allOf": [
{
"if": {
"required": [
"only_rules"
]
},
"then": {
"title": "only_rules could not be used alongside opt_in_rules and disabled_rules",
"not": {
"required": [
"opt_in_rules"
]
}
}
},
{
"if": {
"required": [
"only_rules"
]
},
"then": {
"title": "only_rules could not be used alongside opt_in_rules and disabled_rules",
"not": {
"required": [
"disabled_rules"
]
}
}
}
],
"properties": {
"excluded": {
"title": "Excluded",
"description": "Case-sensitive paths to ignore during linting. Takes precedence over `included`.",
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"included": {
"title": "Included",
"description": "Case-sensitive paths to include during linting. `--path` is ignored if present.",
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"reporter": {
"$comment": "Retrieve reporters using `$ swiftlint reporters`",
"title": "Reporter type",
"enum": [
"csv",
"checkstyle",
"codeclimate",
"emoji",
"github-actions-logging",
"gitlab",
"html",
"json",
"junit",
"markdown",
"relative-path",
"sonarqube",
"summary",
"xcode"
],
"default": "xcode"
},
"strict": {
"title": "Strict mode",
"description": "If true, SwiftLint will treat all warnings as errors.",
"type": "boolean",
"default": false
},
"disabled_rules": {
"title": "Disabled rules",
"description": "Disable rules from the default enabled set.",
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/$defs/Rule"
}
},
"opt_in_rules": {
"title": "Opt-in rules",
"description": "Enable rules that are not part of the default set. The special `all` identifier will enable all opt in linter rules, except the ones listed in `disabled_rules`.",
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"enum": [
"all",
"accessibility_label_for_image",
"accessibility_trait_for_button",
"anonymous_argument_in_multiline_closure",
"anyobject_protocol",
"array_init",
"attributes",
"balanced_xctest_lifecycle",
"capture_variable",
"closure_body_length",
"closure_end_indentation",
"closure_spacing",
"collection_alignment",
"comma_inheritance",
"conditional_returns_on_newline",
"contains_over_filter_count",
"contains_over_filter_is_empty",
"contains_over_first_not_nil",
"contains_over_range_nil_comparison",
"convenience_type",
"direct_return",
"discarded_notification_center_observer",
"discouraged_assert",
"discouraged_none_name",
"discouraged_object_literal",
"discouraged_optional_boolean",
"discouraged_optional_collection",
"empty_collection_literal",
"empty_count",
"empty_string",
"empty_xctest_method",
"enum_case_associated_values_count",
"expiring_todo",
"explicit_acl",
"explicit_enum_raw_value",
"explicit_init",
"explicit_self",
"explicit_top_level_acl",
"explicit_type_interface",
"extension_access_modifier",
"fallthrough",
"fatal_error_message",
"file_header",
"file_name",
"file_name_no_space",
"file_types_order",
"first_where",
"flatmap_over_map_reduce",
"force_unwrapping",
"function_default_parameter_at_end",
"ibinspectable_in_extension",
"identical_operands",
"implicit_return",
"implicitly_unwrapped_optional",
"indentation_width",
"inert_defer",
"joined_default_parameter",
"last_where",
"legacy_multiple",
"legacy_objc_type",
"let_var_whitespace",
"literal_expression_end_indentation",
"local_doc_comment",
"lower_acl_than_parent",
"missing_docs",
"modifier_order",
"multiline_arguments",
"multiline_arguments_brackets",
"multiline_function_chains",
"multiline_literal_brackets",
"multiline_parameters",
"multiline_parameters_brackets",
"nimble_operator",
"no_extension_access_modifier",
"no_grouping_extension",
"no_magic_numbers",
"nslocalizedstring_key",
"nslocalizedstring_require_bundle",
"number_separator",
"object_literal",
"operator_usage_whitespace",
"optional_enum_case_matching",
"overridden_super_call",
"override_in_extension",
"pattern_matching_keywords",
"period_spacing",
"prefer_nimble",
"prefer_self_in_static_references",
"prefer_self_type_over_type_of_self",
"prefer_zero_over_explicit_init",
"prefixed_toplevel_constant",
"private_action",
"private_outlet",
"private_subject",
"prohibited_interface_builder",
"prohibited_super_call",
"quick_discouraged_call",
"quick_discouraged_focused_test",
"quick_discouraged_pending_test",
"raw_value_for_camel_cased_codable_enum",
"reduce_into",
"redundant_nil_coalescing",
"redundant_self_in_closure",
"redundant_type_annotation",
"required_deinit",
"required_enum_case",
"return_value_from_void_function",
"self_binding",
"shorthand_optional_binding",
"single_test_class",
"sorted_enum_cases",
"sorted_first_last",
"sorted_imports",
"static_operator",
"strict_fileprivate",
"strong_iboutlet",
"superfluous_else",
"switch_case_on_newline",
"test_case_accessibility",
"toggle_bool",
"trailing_closure",
"type_contents_order",
"typesafe_array_init",
"unavailable_function",
"unhandled_throwing_task",
"unneeded_parentheses_in_closure_argument",
"unowned_variable_capture",
"untyped_error_in_catch",
"unused_capture_list",
"unused_declaration",
"unused_import",
"vertical_parameter_alignment_on_call",
"vertical_whitespace_between_cases",
"vertical_whitespace_closing_braces",
"vertical_whitespace_opening_braces",
"weak_delegate",
"xct_specific_matcher",
"yoda_condition"
]
}
},
"only_rules": {
"title": "Only rules",
"description": "Only the rules specified in this list will be enabled. Cannot be specified alongside `disabled_rules` or `opt_in_rules`.",
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/$defs/Rule"
}
},
"custom_rules": {
"$comment": "https://github.com/realm/SwiftLint?tab=readme-ov-file#defining-custom-rules",
"title": "Custom rules",
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"included": {
"type": "array",
"description": "Regex that defines paths to include during linting.",
"items": {
"type": "string"
}
},
"excluded": {
"type": "array",
"description": "Regex that defines paths to exclude during linting",
"items": {
"type": "string"
}
},
"name": {
"type": "string",
"title": "Rule name"
},
"regex": {
"type": "string",
"title": "Matching pattern"
},
"capture_group": {
"type": "integer",
"title": "Capture group",
"description": "Index of regex capturing group to highlight the rule violation at.",
"default": 0
},
"match_kinds": {
"allOf": [
{
"title": "SyntaxKinds",
"description": "All syntax kinds used in a snippet of Swift code can be extracted asking SourceKitten."
},
{
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/$defs/MatchKinds"
}
},
{
"$ref": "#/$defs/MatchKinds"
}
]
}
]
},
"message": {
"type": "string",
"description": "Violation message"
},
"severity": {
"$ref": "#/$defs/Severity"
}
},
"required": [
"regex"
]
}
},
"accessibility_label_for_image": {
"allOf": [
{
"title": "Accessibility Label for Image",
"description": "Images that provide context should have an accessibility label or should be explicitly hidden from accessibility.\nDocumentation: https://realm.github.io/SwiftLint/accessibility_label_for_image.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"accessibility_trait_for_button": {
"allOf": [
{
"title": "Accessibility Label for Button",
"description": "All views with tap gestures added should include the `.isButton` or the `.isLink` accessibility traits.\nDocumentation: https://realm.github.io/SwiftLint/accessibility_trait_for_button.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"anonymous_argument_in_multiline_closure": {
"allOf": [
{
"title": "Anonymous Argument in Multiline Closure",
"description": "Use named arguments in multiline closures.\nDocumentation: https://realm.github.io/SwiftLint/anonymous_argument_in_multiline_closure.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"anyobject_protocol": {
"allOf": [
{
"title": "AnyObject Protocol",
"description": "Prefer using `AnyObject` over `class` for class-only protocols.\nDocumentation: https://realm.github.io/SwiftLint/anyobject_protocol.html",
"deprecated": true
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"array_init": {
"allOf": [
{
"title": "Array Init",
"description": "Prefer using `Array(seq)` over `seq.map { $0 }` to convert a sequence into an Array.\nDocumentation: https://realm.github.io/SwiftLint/anyobject_protocol.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"attributes": {
"title": "Attributes",
"description": "Attributes should be on their own lines in functions and types, but on the same line as variables and imports.\nDocumentation: https://realm.github.io/SwiftLint/attributes.html",
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/Severity"
},
"attributes_with_arguments_always_on_line_above": {
"type": "boolean",
"default": true
},
"always_on_same_line": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"pattern": "^@"
},
"default": [
"@IBAction",
"@NSManaged"
]
},
"always_on_line_above": {
"type": "array",
"items": {
"type": "string",
"pattern": "^@"
}
}
}
},
"balanced_xctest_lifecycle": {
"title": "Balanced XCTest Life Cycle",
"description": "Test classes must implement balanced `setUp` and `tearDown` methods.\nDocumentation: https://realm.github.io/SwiftLint/balanced_xctest_lifecycle.html",
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/Severity"
},
"test_parent_classes": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
},
"default": [
"QuickSpec",
"XCTestCase"
]
}
}
},
"blanket_disable_command": {
"title": "Blanket Disable Command",
"description": "`swiftlint:disable` commands should be re-enabled before the end of the file.\nDocumentation: https://realm.github.io/SwiftLint/blanket_disable_command.html",
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/Severity"
},
"allowed_rules": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/$defs/Rule"
},
"default": [
"file_header",
"file_length",
"file_name",
"file_name_no_space",
"single_test_class"
]
},
"always_blanket_disable": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/$defs/Rule"
}
}
}
},
"block_based_kvo": {
"allOf": [
{
"title": "Block Based KVO",
"description": "Prefer the new block based KVO API with keypaths when using Swift 3.2 or later.\nDocumentation: https://realm.github.io/SwiftLint/block_based_kvo.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"capture_variable": {
"allOf": [
{
"title": "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.\nDocumentation: https://realm.github.io/SwiftLint/capture_variable.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"class_delegate_protocol": {
"allOf": [
{
"title": "Class Delegate Protocol",
"description": "Delegate protocols should be class-only so they can be weakly referenced.\nDocumentation: https://realm.github.io/SwiftLint/class_delegate_protocol.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"closing_brace": {
"allOf": [
{
"title": "Closing Brace Spacing",
"description": "Closing brace with closing parenthesis should not have any whitespaces in the middle.\nDocumentation: https://realm.github.io/SwiftLint/closing_brace.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"closure_body_length": {
"type": "object",
"title": "Closure Body Length",
"description": "Closure bodies should not span too many lines.\nDocumentation: https://realm.github.io/SwiftLint/closure_body_length.html",
"properties": {
"warning": {
"type": "integer",
"default": 30,
"minimum": 0
},
"error": {
"type": "integer",
"default": 100,
"minimum": 0
}
}
},
"closure_end_indentation": {
"allOf": [
{
"title": "Closure End Indentation",
"description": "Closure end should have the same indentation as the line that started it.\nDocumentation: https://realm.github.io/SwiftLint/closure_end_indentation.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"closure_parameter_position": {
"allOf": [
{
"title": "Closure Parameter Position",
"description": "Closure parameters should be on the same line as opening brace.\nDocumentation: https://realm.github.io/SwiftLint/closure_parameter_position.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"closure_spacing": {
"allOf": [
{
"title": "Closure Spacing",
"description": "Closure expressions should have a single space inside each brace.\nDocumentation: https://realm.github.io/SwiftLint/closure_spacing.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"collection_alignment": {
"title": "Collection Element Alignment",
"description": "All elements in a collection literal should be vertically aligned.\nDocumentation: https://realm.github.io/SwiftLint/collection_alignment.html",
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/Severity"
},
"align_colons": {
"type": "boolean",
"default": false
}
}
},
"colon": {
"title": "Colon Spacing",
"description": "Colons should be next to the identifier when specifying a type and next to the key in dictionary literals.\nDocumentation: https://realm.github.io/SwiftLint/colon.html",
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/Severity"
},
"flexible_right_spacing": {
"description": "Set to `true` to allow more than one space after colon.",
"type": "boolean",
"default": false
},
"apply_to_dictionaries": {
"description": "Set to `false` to disable rule for dictionaries.",
"type": "boolean",
"default": true
}
}
},
"comma": {
"allOf": [
{
"title": "Comma Spacing",
"description": "There should be no space before and one after any comma.\nDocumentation: https://realm.github.io/SwiftLint/comma.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"comma_inheritance": {
"allOf": [
{
"title": "Comma Inheritance Rule",
"description": "Use commas to separate types in inheritance lists.\nDocumentation: https://realm.github.io/SwiftLint/comma_inheritance.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"comment_spacing": {
"allOf": [
{
"title": "Comment Spacing",
"description": "Prefer at least one space after slashes for comments.\nDocumentation: https://realm.github.io/SwiftLint/comment_spacing.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"compiler_protocol_init": {
"allOf": [
{
"title": "Compiler Protocol Init",
"description": "The initializers declared in compiler protocols such as `ExpressibleByArrayLiteral` shouldn't be called directly.\nDocumentation: https://realm.github.io/SwiftLint/compiler_protocol_init.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"computed_accessors_order": {
"title": "Computed Accessors Order",
"description": "Getter and setters in computed properties and subscripts should be in a consistent order.",
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/SeverityDefaultWarning"
},
"order": {
"type": "string",
"enum": [
"get_set",
"set_get"
],
"default": "get_set"
}
}
},
"conditional_returns_on_newline": {
"title": "Conditional Returns on Newline",
"description": "Conditional statements should always return on the next line.\nDocumentation: https://realm.github.io/SwiftLint/conditional_returns_on_newline.html",
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/SeverityDefaultWarning"
},
"if_only": {
"type": "boolean",
"default": false
}
}
},
"contains_over_filter_count": {
"allOf": [
{
"title": "Contains over Filter Count",
"description": "Prefer `contains` over comparing `filter(where:).count` to 0.\nDocumentation: https://realm.github.io/SwiftLint/contains_over_filter_count.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"contains_over_filter_is_empty": {
"allOf": [
{
"title": "Contains over Filter Count",
"description": "Prefer `contains` over using `filter(where:).isEmpty`.\nDocumentation: https://realm.github.io/SwiftLint/contains_over_filter_is_empty.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"contains_over_first_not_nil": {
"allOf": [
{
"title": "Contains over First not Nil",
"description": "Prefer `contains` over `first(where:) != nil` and `firstIndex(where:) != nil`.\nDocumentation: https://realm.github.io/SwiftLint/contains_over_first_not_nil.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"contains_over_range_nil_comparison": {
"allOf": [
{
"title": "Contains over Range Comparision to Nil",
"description": "Prefer `contains` over `range(of:) != nil` and `range(of:) == nil`.\nDocumentation: https://realm.github.io/SwiftLint/contains_over_range_nil_comparison.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"control_statement": {
"allOf": [
{
"title": "Control Statement",
"description": "`if`, `for`, `guard`, `switch`, `while` and `catch` statements shouldn't unnecessarily wrap their conditionals or arguments in parentheses.\nDocumentation: https://realm.github.io/SwiftLint/contains_over_filter_count.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"convenience_type": {
"allOf": [
{
"title": "Convenience Type",
"description": "Types used for hosting only static members should be implemented as a caseless enum to avoid instantiation.\nDocumentation: https://realm.github.io/SwiftLint/contains_over_filter_count.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"cyclomatic_complexity": {
"title": "Cyclomatic Complexity",
"description": "Complexity of function bodies should be limited.",
"type": "object",
"additionalProperties": false,
"properties": {
"warning": {
"type": "integer",
"default": 10
},
"error": {
"type": "integer",
"default": 20
},
"ignores_case_statements": {
"description": "Set to `true` to exclude cases from complexity.",
"type": "boolean",
"default": false
}
}
},
"direct_return": {
"allOf": [
{
"title": "direct_return",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/direct_return.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"discarded_notification_center_observer": {
"allOf": [
{
"title": "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.\nDocumentation: https://realm.github.io/SwiftLint/discarded_notification_center_observer.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"discouraged_assert": {
"allOf": [
{
"title": "Discouraged Assert",
"description": "Prefer `assertionFailure()` and/or `preconditionFailure()` over `assert(false)`.\nDocumentation: https://realm.github.io/SwiftLint/discouraged_assert.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"discouraged_none_name": {
"allOf": [
{
"title": "Discouraged None Name",
"description": "Enum cases and static members named `none` are discouraged as they can conflict with `Optional<T>.none`.\nDocumentation: https://realm.github.io/SwiftLint/discouraged_none_name.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"discouraged_optional_boolean": {
"allOf": [
{
"title": "Discouraged Optional Boolean",
"description": "Prefer non-optional booleans over optional booleans.\nDocumentation: https://realm.github.io/SwiftLint/discouraged_optional_boolean.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"discouraged_optional_collection": {
"allOf": [
{
"title": "Discouraged Optional Collection",
"description": "Prefer empty collection over optional collection.\nDocumentation: https://realm.github.io/SwiftLint/discouraged_optional_collection.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"duplicate_conditions": {
"allOf": [
{
"title": "Duplicate Conditions",
"description": "Duplicate sets of conditions in the same branch instruction should be avoided.\nDocumentation: https://realm.github.io/SwiftLint/duplicate_conditions.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"duplicate_enum_cases": {
"allOf": [
{
"title": "Duplicate Enum Cases",
"description": "Enum shouldn't contain multiple cases with the same name.\nDocumentation: https://realm.github.io/SwiftLint/duplicate_enum_cases.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"duplicate_imports": {
"allOf": [
{
"title": "Duplicate Imports",
"description": "Imports should be unique.\nDocumentation: https://realm.github.io/SwiftLint/duplicate_imports.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"duplicated_key_in_dictionary_literal": {
"allOf": [
{
"title": "Duplicated Key in Dictionary Literal",
"description": "Dictionary literals with duplicated keys will crash at runtime.\nDocumentation: https://realm.github.io/SwiftLint/duplicated_key_in_dictionary_literal.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"dynamic_inline": {
"allOf": [
{
"title": "Dynamic Inline",
"description": "Avoid using `dynamic` and `@inline(__always)` together.\nDocumentation: https://realm.github.io/SwiftLint/dynamic_inline.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"empty_collection_literal": {
"allOf": [
{
"title": "Empty Collection Literal",
"description": "Prefer checking `isEmpty` over comparing collection to an empty array or dictionary literal.\nDocumentation: https://realm.github.io/SwiftLint/empty_collection_literal.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"empty_enum_arguments": {
"allOf": [
{
"title": "Empty Enum Arguments",
"description": "Arguments can be omitted when matching enums with associated values if they are not used.\nDocumentation: https://realm.github.io/SwiftLint/empty_enum_arguments.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"empty_parameters": {
"allOf": [
{
"title": "Empty Parameters",
"description": "Prefer `() ->` over `Void ->`.\nDocumentation: https://realm.github.io/SwiftLint/empty_parameters.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"empty_parentheses_with_trailing_closure": {
"allOf": [
{
"title": "Empty Parentheses with Trailing Closure",
"description": "When using trailing closures, empty parentheses should be avoided after the method call.\nDocumentation: https://realm.github.io/SwiftLint/empty_parentheses_with_trailing_closure.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"empty_string": {
"allOf": [
{
"title": "Empty String",
"description": "Prefer checking `isEmpty` over comparing string to an empty string literal.\nDocumentation: https://realm.github.io/SwiftLint/empty_string.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"explicit_acl": {
"allOf": [
{
"title": "Explicit ACL",
"description": "All declarations should specify Access Control Level keywords explicitly.\nDocumentation: https://realm.github.io/SwiftLint/explicit_acl.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"explicit_enum_raw_value": {
"allOf": [
{
"title": "Explicit Enum Raw Value",
"description": "Enums should be explicitly assigned their raw values.\nDocumentation: https://realm.github.io/SwiftLint/explicit_enum_raw_value.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"explicit_self": {
"allOf": [
{
"title": "Explicit Self",
"description": "Instance variables and functions should be explicitly accessed with `self`.\nDocumentation: https://realm.github.io/SwiftLint/explicit_self.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"explicit_top_level_acl": {
"allOf": [
{
"title": "Explicit Top Level ACL",
"description": "Top-level declarations should specify Access Control Level keywords explicitly.\nDocumentation: https://realm.github.io/SwiftLint/explicit_top_level_acl.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"extension_access_modifier": {
"allOf": [
{
"title": "Extension Access Modifier",
"description": "Prefer to use extension access modifiers.\nDocumentation: https://realm.github.io/SwiftLint/extension_access_modifier.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"fallthrough": {
"allOf": [
{
"title": "Fallthrough",
"description": "Fallthrough should be avoided.\nDocumentation: https://realm.github.io/SwiftLint/fallthrough.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"fatal_error_message": {
"allOf": [
{
"title": "Fatal Error Message",
"description": "A `fatalError` call should have a message.\nDocumentation: https://realm.github.io/SwiftLint/fatal_error_message.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"file_header": {
"allOf": [
{
"title": "File Header",
"description": "Header comments should be consistent with project patterns. The SWIFTLINT_CURRENT_FILENAME placeholder can optionally be used in the required and forbidden patterns. It will be replaced by the real file name.\nDocumentation: https://realm.github.io/SwiftLint/file_header.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"first_where": {
"allOf": [
{
"title": "First Where",
"description": "Prefer using `.first(where:)` over `.filter { }.first` in collections.\nDocumentation: https://realm.github.io/SwiftLint/first_where.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"flatmap_over_map_reduce": {
"allOf": [
{
"title": "Flat Map over Map Reduce",
"description": "Prefer `flatMap` over `map` followed by `reduce([], +)`.\nDocumentation: https://realm.github.io/SwiftLint/flatmap_over_map_reduce.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"force_cast": {
"allOf": [
{
"title": "Force Cast",
"description": "Force casts should be avoided.\nDocumentation: https://realm.github.io/SwiftLint/force_cast.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"force_try": {
"allOf": [
{
"title": "Force Try",
"description": "Force tries should be avoided.\nDocumentation: https://realm.github.io/SwiftLint/force_try.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"force_unwrapping": {
"allOf": [
{
"title": "Force Unwrapping",
"description": "Force unwrapping should be avoided.\nDocumentation: https://realm.github.io/SwiftLint/force_unwrapping.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"function_default_parameter_at_end": {
"allOf": [
{
"title": "Function Default Parameter at End",
"description": "Prefer to locate parameters with defaults toward the end of the parameter list.\nDocumentation: https://realm.github.io/SwiftLint/function_default_parameter_at_end.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"ibinspectable_in_extension": {
"allOf": [
{
"title": "IBInspectable in Extension",
"description": "Extensions shouldn't add `@IBInspectable` properties.\nDocumentation: https://realm.github.io/SwiftLint/ibinspectable_in_extension.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"identical_operands": {
"allOf": [
{
"title": "Identical Operands",
"description": "Comparing two identical operands is likely a mistake.\nDocumentation: https://realm.github.io/SwiftLint/identical_operands.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"implicit_getter": {
"allOf": [
{
"title": "Implicit Getter",
"description": "Computed read-only properties and subscripts should avoid using the get keyword.\nDocumentation: https://realm.github.io/SwiftLint/implicit_getter.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"implicit_return": {
"title": "Implicit Return",
"description": "Prefer implicit returns in closures, functions and getters.\nDocumentation: https://realm.github.io/SwiftLint/implicit_return.html",
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/Severity"
},
"included": {
"type": "array",
"items": {
"type": "string",
"enum": [
"closure",
"function",
"getter",
"initializer",
"subscript"
]
}
}
}
},
"inclusive_language": {
"allOf": [
{
"title": "Inclusive Language",
"description": "Identifiers should use inclusive language that avoids discrimination against groups of people based on race, gender, or socioeconomic status.\nDocumentation: https://realm.github.io/SwiftLint/inclusive_language.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"inert_defer": {
"allOf": [
{
"title": "Inert Defer",
"description": "If defer is at the end of its parent scope, it will be executed right where it is anyway.\nDocumentation: https://realm.github.io/SwiftLint/inert_defer.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"invalid_swiftlint_command": {
"allOf": [
{
"title": "Invalid SwiftLint Command",
"description": "swiftlint command is invalid.\nDocumentation: https://realm.github.io/SwiftLint/invalid_swiftlint_command.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"is_disjoint": {
"allOf": [
{
"title": "Is Disjoint",
"description": "Prefer using `Set.isDisjoint(with:)` over `Set.intersection(_:).isEmpty`.\nDocumentation: https://realm.github.io/SwiftLint/is_disjoint.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"joined_default_parameter": {
"allOf": [
{
"title": "Joined Default Parameter",
"description": "Discouraged explicit usage of the default separator.\nDocumentation: https://realm.github.io/SwiftLint/joined_default_parameter.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"last_where": {
"allOf": [
{
"title": "Last Where",
"description": "Prefer using `.last(where:)` over `.filter { }.last` in collections.\nDocumentation: https://realm.github.io/SwiftLint/last_where.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"leading_whitespace": {
"allOf": [
{
"title": "Leading Whitespace",
"description": "Files should not contain leading whitespace.\nDocumentation: https://realm.github.io/SwiftLint/leading_whitespace.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"legacy_cggeometry_functions": {
"allOf": [
{
"title": "Legacy CGGeometry Functions",
"description": "Struct extension properties and methods are preferred over legacy functions.\nDocumentation: https://realm.github.io/SwiftLint/legacy_cggeometry_functions.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"legacy_constant": {
"allOf": [
{
"title": "Legacy Constant",
"description": "Struct-scoped constants are preferred over legacy global constants.\nDocumentation: https://realm.github.io/SwiftLint/legacy_constant.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"legacy_constructor": {
"allOf": [
{
"title": "Legacy Constructor",
"description": "Swift constructors are preferred over legacy convenience functions.\nDocumentation: https://realm.github.io/SwiftLint/legacy_constructor.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"legacy_hashing": {
"allOf": [
{
"title": "Legacy Hashing",
"description": "Prefer using the `hash(into:)` function instead of overriding `hashValue`.\nDocumentation: https://realm.github.io/SwiftLint/legacy_hashing.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"legacy_multiple": {
"allOf": [
{
"title": "Legacy Multiple",
"description": "Prefer using the `isMultiple(of:)` function instead of using the remainder operator (`%`).\nDocumentation: https://realm.github.io/SwiftLint/legacy_multiple.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"legacy_nsgeometry_functions": {
"allOf": [
{
"title": "Legacy NSGeometry Functions",
"description": "Struct extension properties and methods are preferred over legacy functions.\nDocumentation: https://realm.github.io/SwiftLint/legacy_nsgeometry_functions.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"legacy_objc_type": {
"allOf": [
{
"title": "Legacy Objective-C Reference Type",
"description": "Prefer Swift value types to bridged Objective-C reference types.\nDocumentation: https://realm.github.io/SwiftLint/legacy_objc_type.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"legacy_random": {
"allOf": [
{
"title": "Legacy Random",
"description": "Prefer using `type.random(in:)` over legacy functions.\nDocumentation: https://realm.github.io/SwiftLint/legacy_random.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"let_var_whitespace": {
"allOf": [
{
"title": "Variable Declaration Whitespace",
"description": "Variable declarations should be separated from other statements by a blank line.\nDocumentation: https://realm.github.io/SwiftLint/let_var_whitespace.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"literal_expression_end_indentation": {
"allOf": [
{
"title": "Literal Expression End Indentation",
"description": "Array and dictionary literal end should have the same indentation as the line that started it.\nDocumentation: https://realm.github.io/SwiftLint/literal_expression_end_indentation.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"local_doc_comment": {
"allOf": [
{
"title": "Local Doc Comment",
"description": "Prefer regular comments over doc comments in local scopes.\nDocumentation: https://realm.github.io/SwiftLint/local_doc_comment.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"lower_acl_than_parent": {
"allOf": [
{
"title": "Lower ACL than Parent",
"description": "Ensure declarations have a lower access control level than their enclosing parent.\nDocumentation: https://realm.github.io/SwiftLint/lower_acl_than_parent.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"mark": {
"allOf": [
{
"title": "Mark",
"description": "MARK comment should be in valid format. e.g. `// MARK: …` or `// MARK: - …`.\nDocumentation: https://realm.github.io/SwiftLint/mark.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"multiline_arguments_brackets": {
"allOf": [
{
"title": "Multiline Arguments Brackets",
"description": "Multiline arguments should have their surrounding brackets in a new line.\nDocumentation: https://realm.github.io/SwiftLint/multiline_arguments_brackets.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"multiline_function_chains": {
"allOf": [
{
"title": "Multiline Function Chains",
"description": "Chained function calls should be either on the same line, or one per line.\nDocumentation: https://realm.github.io/SwiftLint/multiline_function_chains.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"multiline_literal_brackets": {
"allOf": [
{
"title": "Multiline Literal Brackets",
"description": "Multiline literals should have their surrounding brackets in a new line.\nDocumentation: https://realm.github.io/SwiftLint/multiline_literal_brackets.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"multiline_parameters_brackets": {
"allOf": [
{
"title": "Multiline Parameters Brackets",
"description": "Multiline parameters should have their surrounding brackets in a new line.\nDocumentation: https://realm.github.io/SwiftLint/multiline_parameters_brackets.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"multiple_closures_with_trailing_closure": {
"allOf": [
{
"title": "Multiple Closures with Trailing Closure",
"description": "Trailing closure syntax should not be used when passing more than one closure argument.\nDocumentation: https://realm.github.io/SwiftLint/multiple_closures_with_trailing_closure.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"nimble_operator": {
"allOf": [
{
"title": "Nimble Operator",
"description": "Prefer Nimble operator overloads over free matcher functions.\nDocumentation: https://realm.github.io/SwiftLint/nimble_operator.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"no_extension_access_modifier": {
"allOf": [
{
"title": "No Extension Access Modifier",
"description": "Prefer not to use extension access modifiers.\nDocumentation: https://realm.github.io/SwiftLint/no_extension_access_modifier.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"no_fallthrough_only": {
"allOf": [
{
"title": "No Fallthrough only",
"description": "Fallthroughs can only be used if the `case` contains at least one other statement.\nDocumentation: https://realm.github.io/SwiftLint/no_fallthrough_only.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"no_grouping_extension": {
"allOf": [
{
"title": "No Grouping Extension",
"description": "Extensions shouldn’t be used to group code within the same source file.\nDocumentation: https://realm.github.io/SwiftLint/no_grouping_extension.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"no_space_in_method_call": {
"allOf": [
{
"title": "No Space in Method Call",
"description": "Don’t add a space between the method name and the parentheses.\nDocumentation: https://realm.github.io/SwiftLint/no_space_in_method_call.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"non_optional_string_data_conversion": {
"allOf": [
{
"title": "Non-Optional String <-> Data Conversion",
"description": "Prefer using UTF-8 encoded strings when converting between `String` and `Data`.\nDocumentation: https://realm.github.io/SwiftLint/non_optional_string_data_conversion.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"notification_center_detachment": {
"allOf": [
{
"title": "Notification Center Detachment",
"description": "An object should only remove itself as an observer in `deinit`.\nDocumentation: https://realm.github.io/SwiftLint/notification_center_detachment.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"ns_number_init_as_function_reference": {
"allOf": [
{
"title": "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.\nDocumentation: https://realm.github.io/SwiftLint/ns_number_init_as_function_reference.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"nslocalizedstring_key": {
"allOf": [
{
"title": "NSLocalizedString Key",
"description": "Static strings should be used as key/comment in `NSLocalizedString` in order for genstrings to work.\nDocumentation: https://realm.github.io/SwiftLint/nslocalizedstring_key.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"nslocalizedstring_require_bundle": {
"allOf": [
{
"title": "NSLocalizedString Require Bundle",
"description": "Calls to `NSLocalizedString` should specify the bundle which contains the strings file.\nDocumentation: https://realm.github.io/SwiftLint/nslocalizedstring_require_bundle.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"nsobject_prefer_isequal": {
"allOf": [
{
"title": "NSObject Prefer isEqual",
"description": "NSObject subclasses should implement `isEqual` instead of `==`.\nDocumentation: https://realm.github.io/SwiftLint/nsobject_prefer_isequal.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"one_declaration_per_file": {
"allOf": [
{
"title": "One Declaration per File",
"description": "Only a single declaration is allowed in a file.\nDocumentation: https://realm.github.io/SwiftLint/one_declaration_per_file.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"operator_whitespace": {
"allOf": [
{
"title": "Operator Function Whitespace",
"description": "Operators should be surrounded by a single whitespace when defining them.\nDocumentation: https://realm.github.io/SwiftLint/operator_whitespace.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"optional_enum_case_matching": {
"allOf": [
{
"title": "Optional Enum Case Match",
"description": "Matching an enum case against an optional enum without ‘?’ is supported on Swift 5.1 and above.\nDocumentation: https://realm.github.io/SwiftLint/optional_enum_case_matching.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"orphaned_doc_comment": {
"allOf": [
{
"title": "Orphaned Doc Comment",
"description": "A doc comment should be attached to a declaration.\nDocumentation: https://realm.github.io/SwiftLint/orphaned_doc_comment.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"override_in_extension": {
"allOf": [
{
"title": "Override in Extension",
"description": "Extensions shouldn’t override declarations.\nDocumentation: https://realm.github.io/SwiftLint/override_in_extension.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"pattern_matching_keywords": {
"allOf": [
{
"title": "Pattern Matching Keywords",
"description": "Combine multiple pattern matching bindings by moving keywords out of tuples.\nDocumentation: https://realm.github.io/SwiftLint/pattern_matching_keywords.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"period_spacing": {
"allOf": [
{
"title": "Period Spacing",
"description": "Periods should not be followed by more than one space.\nDocumentation: https://realm.github.io/SwiftLint/period_spacing.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"prefer_nimble": {
"allOf": [
{
"title": "Prefer Nimble",
"description": "Prefer Nimble matchers over XCTAssert functions.\nDocumentation: https://realm.github.io/SwiftLint/prefer_nimble.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"prefer_self_in_static_references": {
"allOf": [
{
"title": "Prefer Self in Static References",
"description": "Use `Self` to refer to the surrounding type name.\nDocumentation: https://realm.github.io/SwiftLint/prefer_self_in_static_references.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"prefer_self_type_over_type_of_self": {
"allOf": [
{
"title": "Prefer Self Type Over Type of Self",
"description": "Prefer `Self` over `type(of: self)` when accessing properties or calling methods.\nDocumentation: https://realm.github.io/SwiftLint/prefer_self_type_over_type_of_self.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"prefer_zero_over_explicit_init": {
"allOf": [
{
"title": "Prefer Zero Over Explicit Init",
"description": "Prefer `.zero` over explicit init with zero parameters (e.g. `CGPoint(x: 0, y: 0)`).\nDocumentation: https://realm.github.io/SwiftLint/prefer_zero_over_explicit_init.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"private_action": {
"allOf": [
{
"title": "Private Actions",
"description": "IBActions should be private.\nDocumentation: https://realm.github.io/SwiftLint/private_action.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"private_subject": {
"allOf": [
{
"title": "Private Combine Subject",
"description": "Combine Subject should be private.\nDocumentation: https://realm.github.io/SwiftLint/private_subject.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"private_swiftui_state": {
"allOf": [
{
"title": "Private SwiftUI State Properties",
"description": "SwiftUI state properties should be private.\nDocumentation: https://realm.github.io/SwiftLint/private_swiftui_state.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"prohibited_interface_builder": {
"allOf": [
{
"title": "Prohibited Interface Builder",
"description": "Creating views using Interface Builder should be avoided.\nDocumentation: https://realm.github.io/SwiftLint/prohibited_interface_builder.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"protocol_property_accessors_order": {
"allOf": [
{
"title": "Protocol Property Accessors Order",
"description": "When declaring properties in protocols, the order of accessors should be `get set`.\nDocumentation: https://realm.github.io/SwiftLint/protocol_property_accessors_order.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"quick_discouraged_call": {
"allOf": [
{
"title": "Quick Discouraged Call",
"description": "Discouraged call inside `describe` and/or `context` block.\nDocumentation: https://realm.github.io/SwiftLint/quick_discouraged_call.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"quick_discouraged_focused_test": {
"allOf": [
{
"title": "Quick Discouraged Focused Test",
"description": "Non-focused tests won’t run as long as this test is focused.\nDocumentation: https://realm.github.io/SwiftLint/quick_discouraged_focused_test.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"quick_discouraged_pending_test": {
"allOf": [
{
"title": "Quick Discouraged Pending Test",
"description": "This test won’t run as long as it’s marked pending.\nDocumentation: https://realm.github.io/SwiftLint/quick_discouraged_pending_test.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"raw_value_for_camel_cased_codable_enum": {
"allOf": [
{
"title": "Raw Value for Camel Cased Codable Enum",
"description": "Camel cased cases of Codable String enums should have raw values.\nDocumentation: https://realm.github.io/SwiftLint/raw_value_for_camel_cased_codable_enum.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"reduce_boolean": {
"allOf": [
{
"title": "Reduce Boolean",
"description": "Prefer using `.allSatisfy()` or `.contains()` over `reduce(true)` or `reduce(false)`.\nDocumentation: https://realm.github.io/SwiftLint/reduce_boolean.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"reduce_into": {
"allOf": [
{
"title": "Reduce into",
"description": "Prefer `reduce(into:_:)` over `reduce(_:_:)` for copy-on-write types.\nDocumentation: https://realm.github.io/SwiftLint/reduce_into.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"redundant_discardable_let": {
"allOf": [
{
"title": "Redundant Discardable Let",
"description": "Prefer `_ = foo()` over `let _ = foo()` when discarding a result from a function.\nDocumentation: https://realm.github.io/SwiftLint/redundant_discardable_let.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"redundant_nil_coalescing": {
"allOf": [
{
"title": "Redundant Nil Coalescing",
"description": "nil coalescing operator is only evaluated if the lhs is nil, coalescing operator with nil as rhs is redundant.\nDocumentation: https://realm.github.io/SwiftLint/redundant_nil_coalescing.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"redundant_objc_attribute": {
"allOf": [
{
"title": "Redundant @objc Attribute",
"description": "Objective-C attribute (@objc) is redundant in declaration.\nDocumentation: https://realm.github.io/SwiftLint/redundant_objc_attribute.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"redundant_optional_initialization": {
"allOf": [
{
"title": "Redundant Optional Initialization",
"description": "Initializing an optional variable with nil is redundant.\nDocumentation: https://realm.github.io/SwiftLint/redundant_optional_initialization.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"redundant_self_in_closure": {
"allOf": [
{
"title": "Redundant Self in Closure",
"description": "Explicit use of `self` is not required.\nDocumentation: https://realm.github.io/SwiftLint/redundant_self_in_closure.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"redundant_set_access_control": {
"allOf": [
{
"title": "Redundant Access Control for Setter",
"description": "Property setter access level shouldn’t be explicit if it’s the same as the variable access level.\nDocumentation: https://realm.github.io/SwiftLint/redundant_set_access_control.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"redundant_string_enum_value": {
"allOf": [
{
"title": "Redundant String Enum Value",
"description": "String enum values can be omitted when they are equal to the enumcase name.\nDocumentation: https://realm.github.io/SwiftLint/redundant_string_enum_value.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"redundant_type_annotation": {
"allOf": [
{
"title": "Redundant Type Annotation",
"description": "Variables should not have redundant type annotation.\nDocumentation: https://realm.github.io/SwiftLint/redundant_type_annotation.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"required_deinit": {
"allOf": [
{
"title": "Required Deinit",
"description": "Classes should have an explicit deinit method.\nDocumentation: https://realm.github.io/SwiftLint/required_deinit.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"return_arrow_whitespace": {
"allOf": [
{
"title": "Returning Whitespace",
"description": "Return arrow and return type should be separated by a single space or on a separate line.\nDocumentation: https://realm.github.io/SwiftLint/return_arrow_whitespace.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"return_value_from_void_function": {
"allOf": [
{
"title": "Return Value from Void Function",
"description": "Returning values from Void functions should be avoided.\nDocumentation: https://realm.github.io/SwiftLint/return_value_from_void_function.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"self_in_property_initialization": {
"allOf": [
{
"title": "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`.\nDocumentation: https://realm.github.io/SwiftLint/self_in_property_initialization.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"shorthand_operator": {
"allOf": [
{
"title": "Shorthand Operator",
"description": "Prefer shorthand operators (`+=`, `-=`, `*=`, `/=`) over doing the operation and assigning.\nDocumentation: https://realm.github.io/SwiftLint/shorthand_operator.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"shorthand_optional_binding": {
"allOf": [
{
"title": "Shorthand Optional Binding",
"description": "Use shorthand syntax for optional binding.\nDocumentation: https://realm.github.io/SwiftLint/shorthand_optional_binding.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"sorted_enum_cases": {
"allOf": [
{
"title": "Sorted Enum Cases",
"description": "Enum cases should be sorted.\nDocumentation: https://realm.github.io/SwiftLint/sorted_enum_cases.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"sorted_first_last": {
"allOf": [
{
"title": "Min or Max over Sorted First or Last",
"description": "Prefer using `min()` or `max()` over `sorted().first` or `sorted().last`.\nDocumentation: https://realm.github.io/SwiftLint/sorted_first_last.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"static_operator": {
"allOf": [
{
"title": "Static Operator",
"description": "Operators should be declared as static functions, not free functions.\nDocumentation: https://realm.github.io/SwiftLint/static_operator.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"strict_fileprivate": {
"allOf": [
{
"title": "Strict Fileprivate",
"description": "`fileprivate` should be avoided.\nDocumentation: https://realm.github.io/SwiftLint/strict_fileprivate.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"strong_iboutlet": {
"allOf": [
{
"title": "Strong IBOutlet",
"description": "@IBOutlets shouldn’t be declared as `weak`.\nDocumentation: https://realm.github.io/SwiftLint/strong_iboutlet.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"superfluous_disable_command": {
"allOf": [
{
"title": "Superfluous Disable Command",
"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.\nDocumentation: https://realm.github.io/SwiftLint/superfluous_disable_command.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"superfluous_else": {
"allOf": [
{
"title": "Superfluous Else",
"description": "Else branches should be avoided when the previous if-block exits the current scope.\nDocumentation: https://realm.github.io/SwiftLint/superfluous_else.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"switch_case_on_newline": {
"allOf": [
{
"title": "Cases on Newline",
"description": "Cases inside a switch should always be on a newline.\nDocumentation: https://realm.github.io/SwiftLint/switch_case_on_newline.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"syntactic_sugar": {
"allOf": [
{
"title": "Syntactic Sugar",
"description": "Shorthand syntactic sugar should be used, i.e. [Int] instead of Array..\nDocumentation: https://realm.github.io/SwiftLint/syntactic_sugar.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"toggle_bool": {
"allOf": [
{
"title": "Toggle Bool",
"description": "Prefer `someBool.toggle()` over `someBool = !someBool`.\nDocumentation: https://realm.github.io/SwiftLint/toggle_bool.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"trailing_newline": {
"allOf": [
{
"title": "Trailing Newline",
"description": "Files should have a single trailing newline.\nDocumentation: https://realm.github.io/SwiftLint/trailing_newline.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"trailing_semicolon": {
"allOf": [
{
"title": "Trailing Semicolon",
"description": "Lines should not have trailing semicolons.\nDocumentation: https://realm.github.io/SwiftLint/trailing_semicolon.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"typesafe_array_init": {
"allOf": [
{
"title": "Type-safe Array Init",
"description": "Prefer using `Array(seq)` over `seq.map { $0 }` to convert a sequence into an Array.\nDocumentation: https://realm.github.io/SwiftLint/typesafe_array_init.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unavailable_condition": {
"allOf": [
{
"title": "Unavailable Condition",
"description": "Use #unavailable/#available instead of #available/#unavailable with an empty body.\nDocumentation: https://realm.github.io/SwiftLint/unavailable_condition.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unavailable_function": {
"allOf": [
{
"title": "Unavailable Function",
"description": "Unimplemented functions should be marked as unavailable.\nDocumentation: https://realm.github.io/SwiftLint/unavailable_function.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unhandled_throwing_task": {
"allOf": [
{
"title": "Unhandled Throwing Task",
"description": "Errors thrown inside this task are not handled, which may be unexpected.\nHandle errors inside the task, or use `try await` to access the Tasks value and handle errors. See this forum thread for more details: https://forums.swift.org/t/task-initializer-with-throwing-closure-swallows-error/56066. \nDocumentation: https://realm.github.io/SwiftLint/unhandled_throwing_task.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unneeded_break_in_switch": {
"allOf": [
{
"title": "unneeded_break_in_switch",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unneeded_break_in_switch.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unneeded_parentheses_in_closure_argument": {
"allOf": [
{
"title": "unneeded_parentheses_in_closure_argument",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unneeded_parentheses_in_closure_argument.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unneeded_synthesized_initializer": {
"allOf": [
{
"title": "unneeded_synthesized_initializer",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unneeded_synthesized_initializer.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unowned_variable_capture": {
"allOf": [
{
"title": "unowned_variable_capture",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unowned_variable_capture.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"untyped_error_in_catch": {
"allOf": [
{
"title": "untyped_error_in_catch",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/untyped_error_in_catch.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unused_capture_list": {
"allOf": [
{
"title": "unused_capture_list",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unused_capture_list.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unused_closure_parameter": {
"allOf": [
{
"title": "unused_closure_parameter",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unused_closure_parameter.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unused_control_flow_label": {
"allOf": [
{
"title": "unused_control_flow_label",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unused_control_flow_label.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unused_enumerated": {
"allOf": [
{
"title": "unused_enumerated",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unused_enumerated.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"unused_setter_value": {
"allOf": [
{
"title": "unused_setter_value",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/unused_setter_value.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"valid_ibinspectable": {
"allOf": [
{
"title": "valid_ibinspectable",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/valid_ibinspectable.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"vertical_parameter_alignment": {
"allOf": [
{
"title": "vertical_parameter_alignment",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/vertical_parameter_alignment.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"vertical_parameter_alignment_on_call": {
"allOf": [
{
"title": "vertical_parameter_alignment_on_call",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/vertical_parameter_alignment_on_call.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"vertical_whitespace_between_cases": {
"allOf": [
{
"title": "vertical_whitespace_between_cases",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/vertical_whitespace_between_cases.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"vertical_whitespace_opening_braces": {
"allOf": [
{
"title": "vertical_whitespace_opening_braces",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/vertical_whitespace_opening_braces.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"void_function_in_ternary": {
"allOf": [
{
"title": "void_function_in_ternary",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/void_function_in_ternary.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"void_return": {
"allOf": [
{
"title": "void_return",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/void_return.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"weak_delegate": {
"allOf": [
{
"title": "weak_delegate",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/weak_delegate.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"xctfail_message": {
"allOf": [
{
"title": "xctfail_message",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/xctfail_message.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"yoda_condition": {
"allOf": [
{
"title": "yoda_condition",
"description": ".\nDocumentation: https://realm.github.io/SwiftLint/yoda_condition.html"
},
{
"$ref": "#/$defs/ImplicitRule"
}
]
},
"file_length": {
"type": "object",
"description": "Files should not span too many lines.\nDocumentation: https://realm.github.io/SwiftLint/file_length.html",
"properties": {
"warning": {
"type": "integer",
"default": 400
},
"error": {
"type": "integer",
"default": 1000
},
"ignore_comment_only_lines": {
"type": "boolean",
"default": false
}
}
}
},
"$defs": {
"ImplicitRule": {
"oneOf": [
{
"$ref": "#/$defs/Severity"
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"severity": {
"$ref": "#/$defs/Severity"
}
},
"required": [
"severity"
]
}
]
},
"MatchKinds": {
"type": "string",
"enum": [
"argument",
"attribute.builtin",
"attribute.id",
"buildconfig.id",
"buildconfig.keyword",
"comment",
"comment.mark",
"comment.url",
"doccomment",
"doccomment.field",
"identifier",
"keyword",
"number",
"objectliteral",
"parameter",
"placeholder",
"string",
"string_interpolation_anchor",
"typeidentifier"
]
},
"Rule": {
"title": "Rule",
"type": "string",
"enum": [
"accessibility_label_for_image",
"accessibility_trait_for_button",
"anonymous_argument_in_multiline_closure",
"anyobject_protocol",
"array_init",
"attributes",
"balanced_xctest_lifecycle",
"blanket_disable_command",
"block_based_kvo",
"capture_variable",
"class_delegate_protocol",
"closing_brace",
"closure_body_length",
"closure_end_indentation",
"closure_parameter_position",
"closure_spacing",
"collection_alignment",
"colon",
"comma",
"comma_inheritance",
"comment_spacing",
"compiler_protocol_init",
"computed_accessors_order",
"conditional_returns_on_newline",
"contains_over_filter_count",
"contains_over_filter_is_empty",
"contains_over_first_not_nil",
"contains_over_range_nil_comparison",
"control_statement",
"convenience_type",
"custom_rules",
"cyclomatic_complexity",
"deployment_target",
"direct_return",
"discarded_notification_center_observer",
"discouraged_assert",
"discouraged_direct_init",
"discouraged_none_name",
"discouraged_object_literal",
"discouraged_optional_boolean",
"discouraged_optional_collection",
"duplicate_conditions",
"duplicate_enum_cases",
"duplicate_imports",
"duplicated_key_in_dictionary_literal",
"dynamic_inline",
"empty_collection_literal",
"empty_count",
"empty_enum_arguments",
"empty_parameters",
"empty_parentheses_with_trailing_closure",
"empty_string",
"empty_xctest_method",
"enum_case_associated_values_count",
"expiring_todo",
"explicit_acl",
"explicit_enum_raw_value",
"explicit_init",
"explicit_self",
"explicit_top_level_acl",
"explicit_type_interface",
"extension_access_modifier",
"fallthrough",
"fatal_error_message",
"file_header",
"file_length",
"file_name",
"file_name_no_space",
"file_types_order",
"first_where",
"flatmap_over_map_reduce",
"for_where",
"force_cast",
"force_try",
"force_unwrapping",
"function_body_length",
"function_default_parameter_at_end",
"function_parameter_count",
"generic_type_name",
"ibinspectable_in_extension",
"identical_operands",
"identifier_name",
"implicit_getter",
"implicit_return",
"implicitly_unwrapped_optional",
"inclusive_language",
"indentation_width",
"inert_defer",
"invalid_swiftlint_command",
"is_disjoint",
"joined_default_parameter",
"large_tuple",
"last_where",
"leading_whitespace",
"legacy_cggeometry_functions",
"legacy_constant",
"legacy_constructor",
"legacy_hashing",
"legacy_multiple",
"legacy_nsgeometry_functions",
"legacy_objc_type",
"legacy_random",
"let_var_whitespace",
"line_length",
"literal_expression_end_indentation",
"local_doc_comment",
"lower_acl_than_parent",
"mark",
"missing_docs",
"modifier_order",
"multiline_arguments",
"multiline_arguments_brackets",
"multiline_function_chains",
"multiline_literal_brackets",
"multiline_parameters",
"multiline_parameters_brackets",
"multiple_closures_with_trailing_closure",
"nesting",
"nimble_operator",
"no_extension_access_modifier",
"no_fallthrough_only",
"no_grouping_extension",
"no_magic_numbers",
"no_space_in_method_call",
"notification_center_detachment",
"ns_number_init_as_function_reference",
"nslocalizedstring_key",
"nslocalizedstring_require_bundle",
"nsobject_prefer_isequal",
"number_separator",
"object_literal",
"opening_brace",
"operator_usage_whitespace",
"operator_whitespace",
"optional_enum_case_matching",
"orphaned_doc_comment",
"overridden_super_call",
"override_in_extension",
"pattern_matching_keywords",
"period_spacing",
"prefer_nimble",
"prefer_self_in_static_references",
"prefer_self_type_over_type_of_self",
"prefer_zero_over_explicit_init",
"prefixed_toplevel_constant",
"private_action",
"private_outlet",
"private_over_fileprivate",
"private_subject",
"private_unit_test",
"prohibited_interface_builder",
"prohibited_super_call",
"protocol_property_accessors_order",
"quick_discouraged_call",
"quick_discouraged_focused_test",
"quick_discouraged_pending_test",
"raw_value_for_camel_cased_codable_enum",
"reduce_boolean",
"reduce_into",
"redundant_discardable_let",
"redundant_nil_coalescing",
"redundant_objc_attribute",
"redundant_optional_initialization",
"redundant_self_in_closure",
"redundant_set_access_control",
"redundant_string_enum_value",
"redundant_type_annotation",
"redundant_void_return",
"required_deinit",
"required_enum_case",
"return_arrow_whitespace",
"return_value_from_void_function",
"self_binding",
"self_in_property_initialization",
"shorthand_operator",
"shorthand_optional_binding",
"single_test_class",
"sorted_enum_cases",
"sorted_first_last",
"sorted_imports",
"statement_position",
"static_operator",
"strict_fileprivate",
"strong_iboutlet",
"superfluous_disable_command",
"superfluous_else",
"switch_case_alignment",
"switch_case_on_newline",
"syntactic_sugar",
"test_case_accessibility",
"todo",
"toggle_bool",
"trailing_closure",
"trailing_comma",
"trailing_newline",
"trailing_semicolon",
"trailing_whitespace",
"type_body_length",
"type_contents_order",
"type_name",
"typesafe_array_init",
"unavailable_condition",
"unavailable_function",
"unhandled_throwing_task",
"unneeded_break_in_switch",
"unneeded_parentheses_in_closure_argument",
"unneeded_synthesized_initializer",
"unowned_variable_capture",
"untyped_error_in_catch",
"unused_capture_list",
"unused_closure_parameter",
"unused_control_flow_label",
"unused_declaration",
"unused_enumerated",
"unused_import",
"unused_optional_binding",
"unused_setter_value",
"valid_ibinspectable",
"vertical_parameter_alignment",
"vertical_parameter_alignment_on_call",
"vertical_whitespace",
"vertical_whitespace_between_cases",
"vertical_whitespace_closing_braces",
"vertical_whitespace_opening_braces",
"void_function_in_ternary",
"void_return",
"weak_delegate",
"xct_specific_matcher",
"xctfail_message",
"yoda_condition"
]
},
"Severity": {
"title": "Severity",
"description": "Severity level of the reported violation.",
"type": "string",
"enum": [
"warning",
"error"
]
},
"SeverityDefaultError": {
"allOf": [
{
"$ref": "#/$defs/Severity"
},
{
"default": "error"
}
]
},
"SeverityDefaultWarning": {
"allOf": [
{
"$ref": "#/$defs/Severity"
},
{
"default": "warning"
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment