Skip to content

Commit 129bfd2

Browse files
authored
Merge pull request #54 from Atypical-Consulting/fix/specta-version-alignment
fix(ci): resolve all CI failures (frontend tests, specta deps, clippy)
2 parents bd7235f + 3c26e06 commit 129bfd2

23 files changed

Lines changed: 109 additions & 152 deletions

src-tauri/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ tauri-plugin-dialog = "2"
1717
tauri-plugin-store = "2"
1818
tauri-plugin-window-state = "2"
1919
tauri-specta = { version = "2.0.0-rc.21", features = ["derive", "typescript"] }
20-
specta = "=2.0.0-rc.23"
21-
specta-typescript = "0.0.10"
20+
specta = "=2.0.0-rc.22"
21+
specta-typescript = "0.0.9"
2222
serde = { version = "1", features = ["derive"] }
2323
serde_json = "1"
2424
tokio = { version = "1", features = ["full"] }

src-tauri/src/git/branch.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,8 @@ pub async fn batch_delete_branches(
555555
return Err("Cannot delete the current branch".to_string());
556556
}
557557

558-
if !force {
559-
if let Some(ref head) = head_commit {
558+
if !force
559+
&& let Some(ref head) = head_commit {
560560
let branch_commit = branch
561561
.get()
562562
.peel_to_commit()
@@ -568,7 +568,6 @@ pub async fn batch_delete_branches(
568568
return Err(format!("Branch '{}' is not fully merged", name));
569569
}
570570
}
571-
}
572571

573572
branch.delete().map_err(|e| e.message().to_string())?;
574573
Ok(())

src-tauri/src/git/browse.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ pub async fn list_repo_files(
4949
let mut files = Vec::new();
5050

5151
// 1. Collect entries from HEAD tree (if it exists)
52-
if let Ok(head) = repo.head() {
53-
if let Ok(root_tree) = head.peel_to_tree() {
52+
if let Ok(head) = repo.head()
53+
&& let Ok(root_tree) = head.peel_to_tree() {
5454
let target_tree_opt = if path.is_empty() {
5555
Some(root_tree)
5656
} else {
@@ -101,7 +101,6 @@ pub async fn list_repo_files(
101101
}
102102
}
103103
}
104-
}
105104

106105
// 2. Merge in working-directory entries not already in the tree
107106
if let Some(workdir) = repo.workdir() {
@@ -111,8 +110,8 @@ pub async fn list_repo_files(
111110
workdir.join(&path)
112111
};
113112

114-
if dir_to_scan.is_dir() {
115-
if let Ok(read_dir) = std::fs::read_dir(&dir_to_scan) {
113+
if dir_to_scan.is_dir()
114+
&& let Ok(read_dir) = std::fs::read_dir(&dir_to_scan) {
116115
for dir_entry in read_dir.flatten() {
117116
let name = dir_entry.file_name().to_string_lossy().into_owned();
118117
// Skip hidden files/dirs (like .git) and already-known entries
@@ -124,7 +123,7 @@ pub async fn list_repo_files(
124123
} else {
125124
format!("{}/{}", path, name)
126125
};
127-
let is_dir = dir_entry.file_type().map_or(false, |t| t.is_dir());
126+
let is_dir = dir_entry.file_type().is_ok_and(|t| t.is_dir());
128127
let size = if is_dir {
129128
0
130129
} else {
@@ -138,7 +137,6 @@ pub async fn list_repo_files(
138137
}
139138
}
140139
}
141-
}
142140
}
143141

144142
// Sort: dirs first alphabetically, then files alphabetically

src-tauri/src/git/changelog.rs

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ pub struct ChangelogCommit {
8989
/// Errors that can occur during changelog generation.
9090
#[derive(Debug, Error, Clone, Serialize, Deserialize, Type)]
9191
#[serde(tag = "type", content = "message")]
92+
#[allow(clippy::enum_variant_names)]
9293
pub enum ChangelogError {
9394
#[error("Git error: {0}")]
9495
GitError(String),
@@ -195,36 +196,32 @@ struct ParsedCommitInfo {
195196
/// Resolve a reference (tag, branch, or commit) to an Oid.
196197
fn resolve_ref(repo: &Repository, reference: &str) -> Result<Oid, ChangelogError> {
197198
// Try as tag first
198-
if let Ok(tag_ref) = repo.find_reference(&format!("refs/tags/{}", reference)) {
199-
if let Some(target) = tag_ref.target() {
199+
if let Ok(tag_ref) = repo.find_reference(&format!("refs/tags/{}", reference))
200+
&& let Some(target) = tag_ref.target() {
200201
// Could be annotated tag, need to peel
201-
if let Ok(obj) = repo.find_object(target, None) {
202-
if let Ok(commit) = obj.peel_to_commit() {
202+
if let Ok(obj) = repo.find_object(target, None)
203+
&& let Ok(commit) = obj.peel_to_commit() {
203204
return Ok(commit.id());
204205
}
205-
}
206206
return Ok(target);
207207
}
208-
}
209208

210209
// Try as branch
211-
if let Ok(branch_ref) = repo.find_reference(&format!("refs/heads/{}", reference)) {
212-
if let Some(target) = branch_ref.target() {
210+
if let Ok(branch_ref) = repo.find_reference(&format!("refs/heads/{}", reference))
211+
&& let Some(target) = branch_ref.target() {
213212
return Ok(target);
214213
}
215-
}
216214

217215
// Try as direct commit OID
218216
if let Ok(oid) = Oid::from_str(reference) {
219217
return Ok(oid);
220218
}
221219

222220
// Try revparse
223-
if let Ok(obj) = repo.revparse_single(reference) {
224-
if let Ok(commit) = obj.peel_to_commit() {
221+
if let Ok(obj) = repo.revparse_single(reference)
222+
&& let Ok(commit) = obj.peel_to_commit() {
225223
return Ok(commit.id());
226224
}
227-
}
228225

229226
Err(ChangelogError::GitError(format!(
230227
"Could not resolve reference: {}",
@@ -261,11 +258,10 @@ fn get_commits_in_range(
261258
let oid = oid_result?;
262259

263260
// Stop if we've reached the 'from' commit
264-
if let Some(from_id) = from_oid {
265-
if oid == from_id {
261+
if let Some(from_id) = from_oid
262+
&& oid == from_id {
266263
break;
267264
}
268-
}
269265

270266
// Safety limit
271267
count += 1;
@@ -323,18 +319,15 @@ pub fn find_previous_tag(repo: &Repository, current: &str) -> Option<String> {
323319

324320
for name in tag_names.iter().flatten() {
325321
let ref_name = format!("refs/tags/{}", name);
326-
if let Ok(reference) = repo.find_reference(&ref_name) {
327-
if let Some(target) = reference.target() {
328-
if let Ok(obj) = repo.find_object(target, None) {
329-
if let Ok(commit) = obj.peel_to_commit() {
322+
if let Ok(reference) = repo.find_reference(&ref_name)
323+
&& let Some(target) = reference.target()
324+
&& let Ok(obj) = repo.find_object(target, None)
325+
&& let Ok(commit) = obj.peel_to_commit() {
330326
let time = commit.time().seconds();
331327
if time < current_time {
332328
tags_with_time.push((name.to_string(), time));
333329
}
334330
}
335-
}
336-
}
337-
}
338331
}
339332

340333
// Sort by time descending and get the most recent one before current

src-tauri/src/git/clone.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ fn extract_repo_name(url: &str) -> Option<String> {
4949
// Handle SSH format: git@host:user/repo.git
5050
let path_part = if url.contains('@') && url.contains(':') && !url.contains("://") {
5151
// SSH format
52-
url.split(':').last()?
52+
url.split(':').next_back()?
5353
} else {
5454
// HTTPS or other URL formats
55-
url.split('/').last()?
55+
url.split('/').next_back()?
5656
};
5757

5858
// Get the repo name (last segment) and strip .git suffix
5959
let repo_name = path_part
6060
.split('/')
61-
.last()
61+
.next_back()
6262
.unwrap_or(path_part)
6363
.trim_end_matches(".git");
6464

@@ -119,13 +119,12 @@ pub async fn clone_repository(
119119
}
120120
} else {
121121
// Create parent directories if they don't exist
122-
if let Some(parent) = dest_path.parent() {
123-
if !parent.exists() {
122+
if let Some(parent) = dest_path.parent()
123+
&& !parent.exists() {
124124
std::fs::create_dir_all(parent).map_err(|e| {
125125
GitError::OperationFailed(format!("Failed to create parent directories: {}", e))
126126
})?;
127127
}
128-
}
129128
}
130129

131130
// Send started event

src-tauri/src/git/commit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub async fn create_commit(
170170
}
171171
Err(e) if e.code() == git2::ErrorCode::UnbornBranch => {
172172
// First commit - check if tree has any entries
173-
tree.len() > 0
173+
!tree.is_empty()
174174
}
175175
Err(e) => return Err(e.into()),
176176
}

src-tauri/src/git/conflict.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,18 @@ pub async fn list_conflict_files(
4242
let index = repo.index()?;
4343

4444
let mut paths = Vec::new();
45-
for conflict in index.conflicts()? {
46-
if let Ok(conflict) = conflict {
47-
// Prefer our path, then their, then ancestor
48-
let path = conflict
49-
.our
50-
.as_ref()
51-
.or(conflict.their.as_ref())
52-
.or(conflict.ancestor.as_ref())
53-
.and_then(|entry| std::str::from_utf8(&entry.path).ok())
54-
.map(|s| s.to_string());
55-
56-
if let Some(p) = path {
57-
paths.push(p);
58-
}
45+
for conflict in index.conflicts()?.flatten() {
46+
// Prefer our path, then their, then ancestor
47+
let path = conflict
48+
.our
49+
.as_ref()
50+
.or(conflict.their.as_ref())
51+
.or(conflict.ancestor.as_ref())
52+
.and_then(|entry| std::str::from_utf8(&entry.path).ok())
53+
.map(|s| s.to_string());
54+
55+
if let Some(p) = path {
56+
paths.push(p);
5957
}
6058
}
6159

src-tauri/src/git/conventional.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,12 +560,11 @@ pub fn extract_scopes_from_history(
560560

561561
for commit in commits {
562562
// Try to parse each commit message
563-
if let Ok(parsed) = git_conventional::Commit::parse(&commit.message_subject) {
564-
if let Some(scope) = parsed.scope() {
563+
if let Ok(parsed) = git_conventional::Commit::parse(&commit.message_subject)
564+
&& let Some(scope) = parsed.scope() {
565565
let scope_str = scope.to_string();
566566
*scope_counts.entry(scope_str).or_insert(0) += 1;
567567
}
568-
}
569568
}
570569

571570
// Filter out scopes with count < 2 (likely typos)

src-tauri/src/git/credentials.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ pub fn create_credentials_callback(
3232
// Try credential helper from git config
3333
if allowed_types.contains(git2::CredentialType::USER_PASS_PLAINTEXT) && !tried_cred_helper {
3434
tried_cred_helper = true;
35-
if let Ok(cfg) = git2::Config::open_default() {
36-
if let Ok(cred) = git2::Cred::credential_helper(&cfg, url, username) {
35+
if let Ok(cfg) = git2::Config::open_default()
36+
&& let Ok(cred) = git2::Cred::credential_helper(&cfg, url, username) {
3737
return Ok(cred);
3838
}
39-
}
4039
}
4140

4241
// Fallback: shell out to `git credential fill`

src-tauri/src/git/graph.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,12 @@ async fn get_commit_graph_impl(
135135

136136
for branch_result in repo.branches(Some(git2::BranchType::Local))? {
137137
let (branch, _) = branch_result?;
138-
if let Some(name) = branch.name()? {
139-
if let Ok(reference) = branch.get().resolve() {
140-
if let Some(oid) = reference.target() {
138+
if let Some(name) = branch.name()?
139+
&& let Ok(reference) = branch.get().resolve()
140+
&& let Some(oid) = reference.target() {
141141
branch_map.entry(oid).or_default().push(name.to_string());
142142
branch_tips.push((oid, name.to_string()));
143143
}
144-
}
145-
}
146144
}
147145

148146
// ── 2. Identify HEAD and first-parent ancestors ──
@@ -188,8 +186,8 @@ async fn get_commit_graph_impl(
188186
break;
189187
}
190188

191-
if let Ok(oid) = oid_result {
192-
if let Ok(commit) = repo.find_commit(oid) {
189+
if let Ok(oid) = oid_result
190+
&& let Ok(commit) = repo.find_commit(oid) {
193191
let author = commit.author();
194192
let parent_oids: Vec<String> =
195193
commit.parent_ids().map(|id| id.to_string()).collect();
@@ -219,7 +217,6 @@ async fn get_commit_graph_impl(
219217
ideological_branch: String::new(), // Will be set below
220218
});
221219
}
222-
}
223220
}
224221

225222
// ── 4. Ideological branch assignment (Ungit-style) ──

0 commit comments

Comments
 (0)