From f17e406d59855d41b3237770e587e37fa7bfc1da Mon Sep 17 00:00:00 2001 From: Vulpovile Date: Sat, 11 Jan 2025 14:42:45 -0800 Subject: [PATCH] Update jenkinsfile indentation script --- Jenkinsfile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5e219c9..f055cbe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,15 +7,23 @@ pipeline { script { // Check for spaces or mixed indentation sh ''' - if grep -P "^[ ]+" -r ./**/*.css; then - echo "Error: Files contain spaces instead of tabs for indentation." + # 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." exit 1 + else + echo "No indentation issues detected." + exit 0 fi - if grep -P "^\\t+ +" -r ./**/*.css; then - echo "Error: Files contain mixed tabs and spaces for indentation." - exit 1 - fi - echo "No indentation errors detected." ''' } }