Skip to content

#13 feat: add PERF015 rule detecting implicit type conversion - #108

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

#13 feat: add PERF015 rule detecting implicit type conversion#108
RAprogramm merged 1 commit into
mainfrom
13

Conversation

@RAprogramm

Copy link
Copy Markdown
Owner

Closes #13

New schema-aware performance rule PERF015 (Warning): flags WHERE comparisons of a text column (CHAR/VARCHAR/TEXT) with a bare numeric literal — the engine casts the column side on every row, disabling its index.

  • Registered with the schema-aware rule set (requires --schema)
  • README, Cargo.toml description, docs updated to 33 rules; version bumped to 0.14.0
  • 3 new tests: flagged bare number, quoted literal negative, numeric column negative

Local checks: fmt, clippy -D warnings, 475 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 17 100
Lines Added 105 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 6 -
Structs/Enums 1 -
Other 2 -
Lines added +105 +24
Lines removed -1 -0
Total units 9 3
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:244-277 RuleRunner::with_schema_and_config function +2 -1
src/rules/schema_aware.rs:226-233 ImplicitTypeConversion struct +11 -0
src/rules/schema_aware.rs:235-254 ImplicitTypeConversion impl +11 -0
src/rules/schema_aware.rs:236-240 ImplicitTypeConversion::new function +5 -0
src/rules/schema_aware.rs:242-253 ImplicitTypeConversion::text_columns function +12 -0
src/rules/schema_aware.rs:256-275 compares_column_to_number function +20 -0
src/rules/schema_aware.rs:277-320 Rule for ImplicitTypeConversion impl +3 -0
src/rules/schema_aware.rs:278-285 Rule for ImplicitTypeConversion::info function +8 -0
src/rules/schema_aware.rs:287-319 Rule for ImplicitTypeConversion::check function +33 -0
Test Changes — 3 units modified

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

File Unit Type Changes
tests/rules_tests.rs:500-508 test_implicit_conversion_flagged function +9 -0
tests/rules_tests.rs:510-518 test_quoted_literal_no_conversion function +9 -0
tests/rules_tests.rs:520-525 test_numeric_column_comparison_ok function +6 -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

❌ Patch coverage is 96.05263% with 3 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/rules/schema_aware.rs 95.94% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@RAprogramm
RAprogramm merged commit dd1ee39 into main Jul 14, 2026
29 checks passed
@RAprogramm
RAprogramm deleted the 13 branch July 14, 2026 02:31
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.

PERF015: Detect implicit type conversion in WHERE clause

1 participant