BuildScripts/xcode/.swiftlint.yml

163 lines
3.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

opt_in_rules:
# performance
- first_where
- last_where
- empty_string
- empty_count
# idiomatic
- legacy_random
- pattern_matching_keywords
- redundant_nil_coalescing
- redundant_type_annotation
- static_operator
- toggle_bool
- joined_default_parameter
- implicitly_unwrapped_optional
- convenience_type
- object_literal
- force_unwrapping
- force_cast
- force_try
- fatal_error_message
- extension_access_modifier
- explicit_init
# style
- literal_expression_end_indentation
- multiline_function_chains
- multiline_literal_brackets
- multiline_parameters
- operator_usage_whitespace
- switch_case_on_newline
- unneeded_parentheses_in_closure_argument
- vertical_parameter_alignment_on_call
- vertical_whitespace_between_cases
- vertical_whitespace_closing_braces
- yoda_condition
- number_separator
- let_var_whitespace
- implicit_return
- conditional_returns_on_newline
- closure_spacing
- closure_end_indentation
# lint
- private_action
- private_outlet
- prohibited_super_call
- unused_import
- unused_private_declaration
- identical_operands
- overridden_super_call
excluded:
- Carthage
- Pods
- Generated
line_length: 128
cyclomatic_complexity:
ignores_case_statements: true
type_body_length:
- 500 # warning
- 700 # error
file_length:
warning: 500
error: 1200
function_parameter_count:
error: 5
identifier_name:
excluded:
- id
- ok
- URL
- x
- y
- z
warning_threshold: 1
custom_rules:
uiwebview_disabled:
included: ".*.swift"
name: "UIWebView Usage Disabled"
regex: 'UIWebView'
message: "Do not use UIWebView. Use WKWebView Instead. https://developer.apple.com/reference/uikit/uiwebview"
severity: error
native_print:
name: "print -> DDLog"
regex: '(print|NSLog)\('
message: "Please use CocoaLumberjack instead `print` and `NSlog`"
severity: error
zero:
name: "Short .zero"
regex: '\(top: 0, left: 0, bottom: 0, right: 0\)'
message: "Please use short init `.zero`."
severity: error
private_variable:
name: "Private variable"
regex: '(?<!private\s\w*)let\s\w*(:|(\s=))\sVariable'
message: "Please use (file)private with variable."
severity: error
let_variable:
name: "Let Variable"
regex: 'var\s\w*(:|(\s=))\sVariable'
message: "Please make variable using `let`."
severity: error
marks_style:
name: "Marks"
regex: '// MARK: -?[a-zA-Z0-9]'
message: "Marks should follow the following structure: // MARK: - Comment."
severity: warning
no_header_comments:
name: "Header Comments"
regex: '//\s*Created by.*\s*//\s*Copyright'
match_kinds:
- comment
message: "Template header comments should be removed."
unnecessary_type:
name: "Unnecessary Type"
regex: '[ @a-zA-Z]*(?:let|var)\s\w*: ([a-zA-Z0-9]*)\?? = \1'
message: "Type definition not needed"
severity: error
unowned:
name: "Unowned"
regex: 'unowned'
message: "Please use `weak` instead. "
severity: error
continue_keyword:
name: "Continue"
regex: 'continue'
message: "Don't use continue instruction"
severity: error
match_kinds: keyword
cyrillic_strings:
name: "Cyrillic strings"
regex: '[а-яА-Я]+'
message: "Localize or translate"
severity: error
match_kinds:
- identifier
- string