You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
actions+=("install.yaml should contain 'ddev_version_constraint: \">= v1.24.3\"' or higher, see upstream file $UPSTREAM/$install_yaml")
64
+
# Check for ddev_version_constraint >= minimum required version
65
+
local has_valid_version=false
66
+
if grep -q "^ddev_version_constraint:""$install_yaml";then
67
+
# Extract the version number from the constraint (handles both single and double quotes)
68
+
local version_string
69
+
version_string=$(grep "^ddev_version_constraint:""$install_yaml"| head -1 | sed "s/^ddev_version_constraint: ['\"]>= v//; s/['\"].*//"| grep -o "^[0-9.]*")
70
+
71
+
if [[ -n"$version_string" ]];then
72
+
# Split version into components
73
+
local major minor patch
74
+
IFS='.'read -r major minor patch <<<"$version_string"
75
+
major=${major:-0}
76
+
minor=${minor:-0}
77
+
patch=${patch:-0}
78
+
79
+
# Check if version is >= minimum required version
80
+
if(( major > min_ddev_major ))|| \
81
+
(( major == min_ddev_major && minor > min_ddev_minor ))|| \
82
+
(( major == min_ddev_major && minor == min_ddev_minor && patch >= min_ddev_patch ));then
83
+
has_valid_version=true
84
+
fi
85
+
fi
86
+
fi
87
+
88
+
if [[ "$has_valid_version"!="true" ]];then
89
+
actions+=("install.yaml should contain \`ddev_version_constraint: '>= v${min_ddev_major}.${min_ddev_minor}.${min_ddev_patch}'\` or higher, see upstream file $UPSTREAM/$install_yaml")
60
90
fi
61
91
62
92
# Check for addon-template
63
93
if grep -q "addon-template""$install_yaml";then
64
94
actions+=("install.yaml should not contain 'addon-template', use your own name")
65
95
fi
96
+
97
+
# Check for #ddev-nodisplay tag
98
+
if grep -q "#ddev-nodisplay""$install_yaml";then
99
+
actions+=("install.yaml should not contain '#ddev-nodisplay' tag, it's not used anymore, see upstream file $UPSTREAM/$install_yaml")
100
+
fi
66
101
else
67
102
actions+=("install.yaml is missing, see upstream file $UPSTREAM/$install_yaml")
actions+=("$tests_yml should contain at least 2 instances of 'paths-ignore:', found $paths_ignore_count, see upstream file $UPSTREAM/$tests_yml")
116
189
fi
117
190
else
118
191
actions+=("$tests_yml is missing, see upstream file $UPSTREAM/$tests_yml")
@@ -151,8 +224,8 @@ check_github_templates() {
151
224
# Check PULL_REQUEST_TEMPLATE.md for the forbidden exact link
152
225
local pr_template=".github/PULL_REQUEST_TEMPLATE.md"
153
226
if [[ -f"$pr_template" ]];then
154
-
if grep -q "https://github.com/<user>/<repo>/tarball/<branch>""$pr_template";then
155
-
actions+=("PULL_REQUEST_TEMPLATE.md should not contain 'https://github.com/<user>/<repo>/tarball/<branch>', see upstream file $UPSTREAM/$pr_template?plain=1")
actions+=("PULL_REQUEST_TEMPLATE.md should contain 'ddev add-on get https://github.com/<your-name>/<your-repo>/tarball/refs/pull/REPLACE_ME_WITH_THIS_PR_NUMBER/head', see upstream file $UPSTREAM/$pr_template?plain=1")
156
229
fi
157
230
fi
158
231
}
@@ -203,6 +276,28 @@ check_gitattributes() {
203
276
fi
204
277
}
205
278
279
+
# Check for trailing newline and whitespace-only lines in all files
280
+
check_file_formatting() {
281
+
local file
282
+
# Get all tracked files from git, excluding binary files and specific patterns
283
+
while IFS= read -r -d '' file;do
284
+
# Skip binary files and images
285
+
if file "$file"2>/dev/null | grep -qE "image|binary|executable|archive";then
286
+
continue
287
+
fi
288
+
289
+
# Check if file ends with a newline
290
+
if [[ -n"$(tail -c 1 "$file"2>/dev/null)" ]];then
291
+
actions+=("$file should have an empty line at the end")
292
+
fi
293
+
294
+
# Check for lines containing only whitespace
295
+
if grep -qn '^[[:space:]]\+$'"$file"2>/dev/null;then
296
+
actions+=("$file contains lines with only spaces/tabs, remove trailing whitespace")
0 commit comments