Skip to content

Commit 6babd1a

Browse files
committed
fix: resolve clippy warnings and improve code quality
- Remove empty line after outer attribute in pgls_diagnostics - Replace useless format! with .to_string() in pgls_splinter - Refactor loops to use .enumerate() and slice indexing in xtask_codegen - Add clippy and git commit guidelines to AGENTS.md
1 parent 154e3bb commit 6babd1a

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ cargo insta review
144144

145145
## Development Notes
146146

147+
### Code Quality Guidelines
148+
**IMPORTANT**: Always run `cargo clippy --all-targets --all-features` and fix all warnings after making code changes. Clippy warnings must be resolved before committing code to maintain code quality standards.
149+
150+
### Git Commit and PR Guidelines
151+
**IMPORTANT**: NEVER add "Claude" or any AI assistant name to commit messages or pull request descriptions. Commits and PRs should appear as authored by the human developer only.
152+
147153
### Code Generation
148154
Many parser structures are generated from PostgreSQL's protobuf definitions using procedural macros in `pgls_query_macros`. Run `just gen-lint` after modifying analyzer rules or configurations.
149155

crates/pgls_diagnostics/src/serde.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ impl From<super::Location<'_>> for Location {
164164
#[serde(rename_all = "camelCase")]
165165
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
166166
#[cfg_attr(test, derive(Eq, PartialEq))]
167-
168167
struct Advices {
169168
advices: Vec<Advice>,
170169
}

crates/pgls_splinter/src/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn build_remediation_url(name: &str) -> String {
6060
"table_bloat" => "0020_table_bloat",
6161
"fkey_to_auth_unique" => "0021_fkey_to_auth_unique",
6262
"extension_versions_outdated" => "0022_extension_versions_outdated",
63-
_ => return format!("https://supabase.com/docs/guides/database/database-linter"),
63+
_ => return "https://supabase.com/docs/guides/database/database-linter".to_string(),
6464
};
6565

6666
format!("https://supabase.com/docs/guides/database/database-linter?lint={lint_id}")

xtask/codegen/src/generate_splinter.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,18 @@ fn extract_rules_from_sql(content: &str) -> Result<BTreeMap<String, RuleInfo>> {
3737
let mut rules = BTreeMap::new();
3838

3939
let lines: Vec<&str> = content.lines().collect();
40-
let mut i = 0;
4140

42-
while i < lines.len() {
43-
let line = lines[i].trim();
41+
for (i, line) in lines.iter().enumerate() {
42+
let line = line.trim();
4443

4544
// Look for pattern: 'rule_name' as "name!",
4645
if line.contains(" as \"name!\"") {
4746
if let Some(name) = extract_string_literal(line) {
4847
// Look ahead for categories
4948
let mut categories = None;
5049

51-
for j in i..std::cmp::min(i + 30, lines.len()) {
52-
let next_line = lines[j].trim();
50+
for next_line in lines[i..].iter().take(30) {
51+
let next_line = next_line.trim();
5352

5453
// Extract categories from pattern: array['CATEGORY'] as "categories!",
5554
if next_line.contains(" as \"categories!\"") {
@@ -71,8 +70,6 @@ fn extract_rules_from_sql(content: &str) -> Result<BTreeMap<String, RuleInfo>> {
7170
);
7271
}
7372
}
74-
75-
i += 1;
7673
}
7774

7875
// Add the "unknown" fallback rule

0 commit comments

Comments
 (0)