chore: add static analysis (PHPCS + PHPStan) and CI - #9
Merged
Merged
Conversation
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
YvesCesar
requested review from
vitormattos
and removed request for
vitormattos
September 14, 2026 21:32
YvesCesar
marked this pull request as draft
September 14, 2026 21:33
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
YvesCesar
marked this pull request as ready for review
September 14, 2026 21:42
This was referenced Sep 14, 2026
vitormattos
requested changes
Sep 15, 2026
This was referenced Sep 15, 2026
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
vitormattos
requested changes
Sep 18, 2026
vitormattos
requested changes
Sep 18, 2026
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
vitormattos
requested changes
Sep 19, 2026
vitormattos
added this pull request to stack #14
September 19, 2026 17:59
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
vitormattos
approved these changes
Sep 24, 2026
vitormattos
left a comment
Member
There was a problem hiding this comment.
Looks good now. The requested changes were addressed and the remaining CI improvements are tracked in #15 as a follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The plugin had no
composer.json, no linting and no CI — the only check was the DCO bot. This adds a static analysis setup and fixes what the first run reported.Tooling
composer.json— PHP>=8.1, dev dependencies only (PHPCS 3.13, WPCS 3.4, PHPCompatibilityWP, PHPStan 2.2 + phpstan-wordpress, WooCommerce stubs, parallel-lint) and thelint/cs/cs:fix/stan/ciscripts.phpcs.xml.dist— a lean ruleset rather than the fullWordPress-Extra+WordPress-Docs. The files mix tabs and spaces, so runningphpcbfover the whole standard would bury the history in a formatting diff. It enables onlyWordPress.Security,WordPress.DB,WordPress.WP.I18n, the deprecated/global-override sniffs,PrefixAllGlobals(prefixeslibresign/LIBRESIGN) andPHPCompatibilityWPwithtestVersion 8.1-.phpstan.neon.dist— level 5, clean. The onlyignoreErrorsentry covers thewp-config.phpsalts (AUTH_KEY,SECURE_AUTH_SALT,NONCE_SALT), which PHPStan cannot see..github/workflows/ci.yml— a singlestaticjob on PHP 8.3 runningcomposer lint,csandstan.wc_cleanis registered as a custom sanitizing function, otherwise PHPCS reports four false positives on code that already sanitizes correctly.Findings fixed
The first PHPCS run reported 11 issues, all in
libresign-wp-customizations.php::205the admin notice was echoed with interpolated variables and no escaping — nowprintfwithesc_attrpluswp_kses_post, since the message intentionally carries an<a>.:234wp_die( __( 'Você não tem permissão…' ) )had no text domain, so the string was never translatable, and no escaping either.:621$_SERVER['REQUEST_URI']was only unslashed, never sanitized.:721the FAQ link is built as HTML and was passed raw toprintf.:788and:832$_GET['subscription_id']and$_GET['libresign_confirm_subscription']were passed straight into the lookup helper — nowabsint( wp_unslash( … ) ), which also clears the twoNonceVerificationwarnings.Verification
composer ciis green: no lint errors, no PHPCS violations, no PHPStan errors at level 5. The plugin still loads and stays active in the local stack.