feature/fix_linter_fuckup #4
24
Jenkinsfile
vendored
24
Jenkinsfile
vendored
@@ -7,25 +7,15 @@ pipeline {
|
||||
script {
|
||||
// Check for spaces or mixed indentation
|
||||
sh '''
|
||||
grep -P "test" <<< "test" || echo "grep -P not supported"
|
||||
|
||||
# Define file extensions to check
|
||||
FILE_EXTENSIONS="css,json,js,java,htm,html,cpp,c,h,p,py,go,cs"
|
||||
|
||||
echo "Checking for spaces in indentation..."
|
||||
grep -nrP "^[ ]+" --include="*.{$FILE_EXTENSIONS}" . || echo "No lines with spaces found."
|
||||
|
||||
echo "Checking for mixed indentation..."
|
||||
grep -nrP "^\t+ +" --include="*.{$FILE_EXTENSIONS}" . || echo "No lines with mixed indentation found."
|
||||
|
||||
if grep -nrP "^[ ]+" --include="*.{$FILE_EXTENSIONS}" . || \
|
||||
grep -nrP "^\t+ +" --include="*.{$FILE_EXTENSIONS}" .; then
|
||||
echo "Indentation issues detected. Please fix the above lines."
|
||||
if grep -P "^[ ]+" -r --include=*.css ; then
|
||||
echo "Error: Files contain spaces instead of tabs for indentation."
|
||||
exit 1
|
||||
else
|
||||
echo "No indentation issues detected."
|
||||
exit 0
|
||||
fi
|
||||
if grep -P "^\\t+ +" -r --include=*.css ; 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