From dfd3481f33fbabd6ed7315790637b868c639f997 Mon Sep 17 00:00:00 2001 From: Peter Downey Date: Tue, 3 Nov 2026 22:41:59 -0500 Subject: [PATCH] Keep the lock files out of Codacy's Lizard, and use one-line docstrings Codacy's Lizard reads composer.lock and package-lock.json as source code and flags their length; .codacy.yml now leaves them out, as the EngineScript repository does. The two multi-line docstrings keep their summary as a one-line docstring and the rest becomes a comment, which both of Codacy's contradicting docstring rules (D212, D213) accept. Co-Authored-By: Claude Opus 5.5 --- .codacy.yml | 20 ++++++++------------ .github/scripts/check-plugin-package.py | 6 ++---- .github/scripts/test-automation.py | 7 +++---- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.codacy.yml b/.codacy.yml index db352ee..dda7592 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -1,16 +1,12 @@ --- -# Codacy configuration. -# -# TSLint is deprecated and is switched off for this repository in Codacy, yet -# Codacy still ran it. It is turned off from here in two ways: tslint.json -# enables no rule, and the paths below keep every file away from the tool. -# The two JSON files are named as well, because they are what it flagged: it -# asked for trailing commas and sorted keys, which JSON and npm's lock file -# cannot have. Every other tool still reads every file. +# Codacy configuration + engines: - tslint: + # Lizard reads the lock files as source code and reports their length. + # Composer and npm generate them; nobody writes them by hand. + lizard: exclude_paths: - - "**" - - "**/*" - - "package.json" + - "composer.lock" - "package-lock.json" + - "**/composer.lock" + - "**/package-lock.json" diff --git a/.github/scripts/check-plugin-package.py b/.github/scripts/check-plugin-package.py index 99836dc..30bf135 100755 --- a/.github/scripts/check-plugin-package.py +++ b/.github/scripts/check-plugin-package.py @@ -66,10 +66,8 @@ def tracked_files(root: Path, *options: str) -> set[str]: def check_distignore(root: Path, tracked: set[str], names: set[str]) -> None: - """Require .distignore to keep exactly the tracked files that the allowlist ships. - - Git matches the patterns, so they mean what they mean to `wp dist-archive`. - """ + """Require .distignore to keep exactly the tracked files that the allowlist ships.""" + # Git matches the patterns, so they mean what they mean to `wp dist-archive`. distignore = root / ".distignore" if distignore.is_symlink() or not distignore.is_file(): raise ValueError("The .distignore file is missing.") diff --git a/.github/scripts/test-automation.py b/.github/scripts/test-automation.py index 5644c2e..4684cd3 100755 --- a/.github/scripts/test-automation.py +++ b/.github/scripts/test-automation.py @@ -1,9 +1,8 @@ #!/usr/bin/env python3 -"""Standard-library regression fixtures, executed by GitHub's package-check job. +"""Standard-library regression fixtures, executed by GitHub's package-check job.""" -These fixtures do not bootstrap WordPress or replace workflow-generated PHP tests. -All mutation is confined to a temporary fixture repository on the runner. -""" +# These fixtures do not bootstrap WordPress or replace workflow-generated PHP tests. +# All mutation is confined to a temporary fixture repository on the runner. from __future__ import annotations