From e42acb505327667def0d03f1d4bd430bd5f81ed3 Mon Sep 17 00:00:00 2001 From: Peter Downey Date: Wed, 25 Nov 2026 03:39:02 -0500 Subject: [PATCH] Run the checks of Codacy's WordPress standard in CI as well Codacy's "WordPress" coding standard turns on checks that the plugin's own configuration did not run. Each one that fits the WordPress style and passes on the plugin is now in a configuration file that both CI and Codacy read, so a pull request gets the same checks before Codacy runs: - PHPCS: 24 checks join phpcs-wordpress.xml (PHPCS's own standards and Slevomat, now a dev dependency); codacy-configs.py copies Slevomat into phpcs.xml. The checks that contradict the WordPress style, such as Yoda conditions and tab indentation, are listed there as left out, with the reason for each. - Biome: biome.json turns on Codacy's 232 lint rules; npm run lint:biome runs it with Biome 2.5.14, the version Codacy uses. - Pylint: .pylintrc turns on Codacy's 95 checks. - Bandit: bandit.yml runs every test. The lint job runs Pylint, Bandit, and Biome, which lint-requirements.txt and package.json pin. PHPMD and markdownlint already ran every check Codacy turns on. Co-Authored-By: Claude Opus 5.5 --- .codacy.yml | 9 +- .distignore | 2 + .gitattributes | 3 + .github/labeler.yml | 3 + .github/lint-requirements.txt | 2 + .github/scripts/codacy-configs.py | 12 +- .github/workflows/wp-compatibility-test.yml | 21 +- .pylintrc | 105 ++++++++ CONTRIBUTING.md | 5 +- bandit.yml | 3 + biome.json | 275 ++++++++++++++++++++ composer.json | 3 +- composer.lock | 67 ++++- package-lock.json | 176 +++++++++++++ package.json | 2 + phpcs-wordpress.xml | 65 +++++ phpcs.xml | 28 ++ 17 files changed, 772 insertions(+), 9 deletions(-) create mode 100644 .pylintrc create mode 100644 bandit.yml create mode 100644 biome.json diff --git a/.codacy.yml b/.codacy.yml index 280ceb2..ef901a5 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -1,10 +1,11 @@ --- # Codacy configuration # -# With each tool's "Configuration file" setting on, Codacy reads phpcs.xml, phpmd.xml, and -# .markdownlint.json. Codacy installs no WordPress standards or packages, so those files hold only -# what it can run; CI runs the full configurations (phpcs-wordpress.xml, phpmd.xml with phpmd-extra.xml). -# See CONTRIBUTING.md. +# With each tool's "Configuration file" setting on, Codacy reads phpcs.xml, phpmd.xml, +# .markdownlint.json, biome.json, .pylintrc, and bandit.yml. Codacy installs no WordPress standards +# or packages, so those files hold only what it can run; CI runs the full configurations +# (phpcs-wordpress.xml, phpmd.xml with phpmd-extra.xml) and the same Biome, Pylint, and Bandit +# files. See CONTRIBUTING.md. engines: # Lizard reads the lock files as source code and reports their length. diff --git a/.distignore b/.distignore index ae4480b..9aa01a7 100644 --- a/.distignore +++ b/.distignore @@ -65,6 +65,8 @@ /package.json /package-lock.json /phpcs.xml +/bandit.yml +/biome.json /phpcs-wordpress.xml /phpmd.xml /phpmd-extra.xml diff --git a/.gitattributes b/.gitattributes index 7988813..b3da0c4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19,6 +19,9 @@ /package.json export-ignore /package-lock.json export-ignore /phpcs.xml export-ignore +/bandit.yml export-ignore +/.pylintrc export-ignore +/biome.json export-ignore /phpcs-wordpress.xml export-ignore /phpmd.xml export-ignore /phpmd-extra.xml export-ignore diff --git a/.github/labeler.yml b/.github/labeler.yml index 88fa88c..dbc3055 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -64,6 +64,9 @@ testing: - any-glob-to-any-file: tests/**/* - any-glob-to-any-file: phpunit.xml - any-glob-to-any-file: phpcs.xml + - any-glob-to-any-file: bandit.yml + - any-glob-to-any-file: .pylintrc + - any-glob-to-any-file: biome.json - any-glob-to-any-file: phpcs-wordpress.xml - any-glob-to-any-file: phpmd.xml - any-glob-to-any-file: phpmd-extra.xml diff --git a/.github/lint-requirements.txt b/.github/lint-requirements.txt index eb9249c..c5b6168 100644 --- a/.github/lint-requirements.txt +++ b/.github/lint-requirements.txt @@ -1,7 +1,9 @@ # Linters that the lint job of wp-compatibility-test.yml installs. # Renovate keeps the versions current. actionlint-py==1.7.12.25 +bandit==1.9.4 mypy==2.4.1 +pylint==4.1.4 ruff==0.17.5 yamllint==1.38.0 zizmor==1.32.0 diff --git a/.github/scripts/codacy-configs.py b/.github/scripts/codacy-configs.py index 21f9d10..b6f26f7 100755 --- a/.github/scripts/codacy-configs.py +++ b/.github/scripts/codacy-configs.py @@ -34,7 +34,17 @@ # PHPCS standards that Codacy installs. PHPCompatibilityWP is referenced as a whole standard in # phpcs.xml's hand-written part, so its sniffs are not listed one by one. -CODACY_PHPCS_STANDARDS = ("Generic", "PEAR", "PSR1", "PSR2", "PSR12", "Squiz", "Zend", "VariableAnalysis") +CODACY_PHPCS_STANDARDS = ( + "Generic", + "PEAR", + "PSR1", + "PSR2", + "PSR12", + "Squiz", + "Zend", + "SlevomatCodingStandard", + "VariableAnalysis", +) BEGIN = " " END = " " # A message code (Standard.Category.Sniff.Code) has three dots; a sniff code has two. diff --git a/.github/workflows/wp-compatibility-test.yml b/.github/workflows/wp-compatibility-test.yml index 179fa96..62dc9e1 100644 --- a/.github/workflows/wp-compatibility-test.yml +++ b/.github/workflows/wp-compatibility-test.yml @@ -1241,6 +1241,17 @@ jobs: # .mypy.ini names the files and sets the strict mode. run: mypy + - name: Run Pylint + id: run_pylint + # .pylintrc turns on the checks Codacy's Pylint runs; Codacy reads the same file. + run: pylint --rcfile=.pylintrc .github/scripts/*.py + + - name: Run Bandit + id: run_bandit + # bandit.yml runs every test; Codacy reads the same file. Bandit's default exclusions also + # match .github, so -x replaces them. + run: bandit --configfile bandit.yml -x node_modules .github/scripts/*.py + - name: Run markdownlint id: run_markdownlint run: | @@ -1252,6 +1263,11 @@ jobs: # A run that found no files must not pass. grep -Eq '^Linting: [1-9][0-9]* file' "$RUNNER_TEMP/markdownlint.txt" + - name: Run Biome + id: run_biome + # biome.json turns on the lint rules Codacy's Biome runs; Codacy reads the same file. + run: npm run --silent lint:biome + - name: Preserve diagnostic summary id: preserve_diagnostics if: ${{ always() }} @@ -1267,7 +1283,10 @@ jobs: run_zizmor=${{ steps.run_zizmor.outcome }} run_ruff=${{ steps.run_ruff.outcome }} run_mypy=${{ steps.run_mypy.outcome }} + run_pylint=${{ steps.run_pylint.outcome }} + run_bandit=${{ steps.run_bandit.outcome }} run_markdownlint=${{ steps.run_markdownlint.outcome }} + run_biome=${{ steps.run_biome.outcome }} run: | mkdir -p "$RUNNER_TEMP/es-optimizer-diagnostics" printf '%s\n' "$STEP_RESULTS" > "$RUNNER_TEMP/es-optimizer-diagnostics/steps.txt" @@ -1308,7 +1327,7 @@ jobs: uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FAILURE_STAGE: ${{ steps.checkout_code.outcome == 'failure' && 'checkout_code' || steps.setup_node.outcome == 'failure' && 'setup_node' || steps.install_npm_dependencies.outcome == 'failure' && 'install_npm_dependencies' || steps.install_python_linters.outcome == 'failure' && 'install_python_linters' || steps.run_yamllint.outcome == 'failure' && 'run_yamllint' || steps.run_actionlint.outcome == 'failure' && 'run_actionlint' || steps.run_zizmor.outcome == 'failure' && 'run_zizmor' || steps.run_ruff.outcome == 'failure' && 'run_ruff' || steps.run_mypy.outcome == 'failure' && 'run_mypy' || steps.run_markdownlint.outcome == 'failure' && 'run_markdownlint' || 'unknown_or_canceled' }} + FAILURE_STAGE: ${{ steps.checkout_code.outcome == 'failure' && 'checkout_code' || steps.setup_node.outcome == 'failure' && 'setup_node' || steps.install_npm_dependencies.outcome == 'failure' && 'install_npm_dependencies' || steps.install_python_linters.outcome == 'failure' && 'install_python_linters' || steps.run_yamllint.outcome == 'failure' && 'run_yamllint' || steps.run_actionlint.outcome == 'failure' && 'run_actionlint' || steps.run_zizmor.outcome == 'failure' && 'run_zizmor' || steps.run_ruff.outcome == 'failure' && 'run_ruff' || steps.run_mypy.outcome == 'failure' && 'run_mypy' || steps.run_pylint.outcome == 'failure' && 'run_pylint' || steps.run_bandit.outcome == 'failure' && 'run_bandit' || steps.run_markdownlint.outcome == 'failure' && 'run_markdownlint' || steps.run_biome.outcome == 'failure' && 'run_biome' || 'unknown_or_canceled' }} NODE_VERSION: '24' RUN_ID: ${{ github.run_id }} WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..8a66ad8 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,105 @@ +# Pylint settings: the checks that Codacy's Pylint runs on the automation scripts. Codacy reads +# this file, and the lint job of wp-compatibility-test.yml runs Pylint with it. Ruff and mypy +# check the same scripts with their own, wider rule sets. + +[MAIN] +py-version = 3.12 + +[MESSAGES CONTROL] +disable = all +enable = + C0123, + C0200, + E0100, + E0101, + E0102, + E0103, + E0104, + E0105, + E0106, + E0107, + E0108, + E0110, + E0112, + E0113, + E0114, + E0115, + E0117, + E0202, + E0203, + E0211, + E0236, + E0238, + E0239, + E0240, + E0241, + E0301, + E0302, + E0601, + E0603, + E0604, + E0701, + E0702, + E0704, + E0710, + E0711, + E0712, + E1003, + E1102, + E1111, + E1120, + E1121, + E1123, + E1124, + E1125, + E1126, + E1127, + E1132, + E1200, + E1201, + E1205, + E1206, + E1300, + E1301, + E1302, + E1303, + E1304, + E1305, + E1306, + R0202, + R0203, + W0101, + W0102, + W0104, + W0105, + W0106, + W0107, + W0108, + W0109, + W0120, + W0122, + W0123, + W0124, + W0150, + W0199, + W0221, + W0222, + W0233, + W0404, + W0410, + W0601, + W0602, + W0604, + W0611, + W0612, + W0622, + W0702, + W0705, + W0711, + W1300, + W1301, + W1302, + W1303, + W1305, + W1306, + W1307 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a427c7..6198f18 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -101,6 +101,9 @@ enginescript-site-optimizer/ |-- phpstan.neon # PHPStan configuration |-- phpmd.xml # PHPMD configuration (Codacy reads it with PHPMD 2) |-- phpmd-extra.xml # PHPMD 3 rules (composer phpmd and CI pass both files) +|-- biome.json # Biome lint rules (npm run lint:biome, CI, Codacy) +|-- .pylintrc # Pylint checks for .github/scripts (CI, Codacy) +|-- bandit.yml # Bandit settings for .github/scripts (CI, Codacy) |-- psalm.xml # Psalm configuration |-- phpunit.xml # PHPUnit configuration |-- .distignore # Files left out of the release package @@ -109,7 +112,7 @@ enginescript-site-optimizer/ The release package holds the main plugin file, `uninstall.php`, `readme.txt`, `LICENSE`, `includes/`, and `languages/`. When you add a top-level file or directory, add it to `.distignore` and `.gitattributes` unless it must ship; `.github/scripts/check-plugin-package.py` fails when the package lists disagree. -Codacy reads `phpcs.xml`, and `phpmd.xml`, but it installs no WordPress coding standards, no PHPCSExtra, and only PHPMD 2. Keep those files to what Codacy installs; the full configurations add the rest. After changing `phpcs-wordpress.xml`, or updating their packages, regenerate the Codacy copies with `python .github/scripts/codacy-configs.py phpcs`. CI fails when they are out of date. +Codacy reads `phpcs.xml`, and `phpmd.xml`, but it installs no WordPress coding standards, no PHPCSExtra, and only PHPMD 2. Keep those files to what Codacy installs; the full configurations add the rest. After changing `phpcs-wordpress.xml`, or updating their packages, regenerate the Codacy copies with `python .github/scripts/codacy-configs.py phpcs`. CI fails when they are out of date. Codacy also reads `biome.json`, `.pylintrc`, and `bandit.yml`, and CI runs Biome (`npm run lint:biome`), Pylint, and Bandit with the same files, so a pull request gets every check Codacy runs before Codacy does. ## Making Changes diff --git a/bandit.yml b/bandit.yml new file mode 100644 index 0000000..9151319 --- /dev/null +++ b/bandit.yml @@ -0,0 +1,3 @@ +# Bandit settings: every test runs, none skipped. Codacy's Bandit reads this file, and the lint job +# of wp-compatibility-test.yml runs Bandit with it. +skips: [] diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..5faab12 --- /dev/null +++ b/biome.json @@ -0,0 +1,275 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.5.14/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true + }, + "files": { + "includes": [ + "**", + "!**/vendor", + "!**/node_modules", + "!**/package-lock.json", + "!**/composer.lock" + ] + }, + "formatter": { + "enabled": false + }, + "assist": { + "enabled": false + }, + "linter": { + "enabled": true, + "rules": { + "preset": "none", + "a11y": { + "noAccessKey": "error", + "noAriaHiddenOnFocusable": "error", + "noAriaUnsupportedElements": "error", + "noAutofocus": "error", + "noDistractingElements": "error", + "noHeaderScope": "error", + "noInteractiveElementToNoninteractiveRole": "error", + "noLabelWithoutControl": "error", + "noNoninteractiveElementToInteractiveRole": "error", + "noNoninteractiveTabindex": "error", + "noPositiveTabindex": "error", + "noRedundantAlt": "error", + "noRedundantRoles": "error", + "noStaticElementInteractions": "error", + "noSvgWithoutTitle": "error", + "useAltText": "error", + "useAnchorContent": "error", + "useAriaActivedescendantWithTabindex": "error", + "useAriaPropsForRole": "error", + "useAriaPropsSupportedByRole": "error", + "useButtonType": "error", + "useFocusableInteractive": "error", + "useGenericFontNames": "error", + "useHeadingContent": "error", + "useHtmlLang": "error", + "useIframeTitle": "error", + "useKeyWithClickEvents": "error", + "useKeyWithMouseEvents": "error", + "useMediaCaption": "error", + "useSemanticElements": "error", + "useValidAnchor": "error", + "useValidAriaProps": "error", + "useValidAriaRole": "error", + "useValidAriaValues": "error", + "useValidAutocomplete": "error", + "useValidLang": "error" + }, + "complexity": { + "noAdjacentSpacesInRegex": "error", + "noArguments": "error", + "noBannedTypes": "error", + "noCommaOperator": "error", + "noEmptyTypeParameters": "error", + "noExtraBooleanCast": "error", + "noFlatMapIdentity": "error", + "noImportantStyles": "error", + "noStaticOnlyClass": "error", + "noThisInStatic": "error", + "noUselessCatch": "error", + "noUselessConstructor": "error", + "noUselessContinue": "error", + "noUselessEmptyExport": "error", + "noUselessEscapeInRegex": "error", + "noUselessFragments": "error", + "noUselessLabel": "error", + "noUselessLoneBlockStatements": "error", + "noUselessRename": "error", + "noUselessStringRaw": "error", + "noUselessSwitchCase": "error", + "noUselessTernary": "error", + "noUselessThisAlias": "error", + "noUselessTypeConstraint": "error", + "noUselessUndefinedInitialization": "error", + "useArrowFunction": "error", + "useDateNow": "error", + "useFlatMap": "error", + "useIndexOf": "error", + "useLiteralKeys": "error", + "useNumericLiterals": "error", + "useOptionalChain": "error", + "useRegexLiterals": "error", + "useSimpleNumberKeys": "error" + }, + "correctness": { + "noChildrenProp": "error", + "noConstAssign": "error", + "noConstantCondition": "error", + "noConstantMathMinMaxClamp": "error", + "noConstructorReturn": "error", + "noEmptyCharacterClassInRegex": "error", + "noEmptyPattern": "error", + "noGlobalObjectCalls": "error", + "noInnerDeclarations": "error", + "noInvalidBuiltinInstantiation": "error", + "noInvalidConstructorSuper": "error", + "noInvalidDirectionInLinearGradient": "error", + "noInvalidGridAreas": "error", + "noInvalidPositionAtImportRule": "error", + "noInvalidUseBeforeDeclaration": "error", + "noMissingVarFunction": "error", + "noNonoctalDecimalEscape": "error", + "noPrecisionLoss": "error", + "noPrivateImports": "error", + "noQwikUseVisibleTask": "error", + "noRenderReturnValue": "error", + "noSelfAssign": "error", + "noSetterReturn": "error", + "noStringCaseMismatch": "error", + "noSwitchDeclarations": "error", + "noUnknownFunction": "error", + "noUnknownMediaFeatureName": "error", + "noUnknownProperty": "error", + "noUnknownPseudoClass": "error", + "noUnknownPseudoElement": "error", + "noUnknownTypeSelector": "error", + "noUnknownUnit": "error", + "noUnmatchableAnbSelector": "error", + "noUnreachable": "error", + "noUnreachableSuper": "error", + "noUnsafeFinally": "error", + "noUnsafeOptionalChaining": "error", + "noUnusedFunctionParameters": "error", + "noUnusedImports": "error", + "noUnusedLabels": "error", + "noUnusedPrivateClassMembers": "error", + "noUnusedVariables": "error", + "noVoidElementsWithChildren": "error", + "noVoidTypeReturn": "error", + "noVueDataObjectDeclaration": "error", + "noVueDuplicateKeys": "error", + "noVueReservedKeys": "error", + "noVueReservedProps": "error", + "useExhaustiveDependencies": "error", + "useGraphqlNamedOperations": "error", + "useHookAtTopLevel": "error", + "useImageSize": "error", + "useIsNan": "error", + "useJsxKeyInIterable": "error", + "useParseIntRadix": "error", + "useQwikClasslist": "error", + "useQwikMethodUsage": "error", + "useQwikValidLexicalScope": "error", + "useValidForDirection": "error", + "useValidTypeof": "error", + "useYield": "error" + }, + "performance": { + "noAccumulatingSpread": "error", + "noDynamicNamespaceImportAccess": "error", + "noImgElement": "error", + "noUnwantedPolyfillio": "error", + "useGoogleFontPreconnect": "error" + }, + "security": { + "noBlankTarget": "error", + "noDangerouslySetInnerHtml": "error", + "noDangerouslySetInnerHtmlWithChildren": "error", + "noGlobalEval": "error" + }, + "style": { + "noDescendingSpecificity": "error", + "noHeadElement": "error", + "noNonNullAssertion": "error", + "useArrayLiterals": "error", + "useConst": "error", + "useDeprecatedReason": "error", + "useExponentiationOperator": "error", + "useExportType": "error", + "useImportType": "error", + "useLiteralEnumMembers": "error", + "useNodejsImportProtocol": "error", + "useShorthandFunctionType": "error", + "useTemplate": "error" + }, + "suspicious": { + "noApproximativeNumericConstant": "error", + "noArrayIndexKey": "error", + "noAssignInExpressions": "error", + "noAsyncPromiseExecutor": "error", + "noBiomeFirstException": "error", + "noCatchAssign": "error", + "noClassAssign": "error", + "noCommentText": "error", + "noCompareNegZero": "error", + "noConfusingLabels": "error", + "noConfusingVoidType": "error", + "noConstEnum": "error", + "noControlCharactersInRegex": "error", + "noDebugger": "error", + "noDocumentCookie": "error", + "noDocumentImportInPage": "error", + "noDoubleEquals": "error", + "noDuplicateAtImportRules": "error", + "noDuplicateCase": "error", + "noDuplicateClassMembers": "error", + "noDuplicateCustomProperties": "error", + "noDuplicateElseIf": "error", + "noDuplicateFields": "error", + "noDuplicateFontNames": "error", + "noDuplicateJsxProps": "error", + "noDuplicateObjectKeys": "error", + "noDuplicateParameters": "error", + "noDuplicateProperties": "error", + "noDuplicateSelectorsKeyframeBlock": "error", + "noDuplicateTestHooks": "error", + "noEmptyBlock": "error", + "noEmptyInterface": "error", + "noExplicitAny": "error", + "noExportsInTest": "error", + "noExtraNonNullAssertion": "error", + "noFallthroughSwitchClause": "error", + "noFocusedTests": "error", + "noFunctionAssign": "error", + "noGlobalAssign": "error", + "noGlobalIsFinite": "error", + "noGlobalIsNan": "error", + "noHeadImportInDocument": "error", + "noImplicitAnyLet": "error", + "noImportAssign": "error", + "noImportantInKeyframe": "error", + "noIrregularWhitespace": "error", + "noLabelVar": "error", + "noMisleadingCharacterClass": "error", + "noMisleadingInstantiator": "error", + "noMisrefactoredShorthandAssign": "error", + "noNonNullAssertedOptionalChain": "error", + "noOctalEscape": "error", + "noPrototypeBuiltins": "error", + "noQuickfixBiome": "error", + "noReactSpecificProps": "error", + "noRedeclare": "error", + "noRedundantUseStrict": "error", + "noSelfCompare": "error", + "noShadowRestrictedNames": "error", + "noShorthandPropertyOverrides": "error", + "noSparseArray": "error", + "noSuspiciousSemicolonInJsx": "error", + "noTemplateCurlyInString": "error", + "noThenProperty": "error", + "noTsIgnore": "error", + "noUnknownAtRules": "error", + "noUnsafeDeclarationMerging": "error", + "noUnsafeNegation": "error", + "noUselessEscapeInString": "error", + "noUselessRegexBackrefs": "error", + "noWith": "error", + "useAdjacentOverloadSignatures": "error", + "useBiomeIgnoreFolder": "error", + "useDefaultSwitchClauseLast": "error", + "useGetterReturn": "error", + "useGoogleFontDisplay": "error", + "useIsArray": "error", + "useIterableCallbackReturn": "error", + "useNamespaceKeyword": "error" + } + } + } +} diff --git a/composer.json b/composer.json index 7dc158a..89b9594 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,8 @@ "phpcompatibility/phpcompatibility-wp": "^2.1", "automattic/vipwpcs": "^3.0.1", "z4kn4fein/php-semver": "^3.0", - "rector/rector": "^2.6" + "rector/rector": "^2.6", + "slevomat/coding-standard": "^8.22.1" }, "scripts": { "phpcs": "phpcs --standard=phpcs-wordpress.xml", diff --git a/composer.lock b/composer.lock index 4891099..20b4fd9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a648058a6f4b58844151ea06d36c18a4", + "content-hash": "4df225d1c3165d1965c95caa744c80cf", "packages": [], "packages-dev": [ { @@ -5876,6 +5876,71 @@ }, "time": "2025-09-30T22:22:48+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "8.22.1", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "1dd80bf3b93692bedb21a6623c496887fad05fec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/1dd80bf3b93692bedb21a6623c496887fad05fec", + "reference": "1dd80bf3b93692bedb21a6623c496887fad05fec", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.1.2", + "php": "^7.4 || ^8.0", + "phpstan/phpdoc-parser": "^2.3.0", + "squizlabs/php_codesniffer": "^3.13.4" + }, + "require-dev": { + "phing/phing": "3.0.1|3.1.0", + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpstan/phpstan": "2.1.24", + "phpstan/phpstan-deprecation-rules": "2.0.3", + "phpstan/phpstan-phpunit": "2.0.7", + "phpstan/phpstan-strict-rules": "2.0.6", + "phpunit/phpunit": "9.6.8|10.5.48|11.4.4|11.5.36|12.3.10" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/8.22.1" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2025-09-13T08:53:30+00:00" + }, { "name": "spatie/array-to-xml", "version": "3.4.4", diff --git a/package-lock.json b/package-lock.json index 91a514c..b7aa047 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,12 +7,188 @@ "name": "enginescript-site-optimizer", "license": "GPL-3.0-or-later", "devDependencies": { + "@biomejs/biome": "2.5.14", "markdownlint-cli2": "0.24.2" }, "engines": { "node": ">=22.22.2" } }, + "node_modules/@biomejs/biome": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.5.14.tgz", + "integrity": "sha512-0FabLIjd4M/dm8VFI86RMaLLdgepzbdfiAL2R8cr7V81OYYrP1w7Z73KfAwPK5h9SrEBXTzNG2y+mBwPo9xRnw==", + "dev": true, + "license": "MIT OR Apache-2.0", + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "2.5.14", + "@biomejs/cli-darwin-x64": "2.5.14", + "@biomejs/cli-linux-arm64": "2.5.14", + "@biomejs/cli-linux-arm64-musl": "2.5.14", + "@biomejs/cli-linux-x64": "2.5.14", + "@biomejs/cli-linux-x64-musl": "2.5.14", + "@biomejs/cli-win32-arm64": "2.5.14", + "@biomejs/cli-win32-x64": "2.5.14" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.5.14.tgz", + "integrity": "sha512-UnzaXO65L4tsZimFITFP2M121GyhDcWFrT3pL5ZJ5U4XcS/0L5VHYytVohdCf/gnDUFHgl2I9xnt5bV/J1kxHQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.5.14.tgz", + "integrity": "sha512-kiy8qA16K93J7uvFfWi4LgjqDpnRKyePAna6A0Y4jxyUga35SYpIZ2cNWlhy0lsfgqRenCpfymnJWEZ6mgpRgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.5.14.tgz", + "integrity": "sha512-vO/9BaU1n30CiFNLx49gMTMtbCAAqlo/EqFoG0BU3deQInTbJrmXSmTQ9e3FoDZIKQnvSLDVNL4lx1ci7y1T1Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.5.14.tgz", + "integrity": "sha512-SJ9PrZkBnnH9dHJDnxk34vKs0GB2dbsioaft6/hPhWJ7AHpwYH83Isnhj0FSRpFkGgpVfJ1lds23ApB2czUDLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.5.14.tgz", + "integrity": "sha512-VHZRa7CCQBUWKxNwUvHJeuW03WFRgN5NWO//SDGOitc9QIeNyfA42V9zlKm+x82xFSG9Bzi5fi+hbhm9anO8yA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.5.14.tgz", + "integrity": "sha512-2kI5PrMgW5dcEZYrstLPmUmCwkUwZY39rP4BN93Vxbwcs2O57LDQOktUZZYPvvspN5i0mhGr3TJtF5sU26NUWg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.5.14.tgz", + "integrity": "sha512-pHgAFffmZtaYoxavEsWEYNvcA7NwOIjLyqw2HXyLbt16xYryX0L4fMV2u0G9ag6LNYPIoqWaWqzUcnc6rLGGXg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "2.5.14", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.5.14.tgz", + "integrity": "sha512-oJWmBhoHsnhUKIke+0gXDX0mltJrWHA1UyHsrTlXwX0TL64ilVZAo+TYZm97baecV0esBdpzy3k96q+09JaZUQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", diff --git a/package.json b/package.json index 76aee1b..facbf6a 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,11 @@ "node": ">=22.22.2" }, "scripts": { + "lint:biome": "biome lint .", "lint:md": "markdownlint-cli2" }, "devDependencies": { + "@biomejs/biome": "2.5.14", "markdownlint-cli2": "0.24.2" }, "overrides": { diff --git a/phpcs-wordpress.xml b/phpcs-wordpress.xml index b75c976..2f2fa7f 100644 --- a/phpcs-wordpress.xml +++ b/phpcs-wordpress.xml @@ -194,6 +194,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phpcs.xml b/phpcs.xml index 9e5b488..7ae94f8 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -102,8 +102,10 @@ 0 + + @@ -131,6 +133,7 @@ + 5 @@ -149,6 +152,7 @@ + @@ -180,6 +184,7 @@ + 0 @@ -194,6 +199,7 @@ 5 warning + @@ -201,8 +207,14 @@ + + + + + + 0 @@ -212,6 +224,8 @@ 5 + + @@ -258,6 +272,18 @@ 5 + + + + + + + + + + + + 5 @@ -435,6 +461,7 @@ 5 + @@ -456,6 +483,7 @@ 5 +