feature/fix_linter_fuckup #4
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -7,26 +7,24 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
// Check for spaces or mixed indentation
|
// Check for spaces or mixed indentation
|
||||||
sh '''
|
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"
|
FILETYPES="css|json|js|java|py|ps1|cs|cmd|bat|htm|html|cpp|c|h|hpp"
|
||||||
|
FILES=$(find . -regextype awk -regex ".*\.($FILETYPES)" -type f)
|
||||||
# Convert FILE_EXTENSIONS to --include pattern
|
|
||||||
|
|
||||||
FILES=$(find . -regextype awk -regex '.*($FILETYPES)' -type f)
|
|
||||||
|
|
||||||
# Initialize the PROBLEMS variable
|
# Initialize the PROBLEMS variable
|
||||||
PROBLEMS=""
|
PROBLEMS=""
|
||||||
|
|
||||||
echo "$FILES" | while IFS= read -r file; do
|
# Pass the files to grep and sed
|
||||||
|
for file in $FILES; do
|
||||||
# Check for lines with spaces
|
# Check for lines with spaces
|
||||||
GREP_RESULT=$(grep -nrP '^[ ]+' "$file" | sed 's/\\([^:]*\\):\\([^:]*\\):\\([ ]*\\).*/File: \\1, Line: \\2, Found: \\3/')
|
GREP_RESULT=$(grep -nrP '^[ ]+' "$file")
|
||||||
if [ -n "$GREP_RESULT" ]; then
|
if [ -n "$GREP_RESULT" ]; then
|
||||||
PROBLEMS="$PROBLEMS$GREP_RESULT"$'\n' # Append the result to PROBLEMS
|
PROBLEMS="${PROBLEMS}File $file:$GREP_RESULT"$'\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" | sed 's/\\([^:]*\\):\\([^:]*\\):\\([ ]*\\).*/File: \\1, Line: \\2, Found: \\3/')
|
GREP_RESULT=$(grep -nrP '^\t+ +' "$file")
|
||||||
if [ -n "$GREP_RESULT" ]; then
|
if [ -n "$GREP_RESULT" ]; then
|
||||||
PROBLEMS="$PROBLEMS$GREP_RESULT"$'\\n' # Append the result to PROBLEMS
|
PROBLEMS="${PROBLEMS}File $file:$GREP_RESULT"$'\n' # Append the result to PROBLEMS
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user