Fix jenkinsfile
All checks were successful
Flare Microsystems Git/FlarePublic/gitea-themes/pipeline/pr-master This commit looks good
All checks were successful
Flare Microsystems Git/FlarePublic/gitea-themes/pipeline/pr-master This commit looks good
This commit is contained in:
28
Jenkinsfile
vendored
28
Jenkinsfile
vendored
@@ -7,16 +7,28 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
// Check for spaces or mixed indentation
|
// Check for spaces or mixed indentation
|
||||||
sh '''
|
sh '''
|
||||||
EXTENSIONS=css,js,json,java,bat,ps1,py,cs,html,c,cpp,h,hpp,cmd
|
FILE_EXTENSIONS="css json js java py ps1 cs cmd bat htm html cpp c h hpp"
|
||||||
if grep -P "^[ ]+" -r --include=*.{$EXTENSIONS} ; then
|
|
||||||
echo "Error: Files contain spaces instead of tabs for indentation."
|
INCLUDE_PATTERNS=$(echo $FILE_EXTENSIONS | sed 's/ /,*.*/g; s/^/*.*/')
|
||||||
|
|
||||||
|
|
||||||
|
# Convert FILE_EXTENSIONS to --include pattern
|
||||||
|
INCLUDE_PATTERNS=$(echo $FILE_EXTENSIONS | sed 's/ /,*.*/g; s/^/*.*/')
|
||||||
|
|
||||||
|
echo "Checking for lines starting with spaces in $FILE_EXTENSIONS files..."
|
||||||
|
grep -nrP '^[ ]+' --include="$INCLUDE_PATTERNS" . | sed 's/\\([^:]*\\):\\([^:]*\\):\\([ ]*\\).*/File: \\1, Line: \\2, Found: \\3/' || echo "No lines with spaces found."
|
||||||
|
|
||||||
|
echo "Checking for lines with mixed tabs and spaces in $FILE_EXTENSIONS files..."
|
||||||
|
grep -nrP '^\t+ +' --include="$INCLUDE_PATTERNS" . | sed 's/\\([^:]*\\):\\([^:]*\\):\\(\\t* +\\).*/File: \\1, Line: \\2, Found: \\3/' || echo "No lines with mixed indentation found."
|
||||||
|
|
||||||
|
if grep -nrP '^[ ]+' --include="$INCLUDE_PATTERNS" . || \
|
||||||
|
grep -nrP '^\t+ +' --include="$INCLUDE_PATTERNS" .; then
|
||||||
|
echo "Indentation issues detected. Please fix the above lines."
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
echo "No indentation issues detected."
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
if grep -P "^\\t+ +" -r --include=*.{$EXTENSIONS} ; then
|
|
||||||
echo "Error: Files contain mixed tabs and spaces for indentation."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "No indentation errors detected."
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user