diff --git a/.github/workflows/pmd.yml b/.github/workflows/pmd.yml index a0ff441bbd..24361e777c 100644 --- a/.github/workflows/pmd.yml +++ b/.github/workflows/pmd.yml @@ -37,7 +37,6 @@ jobs: find "$SOURCE_DIR" -type f \( -name "*.f" -o -name "*.f90" -o -name "*.for" -o -name "*.fpp" -o -name "*.F" -o -name "*.F90" \) -print0 | while IFS= read -r -d $'\0' file; do processed=$((processed + 1)) - echo -e "[$processed/$total_files] Processing ${file}..." # Create a temporary file with same permissions as original TMP_FILE=$(mktemp) @@ -106,23 +105,21 @@ jobs: s/[[:space:]]*>[[:space:]]*/>/g s/[[:space:]]*==[[:space:]]*/==/g - # Remove full-line comments - /^\s*!/d - /^[cC*dD]/d - /^[ \t]*[cC*dD]/d - /^[[:space:]]*$/d + # Remove full-line comments + /^\s*!/d + /^[cC*dD]/d + /^[ \t]*[cC*dD]/d + /^[[:space:]]*$/d # Remove end-of-line comments, preserving quoted strings s/([^"'\''\\]*("[^"]*")?('\''[^'\'']*'\''?)?[^"'\''\\]*)[!].*$/\1/ ' "$file" > "$TMP_FILE" - + if cmp -s "$file" "$TMP_FILE"; then - echo -e "No changes needed for $file" rm "$TMP_FILE" else # Overwrite the original file with the processed content mv "$TMP_FILE" "$file" - echo -e "Successfully processed $file" fi done