Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,25 @@ jobs:
EOF

# Check for PHPUnit warnings and process them
if grep -q "WARNINGS!\|There was.*warning" coverage-output.log; then
if grep -q "WARNINGS!" coverage-output.log; then
echo "Processing coverage warnings for checkstyle report..."

# Show warnings section for debugging
echo "--- Warnings Found ---"
sed -n '/There was.*warning/,/WARNINGS!/p' coverage-output.log | head -10
sed -n '/There w.*warning/,/WARNINGS!/p' coverage-output.log | head -10
echo "--- End Warnings ---"

# Extract warnings to temporary file to avoid subshell issues
sed -n '/There was.*warning/,/WARNINGS!/p' coverage-output.log > temp-warnings.txt
sed -n '/There w.*warning/,/WARNINGS!/p' coverage-output.log > temp-warnings.txt

# Track processed file:line combinations to avoid duplicates
declare -A processed_annotations

# Process each line
while IFS= read -r line; do
echo "Processing line: $line"
# Look for @covers warnings
if [[ "$line" =~ \"@covers.*\"\ is\ invalid ]]; then
if [[ "$line" =~ \"@covers[^\"]*\"\ is\ invalid ]]; then
echo "Found @covers warning line: $line"
# Extract the @covers target - everything between quotes
if [[ "$line" =~ \"@covers\ ([^\"]+)\" ]]; then
Expand All @@ -146,13 +149,25 @@ jobs:
echo "Found test file: $TEST_FILE"
if LINE_NUM=$(grep -n "@covers.*$METHOD_NAME" "$TEST_FILE" | head -1 | cut -d: -f1); then
echo "Found line number: $LINE_NUM"
# Escape XML characters and add checkstyle entry
MESSAGE=$(echo "Invalid @covers annotation: $COVERS_TARGET" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g')
cat >> coverage-warnings.xml << EOF

# Create unique key for this file:line combination
FILE_LINE_KEY="$TEST_FILE:$LINE_NUM"

# Only process if we haven't seen this file:line before
if [[ -z "${processed_annotations[$FILE_LINE_KEY]}" ]]; then
echo "Adding annotation for $FILE_LINE_KEY"
processed_annotations[$FILE_LINE_KEY]=1

# Escape XML characters and add checkstyle entry
MESSAGE=$(echo "Invalid @covers annotation: $COVERS_TARGET" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g')
cat >> coverage-warnings.xml << EOF
<file name="$TEST_FILE">
<error line="$LINE_NUM" column="1" severity="warning" message="$MESSAGE" source="phpunit.coverage"/>
</file>
EOF
else
echo "Skipping duplicate annotation for $FILE_LINE_KEY"
fi
fi
fi
fi
Expand Down
1 change: 1 addition & 0 deletions activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function plugin_init() {
\add_action( 'init', array( __NAMESPACE__ . '\Migration', 'init' ), 1 );
\add_action( 'init', array( __NAMESPACE__ . '\Move', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Options', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Post_Types', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Search', 'init' ) );
\add_action( 'init', array( __NAMESPACE__ . '\Signature', 'init' ) );
Expand Down
Loading