Configure layered Python linting - #102
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. Summary
Validation
WalkthroughThe pull request adds layered Python and Rust linting, updates typed Python configuration and extraction interfaces, improves diagnostic validation, and expands test assertions and snapshot coverage. ChangesRepository quality updates
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 19 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (19 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Your free Security trial is over. An organization admin can activate billing to continue. Comment |
Reviewer's GuideConfigures layered Python linting by integrating df12-python-lints and ambrleaks into the Makefile and pyproject, tightens Ruff/Pylint policy for Python 3.14, and updates Python and Rust tests, helpers, and documentation to conform to the expanded lint and snapshot gates. Sequence diagram for the layered make lint pipelinesequenceDiagram
actor Developer
participant Makefile
participant UV
participant Ruff
participant Interrogate
participant PylintPyPy
participant PylintDf12
participant Ambrleaks
participant CargoDoc
participant CargoClippy
participant Whitaker
Developer->>Makefile: make lint
Makefile->>UV: UV_RUN ruff check
UV->>Ruff: ruff check
Makefile->>UV: INTERROGATE interrogate
UV->>Interrogate: interrogate --fail-under 100 python/stilyagi tests
Makefile->>UV: PYLINT pylint-pypy --load-plugins=
UV->>PylintPyPy: pylint-pypy python/stilyagi tests
Makefile->>UV: DF12_PYLINT pylint --load-plugins=df12_python_lints
UV->>PylintDf12: pylint --disable=all --enable=DF12_PYLINT_MESSAGES python/stilyagi tests
Makefile->>UV: AMBRLEAKS ambrleaks
UV->>Ambrleaks: ambrleaks tests
Makefile->>CargoDoc: cargo doc
Makefile->>CargoClippy: cargo clippy
Makefile->>Whitaker: whitaker --all
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph. If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced. crates/stilyagi-markdown/src/tests/ir_consistency.rs Comment on lines +127 to +132 let mut document = valid_document().expect("expected Markdown IR document");
if let Some(node) = document.nodes.first().cloned() {
document.nodes.push(node);
}
assert_validation_reports(&document, "ir-duplicate-node-id", &["duplicate node id"]);❌ New issue: Code Duplication |
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph. If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced. tests/test_config_resolution.py Comment on lines +192 to +194 assert resolved.cache_dir == pathlib.Path(".inline"), (
"expected resolved.cache_dir == pathlib.Path('.inline')"
)❌ New issue: Code Duplication |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Current revision =='
git rev-parse HEAD
git status --short
printf '%s\n' '== Module outline =='
ast-grep outline tests/test_config_resolution.py --items all --view expanded
printf '%s\n' '== Named tests and nearby context =='
rg -n -A80 -B20 \
'^\s*def (test_cli_overrides_win_over_every_config_source|test_explicit_config_path_and_inline_override_precedence)\s*\(' \
tests/test_config_resolution.py
printf '%s\n' '== Local fixtures/helpers =='
rg -n -A25 -B3 \
'^\s*(def|class)\s+|^`@pytest`\.fixture' \
tests/test_config_resolution.pyLength of output: 20419
Do not refactor these tests. I validated the current codegraph at The tests have similar setup, but they verify different precedence boundaries. Paste this into the CodeScene diagnostic suppression field:
You are interacting with an AI system. |
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Ensure that this is validated against the current version of the codegraph. If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced. crates/stilyagi-markdown/src/tests/ir_consistency.rs Comment on file fn validate_ir_consistency_reports_region_text_mismatches() {
assert_validation_reports_on_first_region(
|region| region.text.push_str(" drift"),
assert_invalid_document(❌ New issue: Code Duplication |
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Large Methodtests/test_config_schema.py: test_baseline_config_parses_and_preserves_reserved_values What lead to degradation?test_baseline_config_parses_and_preserves_reserved_values has 78 lines, threshold = 70 Why does this problem occur?Overly long functions make the code harder to read. The recommended maximum function length for the Python language is 70 lines of code. Severity: Brain Method - Complex Method - Long Method. How to fix it?We recommend to be careful here -- just splitting long functions don't necessarily make the code easier to read. Instead, look for natural chunks inside the functions that expresses a specific task or concern. Often, such concerns are indicated by a Code Comment followed by an if-statement. Use the EXTRACT FUNCTION refactoring to encapsulate that concern. |
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Sorry @leynos, your pull request is larger than the review limit of 150000 diff characters
7356fb8 to
e4a6f50
Compare
|
@coderabbitai review |
Evaluate wrapped assertion diagnostics through a shared test helper so SlipCover measures executed test behaviour instead of failure-only message expressions. Keep inline assertions where pytest rewriting or type narrowing matters, and document the test-only boundary for the helper.
Extract shared invalid-document setup and diagnostic assertions while keeping each validation rule as a separately named test. Preserve the setup panic message without `expect` so the Whitaker test-helper policy remains green.
Separate public-field and reserved-value checks into focused helpers while preserving the baseline configuration test's end-to-end setup and loading.
Enable the full thirteen-message v0.2.0 rule set under CPython 3.14 and pin the plugin and snapshot scanner to the same tag. Add generated slots to the closed Makefile recipe case required by the new dataclass-layout lint.
Resolve the lockfile from the rebased dependency set rather than carrying a conflicted package graph from the feature branch. Document the licence test helpers' return values and remove the unverified exception claim so the enabled DOC checks describe their real contracts.
Assert the pinned df12 lint commands, messages, execution order, and project configuration so `make lint` cannot silently lose a Python lint layer. Clarify the `cache-dir` diagnostic to match the accepted path and string inputs, with a regression test for invalid values.
Require both df12 Pylint and ambrleaks commands to use the shared `DF12_PYTHON` selector, so the Makefile test protects their CPython 3.14 execution contract.
Record the resolved df12 Python lint dependency after preserving the target branch's lockfile during the rebase conflicts.
Execute `make lint` through cmd-mox command doubles so the df12 Pylint and ambrleaks stages cannot disappear or move behind the Rust linters.
Resolve df12 Pylint and ambrleaks from the same CPython 3.14 development environment. Pin the package source to the immutable commit recorded in `uv.lock` so a mutable Git tag cannot change the lint policy.
Validate normalised line starts before locating offsets so malformed IR metadata consistently falls back to the first source location.
Return directly for truthy conditions while retaining the supplied diagnostic when assertions fail.
Include the expected fragment in assertion failures to make parametrized file-check regressions easier to diagnose.
Include the target and missing fragment in recipe-contract assertions to make future failures immediately actionable.
Replace the previous Python type checker with strict Pyright and correct the typed configuration and bridge boundaries it exposes. Strengthen lint and location contracts, document the locked lint stack, and keep malformed IR fixtures explicit.
Keep the linting guidance aligned with the immutable v0.2.0 source revision, which includes the dataclass slots diagnostic.
Keep the hermetic Makefile stage-order contract intact while lowering test complexity, and centralize line-index validity without changing location fallback behaviour.
Run the documented type checker through the pinned ty 0.0.72 release so CI does not rely on an ambient executable. Restore the Python 3.14 ty configuration, update the contract test, and retain the formatter-normalized developer guide.
Update the documented Whitaker invocation, layered linting reference, and configuration and extraction boundaries to match the repository's current Makefile and Python APIs.
Describe the public configuration boundaries, verify non-string mapping keys directly and with Hypothesis, and preserve explicit successful cache state transitions in extraction helpers.
Document the immutable df12 source, extraction vocabulary helpers, and the completed PR #102 linting work.
Reject non-string keys before parsing nested lint and Markdown mappings. Add direct parser regressions so configuration callers receive a typed error rather than key coercion or a comparison failure.
bebb90f to
de52d7e
Compare
|
@coderabbitai Have the following now been resolved? python/stilyagi/engine/extraction.py (1)
Do not use 🤖 Detailed instructionsUse a wyvern agent team to verify each finding against the current code and only fix it if needed. Fix any documentation issues using a scribe agent team. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Use a scrutineer agent for execution of tests and summarizing the results. In Source: Coding guidelines |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
target='python/stilyagi/engine/extraction.py'
printf '%s\n' '== Current revision =='
git rev-parse HEAD
git status --short
printf '%s\n' '== Target helper bodies =='
rg -n -A42 -B4 \
'^\s*def\s+(_validate_syntax_vocab_once|reset_extraction_state_for_tests|warn_unknown_ir_region_kinds)\s*\(' \
"$target"
printf '%s\n' '== Bare returns in target =='
rg -n '^[[:space:]]+return[[:space:]]*$' "$target" || trueLength of output: 3685
Treat this finding as partially resolved at
AI coding agent prompt:
You are interacting with an AI system. |
Summary
This branch adopts layered Python linting so architectural, documentation and
snapshot defects are checked alongside Ruff. It pins
df12-python-lintsv0.1.0, runs all twelve plug-in messages and
ambrleaksunder CPython 3.14,and enables Ruff preview,
ASYNC,DOC, and NumPy-styleDrules.The expanded policy also brings the existing Python tests, reviewed snapshots
and Rust test helpers into conformance without lint suppressions. Wrapped test
diagnostics are evaluated eagerly so the required assertion context does not
appear as uncovered, failure-only code to SlipCover.
Review walkthrough
and Python project configuration
for the pinned runtimes, complete df12 message set, ambrleaks command and Ruff
policy.
and the developers' guide
for the layered linting rationale, assertion-helper scope and maintenance
boundaries.
its focused tests,
and the CI contract tests
for eager diagnostic evaluation, stable snapshot contracts and CPython 3.14
runtime-annotation handling.
and Markdown consistency helpers
for the structural Whitaker repairs surfaced by the complete gate.
Validation
make check-fmt: passed.make lint: passed, including Ruff, 100% Interrogate coverage, focused PyPyPylint, all df12 messages under CPython 3.14, ambrleaks, Rustdoc, Clippy and
Whitaker.
make typecheck: passed.make test: passed with 330 Rust tests, 10 Rust doctests, 197 Python testsand 16 reviewed snapshots.
ratchet baseline.
make markdownlint: passed, including spelling validation.make nixie: passed.mbake validate Makefile: passed.git diff --check: passed.References
Summary by Sourcery
Adopt layered Python linting and bring project tooling, tests, documentation, and boundary helpers into compliance with the expanded quality gates.
New Features:
Bug Fixes:
Enhancements:
Build:
CI:
Documentation:
Tests:
Chores: