Last active
August 9, 2019 06:20
-
-
Save dklinzh/c69e6ce02a56c9d53986a8c284b1c0e3 to your computer and use it in GitHub Desktop.
SwiftLint Configuration. [Rules](https://github.com/realm/SwiftLint/blob/master/Rules.md)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# included: | |
excluded: | |
- Pods | |
- R.generated.swift | |
# analyzer_rules: | |
disabled_rules: | |
- function_body_length | |
- cyclomatic_complexity | |
- function_parameter_count | |
- force_cast | |
- type_body_length | |
- file_length | |
- large_tuple | |
opt_in_rules: | |
- anyobject_protocol | |
- array_init | |
- attributes | |
# - closure_body_length | |
- closure_end_indentation | |
- closure_spacing | |
- collection_alignment | |
- conditional_returns_on_newline | |
- contains_over_first_not_nil | |
- convenience_type | |
- discouraged_object_literal | |
- discouraged_optional_boolean | |
# - discouraged_optional_collection | |
- empty_count | |
- empty_string | |
# - empty_xctest_method | |
# - 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_types_order | |
- first_where | |
# - force_unwrapping | |
# - function_default_parameter_at_end | |
- identical_operands | |
- implicit_return | |
- implicitly_unwrapped_optional | |
- joined_default_parameter | |
- last_where | |
- legacy_multiple | |
- legacy_random | |
- let_var_whitespace | |
- literal_expression_end_indentation | |
- 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 | |
- nslocalizedstring_key | |
- nslocalizedstring_require_bundle | |
- number_separator | |
- object_literal | |
- operator_usage_whitespace | |
- overridden_super_call | |
- override_in_extension | |
- pattern_matching_keywords | |
- prefixed_toplevel_constant | |
- private_action | |
- private_outlet | |
- prohibited_interface_builder | |
- prohibited_super_call | |
- quick_discouraged_call | |
- quick_discouraged_focused_test | |
- quick_discouraged_pending_test | |
- reduce_into | |
- redundant_nil_coalescing | |
- redundant_type_annotation | |
# - required_deinit | |
- required_enum_case | |
- single_test_class | |
- sorted_first_last | |
- sorted_imports | |
- static_operator | |
- strict_fileprivate | |
- strong_iboutlet | |
- switch_case_on_newline | |
- toggle_bool | |
# - trailing_closure | |
- type_contents_order | |
- unavailable_function | |
# - unneeded_parentheses_in_closure_argument | |
- unowned_variable_capture | |
- untyped_error_in_catch | |
- unused_import | |
- unused_private_declaration | |
- vertical_parameter_alignment_on_call | |
- vertical_whitespace_between_cases | |
- vertical_whitespace_closing_braces | |
# - vertical_whitespace_opening_braces | |
- xct_specific_matcher | |
- yoda_condition | |
# force_cast: warning | |
line_length: | |
warning: 140 | |
ignores_urls: true | |
# ignores_function_declarations: true | |
ignores_comments: true | |
# identifier_name: | |
# allowed_symbols: "_" | |
# excluded: | |
# - id | |
conditional_returns_on_newline: | |
if_only: true | |
# custom_rules: | |
# auto_generated_leftovers: | |
# regex: 'func [^\n]*\{\n(\s*super\.[^\n]*\n(\s*\/\/[^\n]*\n)*|(\s*\/\/[^\n]*\n)+)\s*\}' | |
# message: "Delete auto-generated functions that you don't use" | |
# numbers_smell: | |
# regex: '(return |case |\w\(|: |\?\? |\, |== |<=? |>=? |\+= |\-= |\/= |\*= |%= |\w\.\w+ = )\(*\d{2,}' | |
# message: "Numbers smell; define a constant instead." | |
# non_localized_word: | |
# regex: '(?<!NSLocalizedString\()"[[:upper:]][[:lower:]]+"' | |
# message: "Wrap string in NSLocalizedString()" | |
# non_localized_sentence: | |
# regex: '(?<!NSLocalizedString\(|fatalError\(|\S)"[^"]+ [^"]*"' | |
# message: "Wrap string in NSLocalizedString()" | |
# non_localized_multiline: | |
# regex: '(?<!NSLocalizedString\()""".*?"""' | |
# message: "Wrap string in NSLocalizedString()" | |
# already_true: | |
# regex: "== true" | |
# message: "Don't compare to true, just use the bool value." | |
# already_bool: | |
# regex: "== false" | |
# message: "Don't compare to false, just use !value." | |
# commented_code: | |
# regex: '(?<!:|\/)\/\/\h*[a-z.](?!wiftlint)' | |
# message: "Comment starting with lowercase letter - did you forget to delete old code?" | |
# multiline_commented_code: | |
# regex: '^\s*[a-z]' | |
# match_kinds: comment | |
# message: "Comment starting with lowercase letter - did you forget to delete old code?" | |
# fatal_error: | |
# name: Fatal Error | |
# excluded: "Tests/*" | |
# message: Prefer using `queuedFatalError` over `fatalError` to avoid leaking compiler host machine paths. | |
# regex: \bfatalError\b | |
# match_kinds: | |
# - identifier | |
# severity: error | |
# comments_space: | |
# name: "Space After Comment" | |
# regex: '(^ *//\w+)' | |
# message: "There should be a space after //" | |
# severity: warning | |
# explicit_failure_calls: | |
# name: “Avoid asserting ‘false’” | |
# regex: ‘((assert|precondition)\(false)’ | |
# message: “Use assertionFailure() or preconditionFailure() instead.” | |
# severity: warning | |
# multiple_empty_lines: | |
# name: "Multiple Empty Lines" | |
# regex: '((?:\s*\n){3,})' | |
# message: "There are too many line breaks" | |
# severity: error | |
# comments_capitalized_find_possible_code: | |
# name: "Catch Commented Out Code" | |
# regex: "(^ *// +(?!swiftlint)[a-z]+)" | |
# message: "The first word of a comment should be capitalized" | |
# severity: warning | |
# empty_line_after_guard: | |
# name: "Empty Line After Guard" | |
# regex: "(^ *guard[ a-zA-Z0-9=?.\(\),><!]*\{[ a-zA-Z0-9=?.\(\),><!]*\}\n *(?!(?:return|guard))\S+)" | |
# message: "There should be an empty line after a guard" | |
# severity: error | |
# empty_line_after_super: | |
# name: "Empty Line After Super" | |
# regex: "(^ *super\.[ a-zA-Z0-9=?.\(\)\{\}:,><!]*\n *(?!(?:\}|return))\S+)" | |
# message: "There should be an empty line after super" | |
# severity: error | |
# protocol_conformance: | |
# name: "Protocol Conformance" | |
# message: "Protocol conformance should be declared in separate extensions in the same file" | |
# regex: "(class|struct|extension)[[:space:]]+(?i:(?![^d]*delegate:))[^'\"()<>{},!?:]+:([^'\"<>(){},!?:]+,)+[^'\"<>(){},!?:]*\\{" | |
# match_kinds: | |
# - keyword | |
# severity: warning | |
# computed_property: | |
# name: "Computed Properties" | |
# message: "The get clause should be omitted if the computed property is read only" | |
# regex: "var[[:space:]]+[^:]+:[^{]*\\{[[:space:]]*get[[:space:]]*\\{[^}]+\\}(?![[:space:]]*set)" | |
# match_kinds: | |
# - keyword | |
# severity: warning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment