Skip to content

Conversation

@psteinroe
Copy link
Collaborator

@psteinroe psteinroe commented Dec 15, 2025

fixes minor clippy issues from previous prs

@psteinroe psteinroe force-pushed the chore/integrate-splinter-docs-codegen branch from 2b05d65 to 8cff804 Compare December 15, 2025 10:16
@psteinroe psteinroe force-pushed the chore/integrate-splinter-docs-codegen branch from 8cff804 to ee9755d Compare December 15, 2025 10:53
Changed pgls_analyse::AnalyserRules to pgls_analyser::LinterRules
and fixed import statements to use the correct crate for RuleOptions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@psteinroe psteinroe force-pushed the chore/integrate-splinter-docs-codegen branch from ee9755d to 6997db0 Compare December 15, 2025 11:08
psteinroe and others added 5 commits December 15, 2025 12:32
Updated test files to use the new type names after the refactor:
- Changed AnalyserOptions to LinterOptions
- Changed RuleDiagnostic to LinterDiagnostic
- Fixed import paths to import from pgls_analyser instead of pgls_analyse

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed import ordering and line length formatting issues.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Picked up test import fixes from base branch and applied codegen updates.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@psteinroe psteinroe force-pushed the chore/integrate-splinter-docs-codegen branch from 6997db0 to 2162888 Compare December 15, 2025 12:38
psteinroe and others added 14 commits December 15, 2025 13:53
Changed SQL file path generation to use relative paths from crate root
instead of absolute paths, fixing CI codegen check failures.

Also removed unused splinter/unknown category from TypeScript types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Removed unused `use pgls_analyse::RuleMeta;` import from generated
splinter rule files and applied clippy format! macro fix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed stale module reference after rebase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove unnecessary SELECT * FROM wrapping that was causing syntax errors
with CTEs. SQL files are already complete parenthesized queries.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Some SQL files are already wrapped in parentheses while others are not.
Ensure consistent wrapping to create valid UNION ALL syntax.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
SQL files use "name!" notation for column names (literal identifiers),
so FromRow must look for these exact names. Also fix clippy warnings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Individual SQL queries' ORDER BY clauses are not preserved when combined
with UNION ALL. Wrap the entire result in SELECT and ORDER BY cache_key!
to ensure consistent, deterministic ordering for tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
psteinroe and others added 3 commits December 15, 2025 16:44
- Remove backslash escaping from backticks in message text
- Update diagnostic ordering to match cache_key sort order

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Apply automatic clippy fixes for format! macro usage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@psteinroe psteinroe force-pushed the chore/integrate-splinter-docs-codegen branch from 2162888 to e86fa47 Compare December 15, 2025 16:24
psteinroe and others added 2 commits December 15, 2025 17:36
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Instead of re-parsing SQL comment metadata in docs codegen, expose
structured metadata directly through the registry API.

Changes:
- Add SplinterRuleMetadata struct (description, remediation, requires_supabase)
- Add get_rule_metadata() function to registry
- Update docs codegen to use structured metadata
- Remove duplicate SQL parsing logic
- Update runtime to use new metadata API
- Deprecate rule_requires_supabase() in favor of get_rule_metadata()

This eliminates redundant parsing and provides a cleaner API.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@psteinroe psteinroe force-pushed the fix/clippy branch 2 times, most recently from 566f62d to f78e00e Compare December 16, 2025 07:16
Changed the architecture to make metadata accessible as trait constants instead of requiring registry lookups or SQL parsing:

- Updated `SplinterRule` trait to include four associated constants:
  - `SQL_FILE_PATH`: Path to SQL file (changed from function to const)
  - `DESCRIPTION`: What the rule detects
  - `REMEDIATION`: URL to documentation
  - `REQUIRES_SUPABASE`: Whether rule needs Supabase roles

- Updated codegen to generate these constants in each rule's impl block

- Updated registry to provide metadata via qualified trait syntax:
  - `get_rule_metadata_fields()`: Returns tuple by calling trait constants
  - `get_rule_metadata()`: Returns struct by delegating to above

- Updated docs codegen to use `get_rule_metadata_fields()` from registry

Benefits:
- Type-safe: Metadata defined with the rule type
- No runtime string parsing
- Single source of truth (SQL metadata comments)
- Clean API: Registry provides runtime lookups via trait constants

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The combined SQL files (splinter.sql, splinter_generic.sql, splinter_supabase.sql)
are no longer used by the runtime. The new system reads individual SQL files
from vendor/performance/ and vendor/security/ directories.

Changes:
- Remove obsolete combined SQL files
- Remove build.rs that generated the combined files
- Remove ureq build dependency

The individual rule SQL files in vendor/ subdirectories are maintained manually
and embedded at compile time via include_str! in the registry.
@psteinroe psteinroe marked this pull request as ready for review December 16, 2025 08:20
Removed confusing type aliases that created two names for the same types:
- Rule → LinterRule
- RuleContext → LinterRuleContext
- RuleDiagnostic → LinterDiagnostic

Updated all 34 rule files and the codegen template to use the full type names
for better clarity and consistency. The aliases made the API confusing by having
two names for the same type (e.g., "is RuleDiagnostic different from
LinterDiagnostic?").

All rule implementations now consistently use:
- use crate::{LinterRule, LinterRuleContext, LinterDiagnostic};
- impl LinterRule for RuleName { ... }
@psteinroe psteinroe force-pushed the chore/integrate-splinter-docs-codegen branch from 022ad92 to 08d9b38 Compare December 16, 2025 17:02
- Remove unused get_fully_qualified_name method
- Combine duplicate if blocks with identical code using || operator

Fixes clippy warnings:
- dead_code: method get_fully_qualified_name is never used
- if_same_then_else: identical blocks in if/else chain
Base automatically changed from chore/integrate-splinter-docs-codegen to chore/integrate-splinter-runtime December 16, 2025 17:14
Base automatically changed from chore/integrate-splinter-runtime to main December 16, 2025 17:37
@psteinroe psteinroe enabled auto-merge (squash) December 16, 2025 17:41
@psteinroe psteinroe merged commit b40b276 into main Dec 16, 2025
8 checks passed
@psteinroe psteinroe deleted the fix/clippy branch December 16, 2025 17:51
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.

3 participants