Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 5 additions & 4 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
# Codacy configuration
#
# With each tool's "Configuration file" setting on, Codacy reads phpcs.xml, phpmd.xml, eslint.config.mjs, .stylelintrc.json, 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, eslint.wordpress.config.mjs, stylelint-wordpress.json).
# See CONTRIBUTING.md.
# With each tool's "Configuration file" setting on, Codacy reads phpcs.xml, phpmd.xml,
# eslint.config.mjs, .stylelintrc.json, .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, eslint.wordpress.config.mjs,
# stylelint-wordpress.json) and the same Biome, Pylint, and Bandit files. See CONTRIBUTING.md.

engines:
# Lizard reads the lock files as source code and reports their length.
Expand Down
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
/package.json
/package-lock.json
/phpcs.xml
/bandit.yml
/biome.json
/phpcs-wordpress.xml
/phpmd.xml
/phpstan.neon
Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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
/phpstan.neon export-ignore
Expand Down
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ testing:
- any-glob-to-any-file: stubs/**/*
- 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: phpstan.neon
Expand Down
2 changes: 2 additions & 0 deletions .github/lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -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
12 changes: 11 additions & 1 deletion .github/scripts/codacy-configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = " <!-- BEGIN GENERATED RULES: python .github/scripts/codacy-configs.py phpcs -->"
END = " <!-- END GENERATED RULES -->"
# A message code (Standard.Category.Sniff.Code) has three dots; a sniff code has two.
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/wp-compatibility-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,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: |
Expand All @@ -1367,6 +1378,11 @@ jobs:
npm run --silent lint:css
python3 .github/scripts/codacy-configs.py stylelint --check

- 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() }}
Expand All @@ -1382,9 +1398,12 @@ 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_eslint=${{ steps.run_eslint.outcome }}
run_stylelint=${{ steps.run_stylelint.outcome }}
run_biome=${{ steps.run_biome.outcome }}
run: |
mkdir -p "$RUNNER_TEMP/optimizations-ace-mc-diagnostics"
printf '%s\n' "$STEP_RESULTS" > "$RUNNER_TEMP/optimizations-ace-mc-diagnostics/steps.txt"
Expand Down Expand Up @@ -1425,7 +1444,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' || steps.run_eslint.outcome == 'failure' && 'run_eslint' || steps.run_stylelint.outcome == 'failure' && 'run_stylelint' || '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_eslint.outcome == 'failure' && 'run_eslint' || steps.run_stylelint.outcome == 'failure' && 'run_stylelint' || 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 }}
Expand Down
105 changes: 105 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading