Merge pull request #388 from linuxserver/CRLF-check

Check for CRLF, executable bit, and add .editorconfig
This commit is contained in:
Roxedus 2021-10-07 09:39:40 +02:00 committed by GitHub
commit 1772c95a3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 2 deletions

13
.editorconfig Normal file
View file

@ -0,0 +1,13 @@
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# trim_trailing_whitespace may cause unintended issues and should not be globally set true
trim_trailing_whitespace = false
[{*.conf,*.conf.sample}]
indent_style = space
indent_size = 4

View file

@ -18,11 +18,31 @@ jobs:
NOT_SAMPLES=$(find . -not -path '*/\.*' -type f ! \( -name '*.conf.sample' -o -name 'README.md' -o -name 'LICENSE' \))
NOT_SAMPLES_COUNT=$(echo "${NOT_SAMPLES}" | wc -w)
if (( NOT_SAMPLES_COUNT > 0 )); then
echo "The following files are not allowed:"
echo "The following files have extensions that are not allowed:"
echo "${NOT_SAMPLES}"
exit 1
fi
- name: Check Executable Bit
run: |
EXECUTABLE_BIT=$(find . -not -path '*/\.*' -type f -executable)
EXECUTABLE_BIT_COUNT=$(echo "${EXECUTABLE_BIT}" | wc -w)
if (( EXECUTABLE_BIT_COUNT > 0 )); then
echo "The following files have executable permissions (not allowed):"
echo "${EXECUTABLE_BIT}"
exit 1
fi
- name: Check Line Endings
run: |
CRLF_ENDINGS=$(find . -not -path '*/\.*' -type f -exec file "{}" ";" | grep CRLF || true)
CRLF_ENDINGS_COUNT=$(echo "${CRLF_ENDINGS}" | wc -w)
if (( CRLF_ENDINGS_COUNT > 0 )); then
echo "The following files have CRLF line endings (not allowed):"
echo "${CRLF_ENDINGS}"
exit 1
fi
- name: Check Version Date Line Exists
run: |
# Date regex based on https://www.html5pattern.com/Dates

3
.gitignore vendored
View file

@ -2,9 +2,10 @@
*
# Do NOT ignore allowed files
!*.conf.sample
!.editorconfig
!.gitattributes
!.github
!.gitignore
!*.conf.sample
!LICENSE
!README.md