Repository navigation
Complete configured lints and refresh test infrastructure - #45
Open
scottgerring wants to merge 11 commits into
Open
scottgerring wants to merge 11 commits into
scottgerring wants to merge 11 commits into
Conversation
scottgerring
force-pushed
the
sgg/sept-updates
branch
3 times, most recently
from
September 17, 2026 12:41
64eb774 to
111d91c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Attribute and trait matching have correctness gaps, and logical module severity propagation is not active in production.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Completes configured lint behavior, improves diagnostics and context discovery, and modernizes testing and dependencies.
Changes:
- Implements logical, attribute, and trait-based lint rules.
- Improves trait discovery, diagnostics, and context deduplication.
- Adds shared Nextest infrastructure and refreshes dependencies.
File summaries
| File | Description |
|---|---|
.github/workflows/pr.yaml |
Runs the shared Nextest-based suite. |
.gitignore |
Ignores Sphinx artifacts. |
Cargo.lock |
Refreshes workspace dependencies. |
Cargo.toml |
Updates dependency versions. |
README.md |
Documents the new test workflow. |
cargo_pup_common/src/project_context.rs |
Merges duplicate context metadata. |
cargo_pup_lint_config/src/module_lint/tests.rs |
Tests logical module configuration. |
cargo_pup_lint_config/src/struct_lint/tests.rs |
Tests trait and logical struct builders. |
cargo_pup_lint_impl/src/lints/configuration_factory.rs |
Removes the unused generator. |
cargo_pup_lint_impl/src/lints/function_lint/lint.rs |
Adds detailed match evidence. |
cargo_pup_lint_impl/src/lints/module_lint/lint.rs |
Implements logical module rules. |
cargo_pup_lint_impl/src/lints/struct_lint/lint.rs |
Implements attribute, trait, and logical rules. |
cargo_pup_lint_impl/src/lib.rs |
Exports the configuration factory. |
pup.ron |
Updates self-lint rules and paths. |
scripts/test.sh |
Adds the shared test runner. |
src/pup_driver.rs |
Uses the public factory export. |
test_app/Cargo.lock |
Refreshes test-app dependencies. |
test_app/Cargo.toml |
Updates and adds test dependencies. |
test_app/expected_output |
Records new lint diagnostics. |
test_app/proc_macro_test/Cargo.toml |
Removes unused dependencies. |
test_app/pup.ron |
Adds logical and struct rules. |
test_app/scripts/validate-print-traits.sh |
Validates trait output. |
test_app/src/configured_struct_rules.rs |
Adds struct-rule fixtures. |
test_app/src/logical_module_rules.rs |
Adds module-rule fixtures. |
test_app/src/main.rs |
Registers new fixtures. |
test_app/tests/project_context_dedup_test.rs |
Tests cross-context deduplication. |
test_app/tests/pup_ron_test.rs |
Generates expanded test configuration. |
tests/ron_test.rs |
Updates generated self-lint configuration. |
tests/ui/function_lint/builder_style.rs |
Updates diagnostic assertions. |
tests/ui/function_lint/builder_style.stderr |
Records builder diagnostics. |
tests/ui/function_lint/is_async.rs |
Updates async assertions. |
tests/ui/function_lint/is_async.stderr |
Records async diagnostics. |
tests/ui/function_lint/is_unsafe_match.rs |
Updates unsafe assertions. |
tests/ui/function_lint/is_unsafe_match.stderr |
Records unsafe diagnostics. |
tests/ui/module_lint_new/logical_rules.rs |
Adds logical module UI cases. |
tests/ui/module_lint_new/logical_rules.stderr |
Records module-rule diagnostics. |
tests/ui/module_lint_new/pup.ron |
Configures module UI rules. |
tests/ui/struct_lint_new/attributes_and_configured_rules.rs |
Adds struct-rule UI cases. |
tests/ui/struct_lint_new/attributes_and_configured_rules.stderr |
Records struct-rule diagnostics. |
tests/ui/struct_lint_new/pup.ron |
Configures struct UI rules. |
Review details
Suppressed comments (2)
cargo_pup_lint_impl/src/lints/struct_lint/lint.rs:388
- Filtering out every trait with generic parameters makes
ImplementsTraitdeterministically return false for common traits such asFrom<T>,AsRef<T>, andIterator<Item = T>. Consequently, required rules report valid implementations as missing and forbidden rules allow them. The implementation should inspect matching impls or construct a trait reference with inference variables instead of silently excluding generic traits.
.filter(|&trait_def_id| {
// Traits with more than `Self` as a generic parameter (e.g.
// `From<T>`, `AsRef<T>`) can't be queried via `implements_trait`,
// which builds a `TraitRef` with exactly one type argument.
ctx.tcx.generics_of(trait_def_id).own_params.len() <= 1
cargo_pup_lint_impl/src/lints/struct_lint/lint.rs:479
- Trait applicability only examines the matcher tree, so rule-only constraints are omitted from
print-traits. For example, the newly addedrequired_trait_rule_check, whose matcher is only a struct name, will not appear besideconfigured_struct_rules::RequiredTraiteven though itsImplementsTraitrule directly constrains implementations of that trait. Include trait references from the rule tree as well.
fn applies_to_trait(&self, trait_path: &str) -> bool {
matcher_references_trait(&self.matches, trait_path)
- Files reviewed: 37/40 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+931
to
+935
| if self.evaluate_module_rule(ctx, item, rule) == Some(false) { | ||
| let mut violations = Vec::new(); | ||
| collect_module_rule_violations(rule, true, &evaluate_leaf, &mut violations); | ||
| for (leaf, expected) in violations { | ||
| self.render_module_rule_violation(ctx, item, leaf, expected); |
Comment on lines
+321
to
+324
| if let Some(source) = &local_position.sf.src | ||
| && preceding_outer_attributes(source, local_position.pos.0 as usize) | ||
| .into_iter() | ||
| .any(|attribute| regex.is_match(attribute)) |
scottgerring
force-pushed
the
sgg/sept-updates
branch
from
September 18, 2026 12:28
de9299f to
e033b1f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete configured lint behaviour
derivethat rustc consumes during expansionAnd,Or, andNotstruct rulesMustNotExistfunction rules matched, including module, async, unsafe, name-pattern, and return-type evidenceDiscovery and self-linting
cargo pup print-traitspup.ronto use current crate and trait pathsCleanup and test infrastructure
LintConfigurationFactorythroughcargo_pup_lint_impl's public API and use that API frompup_driverscripts/test.shused both locally and in CItest_appcache handling, expected-output validation, temporary-directory usage, and print-traits validationtest_app, and remove unused proc-macro fixture dependenciesValidation
scripts/test.shtest_apptests through Nextesttest_appexpected-output validationtest_appprint-traits validationcargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo outdated --workspace --root-deps-onlycargo outdated --workspace --root-deps-onlyintest_app