Skip to content

ci: print the full PHPCS report alongside cs2pr annotations - #64

Merged
soham2008xyz merged 1 commit into
mainfrom
ci/phpcs-full-report
Nov 2, 2026
Merged

soham2008xyz merged 1 commit into
mainfrom
ci/phpcs-full-report

Conversation

@renderbit-technologies

Copy link
Copy Markdown
Owner

Description

The phpcs ("Coding standards") job in tests.yml already checks the WordPress Coding Standards on every PR. Until now it piped only the checkstyle report into cs2pr, so when it failed you saw PR annotations but no readable list in the log.

This PR changes it to:

  • run vendor/bin/phpcs -q --report-full --report-checkstyle=phpcs-report.xml, which prints the full report to the log and writes the checkstyle report to a file
  • run cs2pr phpcs-report.xml in a new step, "Annotate PHPCS violations", using if: always() && hashFiles('phpcs-report.xml') != '', so annotations still appear when the PHPCS step fails

The PHPCS step still fails the job when there are violations, because its exit code is no longer hidden behind a pipe.

Related Issue

None.

Type of Change

  • Chore (maintenance, refactoring, or other non-user-facing changes)

Checklist

  • My code follows the project's code style and conventions
  • I have tested my changes thoroughly
  • All existing tests pass (if applicable)
  • Changes do not introduce security issues

Testing Instructions

  • Locally on main: vendor/bin/phpcs -q --report-full --report-checkstyle=out.xml exits 0 and writes an empty checkstyle file.
  • On a file with deliberate violations, the same command prints the full report, exits 2 and writes 10 <error> entries to the checkstyle file.
  • The workflow YAML parses. actionlint wasn't available.
  • The "Coding standards" job on this PR should pass.

Additional Notes

No plugin code changes.


Generated by Claude Code

Write the checkstyle report to a file so the log also shows the readable
full report, and run cs2pr on it in a following step that runs even when
PHPCS fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016QZq4rvW3EzGU1QRh7T7qi
@renderbit-technologies
renderbit-technologies marked this pull request as ready for review November 2, 2026 08:33
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@soham2008xyz
soham2008xyz requested a balanced review from Copilot November 2, 2026 08:33
@soham2008xyz

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T08:34:58.573734Z b4d5770 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: b4d577087e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The CI workflow change is self-contained and correct, with valid PHPCS reporting, preserved job-failure behavior, and a well-guarded annotation step, leaving no outstanding issues.

No open issues 🎉

What changed in this PR

This PR improves the developer experience of the phpcs ("Coding standards") CI job in .github/workflows/tests.yml. Previously PHPCS piped only a checkstyle report into cs2pr, producing PR annotations but no human-readable list in the workflow log. The change makes PHPCS print a full report to the log while also writing the checkstyle file consumed by cs2pr in a separate annotation step, so both a readable log and PR annotations are available even when the lint step fails.

Changes:

  • Replace vendor/bin/phpcs -q --report=checkstyle | cs2pr with vendor/bin/phpcs -q --report-full --report-checkstyle=phpcs-report.xml, so the step's own exit code (no longer hidden behind a pipe) fails the job on violations and the full report is visible in the log.
  • Add an "Annotate PHPCS violations" step running cs2pr phpcs-report.xml, guarded by if: always() && hashFiles('phpcs-report.xml') != '' so annotations still render when PHPCS fails and are skipped if the report was never written.
File Description
.github/​workflows/​tests.yml Splits PHPCS linting into a full-report run plus a separate cs2pr annotation step so the log shows a readable report while PR annotations and job-failure behavior are preserved.

Review effort: Balanced

@soham2008xyz
soham2008xyz merged commit 1bbcc0d into main Nov 2, 2026
18 checks passed
@soham2008xyz
soham2008xyz deleted the ci/phpcs-full-report branch November 2, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants