Skip to content

chore(corekit): spell the import-outside-toplevel pragma correctly (#1923) - #1925

Merged
JarryShaw merged 2 commits into
mainfrom
chore/1923-pylint-pragma
Oct 19, 2026
Merged

JarryShaw merged 2 commits into
mainfrom
chore/1923-pylint-pragma

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Corrects the misspelt import-outside-top-level pylint pragmas in corekit/fields/collections.py and misc.py. pylint ignored them with W0012 and kept reporting C0415. Only comments change; the AST is identical.

The new tests/project/test_pylint_pragma_names_1923_unit.py checks every pragma name in pcapkit/ against a pinned list. Where pylint can be imported, it also checks each name against pylint's message store. No test extra installs pylint, so in CI only the pinned list runs. The test fails on main.

Closes #1923

…1923)

- `pcapkit/corekit/fields/collections.py` and `misc.py`: the pragmas said
  `import-outside-top-level`, which pylint rejects as `unknown-option-value`
  while still reporting `import-outside-toplevel`; spell the name correctly.
  Comments only, the AST is unchanged.
- `tests/project/test_pylint_pragma_names_1923_unit.py`: every pylint pragma
  name in `pcapkit/` must be on a pinned list; where pylint is importable,
  each name is also checked against its message store with the Makefile's
  plugins loaded.

Closes #1923
@JarryShaw JarryShaw added chore Maintenance work: tooling, repo hygiene, no library behaviour change review: running A cross-review is in flight against the current head - no verdict yet labels Oct 19, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 15442a362. A Sonnet cross-review reverted both source files: pylint then reported W0012 at all five pragma sites and still flagged C0415, and with the fix both disappear. Run with the Makefile plugins over all of pcapkit/, it finds no other unknown pragma name. The AST is unchanged. The new test reads only tokenize comments and fails on main, and tests/project passes. CI runs only the pinned-list check, because only lint.yml installs pylint and it runs no tests.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 19, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

NEEDS CHANGES at 15442a362. The Python 3.12 and 3.13 legs fail on tests/test_tier_guard.py::DependencyGateCoverageTests::test_every_gated_flag_is_classified. The new test gates on a local HAS_PYLINT at test_pylint_pragma_names_1923_unit.py:172, which tests._dependency_gates cannot resolve. Fix: define the flag in tests/_dependency_gates.py in the shape the guard reads, or list it in NON_DISTRIBUTION_FLAGS. The review missed this because it did not run the tier guard.

@JarryShaw JarryShaw added review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: good-to-go Cross-review at the current head says ready; CI state is separate labels Oct 19, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 19, 2026
- `tests/project/test_pylint_pragma_names_1923_unit.py`: define `HAS_PYLINT`
  with `importlib.util.find_spec`, the shape the gate scan resolves, and
  import pylint inside the gated method.
- `tests/_dependency_gates.py`: map `pylint` to its distribution and record
  why the `test` and `gate` jobs leave the gate dark: like mypy, pylint is
  a lint-tier tool that lint.yml already runs and no extra declares.

Closes #1923
@JarryShaw JarryShaw added review: running A cross-review is in flight against the current head - no verdict yet and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Oct 19, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at 0f1f4ea1c. HAS_PYLINT now uses the find_spec shape the scanner reads. It is declared in tests/_dependency_gates.py next to HAS_MYPY, with dark={'test','gate'}, which matches the guard's derived job set exactly. A Sonnet re-review ran tests/test_tier_guard.py with pylint importable and with it blocked, and both runs pass. With pylint blocked, the lookup skips visibly. The test still fails on main's source files. The exclusion's reason checks out: only lint.yml installs pylint, and it runs with W0012 enabled.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 90.07% (unit tier, Python 3.15, 0f1f4ea1c, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 2 20 2 96.77%
pcapkit/const 19595 881 2618 867 92.11%
pcapkit/corekit 2504 70 792 36 96.54%
pcapkit/dumpkit 276 3 100 3 98.40%
pcapkit/foundation 2916 164 1016 34 93.59%
pcapkit/interface 138 7 52 5 93.68%
pcapkit/protocols 17411 224 4580 189 98.10%
pcapkit/toolkit 872 177 298 8 77.18%
pcapkit/utilities 522 2 158 4 99.12%
pcapkit/vendor 4431 2341 1018 156 43.64%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw
JarryShaw merged commit 57371ce into main Oct 19, 2026
57 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 19, 2026
@JarryShaw
JarryShaw deleted the chore/1923-pylint-pragma branch October 19, 2026 14:53
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance work: tooling, repo hygiene, no library behaviour change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

chore(corekit): pylint pragmas misspell import-outside-toplevel, so they suppress nothing

1 participant