Skip to content

#15 feat: add PERF017 rule detecting correlated subqueries - #110

Merged
RAprogramm merged 1 commit into
mainfrom
15
Jul 14, 2026
Merged

#15 feat: add PERF017 rule detecting correlated subqueries#110
RAprogramm merged 1 commit into
mainfrom
15

Conversation

@RAprogramm

Copy link
Copy Markdown
Owner

Closes #15

New performance rule PERF017 (Warning): flags subqueries that qualify columns with a source not declared inside the subquery body — i.e. references to the outer query, which force per-row re-execution. Uncorrelated IN/scalar subqueries are not flagged; string literals are masked so dots in values (a@b.com) never look like qualified references.

  • README, Cargo.toml description, docs updated to 35 rules; version bumped to 0.16.0
  • 4 new tests: EXISTS and scalar-projection correlation, uncorrelated negative, literal-dot negative

Local checks: fmt, clippy -D warnings, tests, cargo qual (0 issues), mdbook build — all green.

@github-actions

Copy link
Copy Markdown
Contributor

Rust Diff Analysis

Tip

PR size is within limits. Good job keeping changes focused!

Limits — configured thresholds for this repository

Each metric is compared against its configured maximum. If any limit is exceeded, the PR check fails.

Metric Value Limit Status
Production Units 9 30
Weighted Score 14 100
Lines Added 143 200

Understanding the metrics:

  • Production Units: Functions, structs, enums, traits, and other semantic code units in production code
  • Weighted Score: Complexity score based on unit types (public APIs weigh more than private)
  • Lines Added: Raw count of new lines in production code
Summary — breakdown of changes by category

Production code counts toward limits. Test code is tracked but doesn't affect limits.

Metric Production Test
Functions 7 -
Structs/Enums 1 -
Other 1 -
Lines added +143 +27
Lines removed -0 -0
Total units 9 4
Production Changes — 9 units modified

Semantic units (functions, structs, etc.) that were added or modified in production code.

File Unit Type Changes
src/rules.rs:182-244 RuleRunner::with_config function +1 -0
src/rules/performance.rs:805-810 CorrelatedSubquery struct +6 -0
src/rules/performance.rs:812-839 subquery_bodies function +28 -0
src/rules/performance.rs:841-868 body_sources function +28 -0
src/rules/performance.rs:870-884 mask_string_literals function +15 -0
src/rules/performance.rs:886-915 references_outer_source function +30 -0
src/rules/performance.rs:917-951 Rule for CorrelatedSubquery impl +3 -0
src/rules/performance.rs:918-925 Rule for CorrelatedSubquery::info function +8 -0
src/rules/performance.rs:927-950 Rule for CorrelatedSubquery::check function +24 -0
Test Changes — 4 units modified

Test code changes don't count toward PR size limits.

File Unit Type Changes
tests/rules_tests.rs:184-190 test_correlated_exists_flagged function +7 -0
tests/rules_tests.rs:192-198 test_correlated_scalar_projection_flagged function +7 -0
tests/rules_tests.rs:200-205 test_uncorrelated_in_subquery_ok function +6 -0
tests/rules_tests.rs:207-213 test_literal_dot_not_correlated function +7 -0
Analysis Scope

Analyzed: 3 Rust files

Skipped files:

  • 6 non-Rust files

Skipped file list:

  • Cargo.lock (non-Rust)
  • Cargo.toml (non-Rust)
  • README.md (non-Rust)
  • docs/src/introduction.md (non-Rust)
  • docs/src/rules/index.md (non-Rust)
  • docs/src/rules/performance.md (non-Rust)

Rust Diff Analyzer

@github-actions

Copy link
Copy Markdown
Contributor

Cargo Quality Analysis

Tip

All quality checks passed. Code meets all standards!

Results — issues found by each analyzer

Each analyzer checks for specific code patterns. Zero issues means the check passed.

Analyzer Issues Status
path_import 0
format_args 0
empty_lines 0
inline_comments 0
mod_rs 0
Total 0
Analyzers — what each check does

These analyzers enforce consistent code style and best practices.

Analyzer Description How to fix
path_import Detects inline path imports like std::path::Path Use use statements at the top
format_args Detects format!("{}", x) patterns Use format!("{x}") syntax
empty_lines Detects empty lines inside function bodies Remove extra blank lines
inline_comments Detects // comment inside functions Move to doc comments or remove
mod_rs Detects mod.rs files (use modern module style) Rename foo/mod.rs to foo.rs
Raw Output — detailed analysis log
Total issues: 0
Fixable: 0

Cargo Quality

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@RAprogramm
RAprogramm merged commit b0e47bc into main Jul 14, 2026
29 checks passed
@RAprogramm
RAprogramm deleted the 15 branch July 14, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PERF017: Detect correlated subqueries

1 participant