Skip to content

Commit 1772c95

Browse files
authored
Merge pull request #388 from linuxserver/CRLF-check
Check for CRLF, executable bit, and add .editorconfig
2 parents 5c55583 + 988d23a commit 1772c95

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
# trim_trailing_whitespace may cause unintended issues and should not be globally set true
9+
trim_trailing_whitespace = false
10+
11+
[{*.conf,*.conf.sample}]
12+
indent_style = space
13+
indent_size = 4

.github/workflows/check_samples.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,31 @@ jobs:
1818
NOT_SAMPLES=$(find . -not -path '*/\.*' -type f ! \( -name '*.conf.sample' -o -name 'README.md' -o -name 'LICENSE' \))
1919
NOT_SAMPLES_COUNT=$(echo "${NOT_SAMPLES}" | wc -w)
2020
if (( NOT_SAMPLES_COUNT > 0 )); then
21-
echo "The following files are not allowed:"
21+
echo "The following files have extensions that are not allowed:"
2222
echo "${NOT_SAMPLES}"
2323
exit 1
2424
fi
2525
26+
- name: Check Executable Bit
27+
run: |
28+
EXECUTABLE_BIT=$(find . -not -path '*/\.*' -type f -executable)
29+
EXECUTABLE_BIT_COUNT=$(echo "${EXECUTABLE_BIT}" | wc -w)
30+
if (( EXECUTABLE_BIT_COUNT > 0 )); then
31+
echo "The following files have executable permissions (not allowed):"
32+
echo "${EXECUTABLE_BIT}"
33+
exit 1
34+
fi
35+
36+
- name: Check Line Endings
37+
run: |
38+
CRLF_ENDINGS=$(find . -not -path '*/\.*' -type f -exec file "{}" ";" | grep CRLF || true)
39+
CRLF_ENDINGS_COUNT=$(echo "${CRLF_ENDINGS}" | wc -w)
40+
if (( CRLF_ENDINGS_COUNT > 0 )); then
41+
echo "The following files have CRLF line endings (not allowed):"
42+
echo "${CRLF_ENDINGS}"
43+
exit 1
44+
fi
45+
2646
- name: Check Version Date Line Exists
2747
run: |
2848
# Date regex based on https://www.html5pattern.com/Dates

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
*
33

44
# Do NOT ignore allowed files
5-
!*.conf.sample
5+
!.editorconfig
66
!.gitattributes
77
!.github
88
!.gitignore
9+
!*.conf.sample
910
!LICENSE
1011
!README.md

0 commit comments

Comments
 (0)