Fix jenkinsfile
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:
33
Jenkinsfile
vendored
33
Jenkinsfile
vendored
@@ -6,38 +6,7 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
// Check for spaces or mixed indentation
|
// Check for spaces or mixed indentation
|
||||||
sh '''
|
sh "./indentcheck.sh"
|
||||||
# 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"
|
|
||||||
FILES=$(find . -regextype awk -regex ".*\.($FILETYPES)" -type f)
|
|
||||||
# Initialize the PROBLEMS variable
|
|
||||||
PROBLEMS=""
|
|
||||||
|
|
||||||
# Pass the files to grep and sed
|
|
||||||
for file in $FILES; do
|
|
||||||
# Check for lines with spaces
|
|
||||||
GREP_RESULT=$(grep -nrP '^[ ]+' "$file")
|
|
||||||
if [ -n "$GREP_RESULT" ]; then
|
|
||||||
PROBLEMS="${PROBLEMS}File $file:$GREP_RESULT"$'\n' # Append the result to PROBLEMS
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for lines with mixed tabs and spaces
|
|
||||||
GREP_RESULT=$(grep -nrP '^\t+ +' "$file")
|
|
||||||
if [ -n "$GREP_RESULT" ]; then
|
|
||||||
PROBLEMS="${PROBLEMS}File $file:$GREP_RESULT"$'\n' # Append the result to PROBLEMS
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check if there were any problems
|
|
||||||
if [ -n "$PROBLEMS" ]; then
|
|
||||||
echo "Indentation issues detected. Please fix the above lines."
|
|
||||||
echo "$PROBLEMS"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "No indentation issues detected."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
'''
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
31
indentcheck.sh
Executable file
31
indentcheck.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 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"
|
||||||
|
FILES=$(find . -regextype awk -regex ".*\.($FILETYPES)" -type f)
|
||||||
|
# Initialize the PROBLEMS variable
|
||||||
|
PROBLEMS=""
|
||||||
|
|
||||||
|
# Pass the files to grep and sed
|
||||||
|
for file in $FILES; do
|
||||||
|
# Check for lines with spaces
|
||||||
|
GREP_RESULT=$(grep -nrP '^[ ]+' "$file")
|
||||||
|
if [ -n "$GREP_RESULT" ]; then
|
||||||
|
PROBLEMS="${PROBLEMS}File $file:$GREP_RESULT"$'\n' # Append the result to PROBLEMS
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for lines with mixed tabs and spaces
|
||||||
|
GREP_RESULT=$(grep -nrP '^\t+ +' "$file")
|
||||||
|
if [ -n "$GREP_RESULT" ]; then
|
||||||
|
PROBLEMS="${PROBLEMS}File $file:$GREP_RESULT"$'\n' # Append the result to PROBLEMS
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if there were any problems
|
||||||
|
if [ -n "$PROBLEMS" ]; then
|
||||||
|
echo "Indentation issues detected. Please fix the above lines."
|
||||||
|
echo "$PROBLEMS"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "No indentation issues detected."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user