Skip to content

Commit d4b77fb

Browse files
authored
Update pmd.yml
1 parent 3bd04f3 commit d4b77fb

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

.github/workflows/pmd.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,21 @@ jobs:
5555
# - Lines starting with 'c', 'C', '*', 'd', 'D' in column 1 (fixed form comments)
5656
# 2. Remove end-of-line comments (anything after '!' that isn't in a string)
5757
# 3. Preserve strings containing '!' characters
58-
                  sed -E '
59-
                    # First pass: Remove comments
60-
                    # Remove lines that are entirely comments
61-
                    /^\s*!/s/.*//
62-
                    /^[cC*dD]/s/.*//
63-
                    /^[ \t]*[cC*dD]/s/.*//
64-
                    # Remove end-of-line comments, preserving strings
65-
                    s/([^"'\'']*("[^"]*"[^"'\'']*|'\''[^'\'']*'\''[^"'\'']*)*[^"'\'']*)[!].*$/\1/
66-
67-
                    # Second pass: Handle line continuations
68-
                    :a
69-
                    # If a line ends with '&' (possibly with trailing whitespace), read the next line
70-
                    /&\s*$/ {
71-
                          N
72-
                          # Replace '&' at the end of the first line, newline, and potential leading '&' on the second line with a single space
73-
                          s/&\s*\n\s*&/\ /
74-
                          ba # Loop back to 'a' to handle multiple continuations
75-
                    }
76-
                    # If a line ends with '&' but is the last line or next line doesn't start with '&', remove the trailing '&'
77-
                    s/&\s*$//
78-
                  ' "$file" > "$TMP_FILE"
58+
sed -E '
59+
:a
60+
/&$/ {
61+
N
62+
s/&[[:space:]]*\n[[:space:]]*&/ /
63+
ba
64+
}
65+
s/&//g
66+
' "$file" | \
67+
sed -E \
68+
-e '/^\s*!/s/.*//' \
69+
-e '/^[cC*dD]/s/.*//' \
70+
-e '/^[ \t]*[cC*dD]/s/.*//' \
71+
-e 's/([^"'\'']*("[^"]*"[^"'\'']*|'\''[^'\'']*'\''[^"'\'']*)*[^"'\'']*)[!].*$/\1/' \
72+
> "$TMP_FILE"
7973

8074
# Check if file was actually modified before replacing
8175
if cmp -s "$file" "$TMP_FILE"; then

0 commit comments

Comments
 (0)