update SwiftLint config to support latest 0.52.2 version features #5
|
|
@ -15,7 +15,6 @@ opt_in_rules:
|
|||
|
||||
# idiomatic
|
||||
|
||||
- legacy_random
|
||||
- legacy_multiple
|
||||
- pattern_matching_keywords
|
||||
- redundant_nil_coalescing
|
||||
|
|
@ -32,8 +31,12 @@ opt_in_rules:
|
|||
- fatal_error_message
|
||||
- extension_access_modifier
|
||||
- explicit_init
|
||||
- prefer_zero_over_explicit_init
|
||||
- fallthrough
|
||||
- unavailable_function
|
||||
- prefer_zero_over_explicit_init
|
||||
- discouraged_assert
|
||||
- discouraged_none_name
|
||||
|
vladimir.makarov marked this conversation as resolved
|
||||
- shorthand_optional_binding
|
||||
|
||||
# style
|
||||
|
||||
|
|
@ -55,29 +58,45 @@ opt_in_rules:
|
|||
- closure_spacing
|
||||
- closure_end_indentation
|
||||
- prefer_self_type_over_type_of_self
|
||||
- closure_parameter_position
|
||||
- comma_inheritance
|
||||
- self_binding
|
||||
- prefer_self_in_static_references
|
||||
- direct_return
|
||||
- period_spacing
|
||||
|
||||
# lint
|
||||
|
||||
- private_action
|
||||
- private_outlet
|
||||
- prohibited_super_call
|
||||
- unused_import
|
||||
- unused_declaration
|
||||
- identical_operands
|
||||
- overridden_super_call
|
||||
- unowned_variable_capture
|
||||
- strong_iboutlet
|
||||
- lower_acl_than_parent
|
||||
- comment_spacing
|
||||
- ibinspectable_in_extension
|
||||
- private_subject
|
||||
- unhandled_throwing_task
|
||||
|
||||
# metrics
|
||||
|
||||
- enum_case_associated_values_count
|
||||
|
||||
analyzer_rules:
|
||||
- capture_variable
|
||||
- typesafe_array_init
|
||||
- unused_declaration
|
||||
- unused_import
|
||||
|
||||
excluded:
|
||||
- Carthage
|
||||
- Pods
|
||||
- Generated
|
||||
- "**/Generated"
|
||||
- "**/Resources"
|
||||
- ".gem"
|
||||
|
||||
line_length:
|
||||
warning: 128
|
||||
|
|
@ -109,6 +128,7 @@ identifier_name:
|
|||
- id
|
||||
- ok
|
||||
- URL
|
||||
- qr
|
||||
- x
|
||||
- y
|
||||
- z
|
||||
|
|
@ -121,30 +141,17 @@ custom_rules:
|
|||
|
||||
# General
|
||||
|
||||
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
|
||||
|
||||
uiedge_insets_zero:
|
||||
name: "UIEdgeInsets .zero"
|
||||
regex: '\(top: 0, left: 0, bottom: 0, right: 0\)'
|
||||
message: "Please use short init `.zero`."
|
||||
severity: error
|
||||
|
||||
let_variable:
|
||||
name: "Let Variable"
|
||||
regex: 'var\s\w*(:|(\s=))\sVariable'
|
||||
message: "Please make variable using `let`."
|
||||
unsecure_logging:
|
||||
name: "Unsecure logging"
|
||||
regex: '\s(print|debugPrint|NSLog)\('
|
||||
message: "Please use os_log or remove this debug statement"
|
||||
severity: error
|
||||
excluded_match_kinds:
|
||||
- comment
|
||||
- comment.mark
|
||||
- comment.url
|
||||
- doccomment
|
||||
- doccomment.field
|
||||
|
||||
marks_style:
|
||||
name: "Marks"
|
||||
|
|
@ -165,19 +172,12 @@ custom_rules:
|
|||
message: "Type definition not needed"
|
||||
severity: error
|
||||
|
||||
unowned:
|
||||
name: "Unowned"
|
||||
unsafe_unowned:
|
||||
name: "Unsafe unowned usage"
|
||||
regex: 'unowned'
|
||||
message: "Please use `weak` instead. "
|
||||
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: '[а-яА-Я]+'
|
||||
|
|
@ -237,12 +237,6 @@ custom_rules:
|
|||
message: "Use сontentView instead of self for addSubview or addSubviews methods in cell."
|
||||
severity: warning
|
||||
|
||||
redundant_type_annotation_bool:
|
||||
name: "Redundant type annotation for Bool"
|
||||
regex: '\s((var|let))\s{1,}\w+ *((: *Bool *=)|((\w| |<|>|:)*= *BehaviorRelay<Bool>\( *value *:)) *((true)|(false))'
|
||||
message: "Using a type annotation for Bool is redundant."
|
||||
severity: warning
|
||||
|
||||
parameter_repetition:
|
||||
name: "Parameter repetition"
|
||||
regex: 'func ((\w+([A-Z]\w+))|(\w+)) *(<[^>]+>)? *\( *(?i)(\3|\4):'
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ fi
|
|||
if [ ! -z "${FORCE_LINT}" ]; then
|
||||
# Если задана переменная FORCE_LINT, то проверяем все файлы проекта
|
||||
for SOURCE_DIR in ${SOURCES_DIRS}; do
|
||||
${SWIFTLINT_EXECUTABLE} autocorrect --path ${SOURCE_DIR} --config ${SWIFTLINT_CONFIG_PATH}
|
||||
${SWIFTLINT_EXECUTABLE} --path ${SOURCE_DIR} --config ${SWIFTLINT_CONFIG_PATH}
|
||||
${SWIFTLINT_EXECUTABLE} lint --config ${SWIFTLINT_CONFIG_PATH} --fix --format ${SOURCE_DIR}
|
||||
${SWIFTLINT_EXECUTABLE} lint --config ${SWIFTLINT_CONFIG_PATH} ${SOURCE_DIR}
|
||||
done
|
||||
else
|
||||
# Xcode упадет, если будем использовать большое количество Script Input Files,
|
||||
|
|
@ -81,6 +81,6 @@ else
|
|||
|
||||
swiftlint_files_path="@${lint_files_path}"
|
||||
|
||||
${SWIFTLINT_EXECUTABLE} autocorrect --path ${swiftlint_files_path} --config ${SWIFTLINT_CONFIG_PATH} --force-exclude --use-alternative-excluding
|
||||
${SWIFTLINT_EXECUTABLE} --path ${swiftlint_files_path} --config ${SWIFTLINT_CONFIG_PATH} --force-exclude --use-alternative-excluding
|
||||
${SWIFTLINT_EXECUTABLE} lint --config ${SWIFTLINT_CONFIG_PATH} --fix --format --force-exclude --use-alternative-excluding ${swiftlint_files_path}
|
||||
${SWIFTLINT_EXECUTABLE} lint --config ${SWIFTLINT_CONFIG_PATH} --force-exclude --use-alternative-excluding ${swiftlint_files_path}
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue
А чем тогда заменять
.noneв енамах?чем-то приближенным к логике ситуации: notSelected, initial, etc.