-
Notifications
You must be signed in to change notification settings - Fork 1
Fix Clippy warnings and run Clippy in CI #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
9132fd0
a85b255
ff6937d
96fa8c6
c56dba0
6c61292
cae14ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -68,11 +68,10 @@ pub fn is_task_allowed(task: &Task) -> Result<(bool, bool), String> { | |||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // First pass: Check for deny entries (highest precedence) | ||||||||||||||||||||||||||||||||||||||||||||
| for entry in &allowlist.entries { | ||||||||||||||||||||||||||||||||||||||||||||
| if let AllowScope::Deny = entry.scope { | ||||||||||||||||||||||||||||||||||||||||||||
| if path_matches(&task.file_path, &entry.path, true) { | ||||||||||||||||||||||||||||||||||||||||||||
| if let AllowScope::Deny = entry.scope | ||||||||||||||||||||||||||||||||||||||||||||
| && path_matches(&task.file_path, &entry.path, true) { | ||||||||||||||||||||||||||||||||||||||||||||
| return Ok((false, true)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Second pass: Check for allow entries | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -89,13 +88,11 @@ pub fn is_task_allowed(task: &Task) -> Result<(bool, bool), String> { | |||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| AllowScope::Task => { | ||||||||||||||||||||||||||||||||||||||||||||
| if path_matches(&task.file_path, &entry.path, false) { | ||||||||||||||||||||||||||||||||||||||||||||
| if let Some(ref tasks) = entry.tasks { | ||||||||||||||||||||||||||||||||||||||||||||
| if tasks.contains(&task.name) { | ||||||||||||||||||||||||||||||||||||||||||||
| if path_matches(&task.file_path, &entry.path, false) | ||||||||||||||||||||||||||||||||||||||||||||
| && let Some(ref tasks) = entry.tasks | ||||||||||||||||||||||||||||||||||||||||||||
| && tasks.contains(&task.name) { | ||||||||||||||||||||||||||||||||||||||||||||
| return Ok((true, false)); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
91
to
98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Triple let-chain is hard to follow; flatten it. Beyond the fmt failure (pipeline error at line 90) and MSRV-1.88 requirement, the binding ♻️ Suggested simplification AllowScope::Task => {
- if path_matches(&task.file_path, &entry.path, false)
- && let Some(ref tasks) = entry.tasks
- && tasks.contains(&task.name) {
- return Ok((true, false));
- }
+ let task_listed = entry
+ .tasks
+ .as_ref()
+ .is_some_and(|tasks| tasks.contains(&task.name));
+ if task_listed && path_matches(&task.file_path, &entry.path, false) {
+ return Ok((true, false));
+ }
}📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Actions: Rust CI[error] 90-90: cargo fmt --all -- --check failed. Formatting diff detected in allowlist.rs for AllowScope::Task branch (indentation/brace placement). Run 'cargo fmt --all' to apply rustfmt formatting. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| AllowScope::Deny | AllowScope::Once => { | ||||||||||||||||||||||||||||||||||||||||||||
| // Already handled deny in first pass, skip Once | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -131,45 +131,39 @@ fn extract_custom_tasks( | |||||||||
| fn extract_task_description(content: &str, task_name: &str) -> Option<String> { | ||||||||||
| // This is a simplified approach with basic regex | ||||||||||
| let task_pattern = format!(r"task\s+{}", regex::escape(task_name)); | ||||||||||
| let description_single_quote_pattern = format!(r"description\s+'([^']*)'"); | ||||||||||
| let description_double_quote_pattern = format!(r#"description\s+"([^"]*)""#); | ||||||||||
| let description_single_quote_pattern = r"description\s+'([^']*)'".to_string(); | ||||||||||
| let description_double_quote_pattern = r#"description\s+"([^"]*)""#.to_string(); | ||||||||||
|
Comment on lines
+134
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Drop the unnecessary These are ♻️ Proposed refactor- let description_single_quote_pattern = r"description\s+'([^']*)'".to_string();
- let description_double_quote_pattern = r#"description\s+"([^"]*)""#.to_string();
+ let description_single_quote_pattern = r"description\s+'([^']*)'";
+ let description_double_quote_pattern = r#"description\s+"([^"]*)""#;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| // Look for task with description using single quotes | ||||||||||
| if let Ok(regex) = Regex::new(&format!( | ||||||||||
| "{}.+?{}", | ||||||||||
| task_pattern, description_single_quote_pattern | ||||||||||
| )) { | ||||||||||
| if let Some(caps) = regex.captures(content) { | ||||||||||
| if let Some(desc) = caps.get(1) { | ||||||||||
| )) | ||||||||||
| && let Some(caps) = regex.captures(content) | ||||||||||
| && let Some(desc) = caps.get(1) { | ||||||||||
| return Some(desc.as_str().to_string()); | ||||||||||
| } | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // Look for task with description using double quotes | ||||||||||
| if let Ok(regex) = Regex::new(&format!( | ||||||||||
| "{}.+?{}", | ||||||||||
| task_pattern, description_double_quote_pattern | ||||||||||
| )) { | ||||||||||
| if let Some(caps) = regex.captures(content) { | ||||||||||
| if let Some(desc) = caps.get(1) { | ||||||||||
| )) | ||||||||||
| && let Some(caps) = regex.captures(content) | ||||||||||
| && let Some(desc) = caps.get(1) { | ||||||||||
| return Some(desc.as_str().to_string()); | ||||||||||
| } | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // For Kotlin DSL, look for description with equals | ||||||||||
| let kotlin_pattern = format!( | ||||||||||
| r#"tasks.*?"{}".+?description\s*=\s*"([^"]*)""#, | ||||||||||
| regex::escape(task_name) | ||||||||||
| ); | ||||||||||
| if let Ok(regex) = Regex::new(&kotlin_pattern) { | ||||||||||
| if let Some(caps) = regex.captures(content) { | ||||||||||
| if let Some(desc) = caps.get(1) { | ||||||||||
| if let Ok(regex) = Regex::new(&kotlin_pattern) | ||||||||||
| && let Some(caps) = regex.captures(content) | ||||||||||
| && let Some(desc) = caps.get(1) { | ||||||||||
| return Some(desc.as_str().to_string()); | ||||||||||
| } | ||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| Some("Custom Gradle task".to_string()) | ||||||||||
| } | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.