Repository navigation
Keep the lint files Codacy reads to packages Codacy installs - #158
Conversation
Codacy reads phpcs.xml, eslint.config.mjs, and .stylelintrc.json, but it installs no WordPress coding standards, no PHPCSExtra, and no WordPress ESLint or Stylelint packages, so every analysis failed for those three tools and Codacy checked nothing with them. Each tool now has a file Codacy can run and a full file that composer, npm, and CI run, so the plugin's own checks are unchanged: - PHPCS: phpcs-wordpress.xml is the former phpcs.xml. phpcs.xml holds the rules from PHPCS's own standards and VariableAnalysis that the WordPress standards apply, with their settings and the tab width, plus PHPCompatibilityWP. - Stylelint: stylelint-wordpress.json is the former .stylelintrc.json. .stylelintrc.json holds its 60 plain Stylelint rules. - ESLint: eslint.config.mjs exports the project's rules; eslint.wordpress.config.mjs adds the WordPress set and the browser-support check (its browser list extends @wordpress/browserslist-config), so the resolved configuration is unchanged. .github/scripts/codacy-configs.py regenerates phpcs.xml's rules and .stylelintrc.json from the full files, and CI fails when they are out of date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 44 |
| Duplication | 0 |
🟢 Coverage ∅ diff coverage · +0.00% coverage variation
Metric Results Coverage variation ✅ +0.00% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (7d7fcc8) 263 238 90.49% Head commit (d7efdc6) 263 (+0) 238 (+0) 90.49% (+0.00%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#158) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
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.
|
Thanks for contributing to Optimizations ACE MC! Before we review:
Security Reminder
We'll review your PR soon. |
Summary
Codacy reads
phpcs.xml,eslint.config.mjsand.stylelintrc.json(the "Configuration file" setting is on for each), but it installs no WordPress coding standards, no PHPCSExtra, and no WordPress ESLint or Stylelint packages. Codacy's analysis log for7d7fcc8shows all three tools failing:Referenced sniff "WordPress-Extra" does not existCannot find package '@wordpress/eslint-plugin'Could not find "@wordpress/stylelint-config"So Codacy checked none of the plugin's PHP, JavaScript or CSS with those tools.
Each tool now has a file Codacy can run and a full file that composer, npm and CI run. The plugin's own checks are unchanged.
phpcs.xml: the rules from PHPCS's own standards and VariableAnalysis that the WordPress standards apply, with their exact settings and the 4-column tab width, plus PHPCompatibilityWPphpcs-wordpress.xml(the formerphpcs.xml).stylelintrc.json: the 60 plain Stylelint rules of the WordPress configstylelint-wordpress.json(the former.stylelintrc.json)eslint.config.mjs: the project's modern-JavaScript ruleseslint.wordpress.config.mjs: the WordPress set, the same rules, and the browser-support check (compat reads the browser list frompackage.json, which extends@wordpress/browserslist-config, also missing in Codacy). The resolved configuration is identical.github/scripts/codacy-configs.pyregenerates the rules inphpcs.xmland.stylelintrc.jsonfrom the full files. It reads PHPCS's loaded ruleset through.github/scripts/phpcs-ruleset-dump.php, a report class. The "Run PHPCS" and "Run Stylelint" steps fail when either copy is out of date, for example after a Dependabot update to the WordPress standards.Codacy still can't run any WordPress-specific rule; those keep running only in CI.
Testing
phpcs.xml: no findings on the plugin. Its loaded ruleset matchesphpcs-wordpress.xmlfor all 213 rules from Codacy-installed standards (same sniffs, properties, severities and types). Every listed sniff is in Codacy's PHPCS catalog.eslint --print-configoutput fortests/js/helpers.mjsandtests/js/info-window.test.mjsis byte-identical before and after with the full config. Both configs lint clean, and every rule ineslint.config.mjsis in Codacy's ESLint 9 catalog.composer check-all(PHPCS, PHPMD, Psalm, PHPStan, Rector, 152 PHPUnit tests),npm run lint:js,lint:css,lint:md,npm test(10), Ruff, strict mypy, Bandit through Prospector, yamllint, actionlint, zizmor (no change) and gitleaks pass.After merge, the Codacy log for the merge commit should show PHP_CodeSniffer, ESLint9 and Stylelint as
success.🤖 Generated with Claude Code