File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ readonly temporarySwiftLintConfigFilename=".$(uuidgen)-swiftlint.yml"
1818
1919projectDir=" $1 "
2020isFramework=$2
21+ swiftUI=$3
2122
2223#
2324# Check requirements
@@ -83,13 +84,51 @@ function merge_commons_with_project_excluded_paths () {
8384 return 0
8485}
8586
87+ function add_swiftUI_disabled_rules () {
88+ disabled_pattern=" disabled_rules:"
89+ disabled_flag_1=false
90+ disabled_flag_2=false
91+
92+ touch " $temporarySwiftLintConfigFilename "
93+
94+ while IFS= read -r line_1 || [[ -n " $line_1 " ]]; do
95+
96+ if [[ $disabled_flag_1 == true ]]; then
97+
98+ while IFS= read -r line_2 || [[ -n " $line_2 " ]]; do
99+
100+ if [[ $disabled_flag_2 == true ]]; then
101+ echo " $line_2 " >> " $temporarySwiftLintConfigFilename "
102+ fi
103+
104+ if [[ $line_2 =~ $disabled_pattern ]]; then
105+ disabled_flag_2=true
106+ fi
107+ done < " swiftlint+swiftUI.yml"
108+ disabled_flag_1=false
109+ fi
110+
111+ if [[ $line_1 =~ $disabled_pattern ]]; then
112+ disabled_flag_1=true
113+ fi
114+ echo " $line_1 " >> " $temporarySwiftLintConfigFilename "
115+ done < " swiftlint.yml"
116+
117+ return 0
118+ }
119+
86120#
87121# Logic
88122#
89123
90124# Go the folder which contains this script
91125cd " $scriptBaseFolderPath "
92126
127+ # Disabled certain rules listet in swiftlint+swiftUI.yml if this is a swiftUI project
128+ if [ $swiftUI = true]; then
129+ add_swiftUI_disabled_rules
130+ fi
131+
93132# Merge the excluded paths of the commons and the project specific configuration
94133if [ -f " $projectDir /.project-swiftlint.yml" ]; then
95134 merge_commons_with_project_excluded_paths
Original file line number Diff line number Diff line change 1+ # ##
2+ # swiftlint+swiftUI.yml
3+ # For a swiftUI projects only
4+ #
5+ # This list of disabled rules gets appended to the swiftlint.yml when it gets copied into the root project directory.
6+ # You can add more "disabled_rules" here.
7+
8+ # rule identifiers to exclude from running
9+ disabled_rules :
10+ - multiple_closures_with_trailing_closure
11+ - missing_closure_name
12+ - missing_closure_datatype
You can’t perform that action at this time.
0 commit comments