Better Formatting
Some checks failed
Flare Microsystems Git/FlarePublic/gitea-themes/pipeline/pr-master There was a failure building this commit
Some checks failed
Flare Microsystems Git/FlarePublic/gitea-themes/pipeline/pr-master There was a failure building this commit
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Save the results of the find command into a variable
|
# Save the results of the find command into a variable
|
||||||
FILETYPES="css|json|js|java|py|ps1|cs|cmd|bat|htm|html|cpp|c|h|hpp"
|
FILETYPES="css|json|js|java|py|ps1|cs|cmd|bat|htm|html|cpp|c|h|hpp|sh|bash"
|
||||||
FILES=$(find . -regextype awk -regex ".*\.($FILETYPES)" -type f)
|
FILES=$(find . -regextype awk -regex ".*\.($FILETYPES)" -type f)
|
||||||
# Initialize the PROBLEMS variable
|
# Initialize the PROBLEMS variable
|
||||||
PROBLEMS=""
|
PROBLEMS=""
|
||||||
@@ -10,13 +10,13 @@ for file in $FILES; do
|
|||||||
# Check for lines with spaces
|
# Check for lines with spaces
|
||||||
GREP_RESULT=$(grep -nrP '^[ ]+' "$file")
|
GREP_RESULT=$(grep -nrP '^[ ]+' "$file")
|
||||||
if [ -n "$GREP_RESULT" ]; then
|
if [ -n "$GREP_RESULT" ]; then
|
||||||
PROBLEMS="${PROBLEMS}File $file:$GREP_RESULT"$'\n' # Append the result to PROBLEMS
|
PROBLEMS="${PROBLEMS}Space indentation in file $file:"$'\n'"$GREP_RESULT"$'\n\n\n' # Append the result to PROBLEMS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for lines with mixed tabs and spaces
|
# Check for lines with mixed tabs and spaces
|
||||||
GREP_RESULT=$(grep -nrP '^\t+ +' "$file")
|
GREP_RESULT=$(grep -nrP '^\t+ +' "$file")
|
||||||
if [ -n "$GREP_RESULT" ]; then
|
if [ -n "$GREP_RESULT" ]; then
|
||||||
PROBLEMS="${PROBLEMS}File $file:$GREP_RESULT"$'\n' # Append the result to PROBLEMS
|
PROBLEMS="${PROBLEMS}Mixed indentation in file $file:"$'\n'"$GREP_RESULT"$'\n\n\n' # Append the result to PROBLEMS
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user