From 29debb24777a0bed1924a965df75eba252f7211c Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Tue, 31 Mar 2020 00:11:26 +0300 Subject: [PATCH 1/3] update swiftlint rules for 0.39.1 version --- xcode/.swiftlint.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xcode/.swiftlint.yml b/xcode/.swiftlint.yml index b731824..43d4a23 100644 --- a/xcode/.swiftlint.yml +++ b/xcode/.swiftlint.yml @@ -6,10 +6,17 @@ opt_in_rules: - last_where - empty_string - empty_count + - contains_over_filter_count + - contains_over_filter_is_empty + - empty_collection_literal + - contains_over_range_nil_comparison + - contains_over_first_not_nil + - flatmap_over_map_reduce # idiomatic - legacy_random + - legacy_multiple - pattern_matching_keywords - redundant_nil_coalescing - redundant_type_annotation @@ -45,6 +52,7 @@ opt_in_rules: - conditional_returns_on_newline - closure_spacing - closure_end_indentation + - prefer_self_type_over_type_of_self # lint @@ -52,9 +60,14 @@ opt_in_rules: - private_outlet - prohibited_super_call - unused_import - - unused_private_declaration + - unused_declaration - identical_operands - overridden_super_call + - unowned_variable_capture + + # metrics + + - enum_case_associated_values_count excluded: - Carthage @@ -78,6 +91,9 @@ file_length: function_parameter_count: error: 5 +colon: + flexible_right_spacing: true + identifier_name: excluded: - id From 0291efe8c9845e5352c2223dbf09f108645e9dba Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Tue, 31 Mar 2020 12:29:45 +0300 Subject: [PATCH 2/3] use $TARGET_NAME instead of $PROJECT_NAME as default folder path for linting --- xcode/build_phases/swiftlint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcode/build_phases/swiftlint.sh b/xcode/build_phases/swiftlint.sh index 9491bf4..f1f8fb8 100644 --- a/xcode/build_phases/swiftlint.sh +++ b/xcode/build_phases/swiftlint.sh @@ -1,2 +1,2 @@ -SOURCES_DIR=${1:-${PROJECT_NAME}} # first argument or PROJECT_NAME +SOURCES_DIR=${1:-${TARGET_NAME}} # first argument or TARGET_NAME ${PODS_ROOT}/SwiftLint/swiftlint autocorrect --path ${SOURCES_DIR} --config ${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml && ${PODS_ROOT}/SwiftLint/swiftlint --path ${SOURCES_DIR} --config ${PROJECT_DIR}/build-scripts/xcode/.swiftlint.yml From 55f503fc6f4c938c0a5483618e5cef4ed8fff098 Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Tue, 31 Mar 2020 12:42:38 +0300 Subject: [PATCH 3/3] decrease maximum number of enum parameters to 4 for warning and 5 for error --- xcode/.swiftlint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xcode/.swiftlint.yml b/xcode/.swiftlint.yml index 43d4a23..4cf4b27 100644 --- a/xcode/.swiftlint.yml +++ b/xcode/.swiftlint.yml @@ -94,6 +94,10 @@ function_parameter_count: colon: flexible_right_spacing: true +enum_case_associated_values_count: + warning: 4 + error: 5 + identifier_name: excluded: - id