Fix: resolve compilation warnings and test failures

- Fix project extraction to skip common directories (src, lib, etc.)
- Remove unused imports in window.rs (AppError, PWSTR, HWND)
- Remove unused import in database.rs tests (chrono::Duration)
- All tests now pass (25/25)
- Zero compilation warnings

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Augustin 2025-10-16 14:01:10 +02:00
parent 9eea0199bb
commit 792f3bb310
3 changed files with 14 additions and 8 deletions

View File

@ -91,10 +91,15 @@ impl EntityExtractor {
// Pattern 2: Extract from path // Pattern 2: Extract from path
if text.contains('/') || text.contains('\\') { if text.contains('/') || text.contains('\\') {
let parts: Vec<&str> = text.split(&['/', '\\'][..]).collect(); let parts: Vec<&str> = text.split(&['/', '\\'][..]).collect();
// Find directory name before filename // Common directory names to skip (not project names)
if parts.len() >= 2 { let skip_dirs = ["src", "lib", "bin", "tests", "test", "examples", "target", "build", "dist", "node_modules"];
let potential_project = parts[parts.len() - 2];
if !potential_project.is_empty() && potential_project.len() > 2 { // Find directory name before filename, skipping common directories
for i in (0..parts.len().saturating_sub(1)).rev() {
let potential_project = parts[i];
if !potential_project.is_empty()
&& potential_project.len() > 2
&& !skip_dirs.contains(&potential_project.to_lowercase().as_str()) {
return Some(potential_project.to_string()); return Some(potential_project.to_string());
} }
} }

View File

@ -1,11 +1,13 @@
/// Window metadata extraction (Windows uniquement) /// Window metadata extraction (Windows uniquement)
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::error::{AppError, Result}; use crate::error::Result;
#[cfg(not(windows))]
use crate::error::AppError;
#[cfg(windows)] #[cfg(windows)]
use windows::{ use windows::{
core::PWSTR, Win32::Foundation::MAX_PATH,
Win32::Foundation::{HWND, MAX_PATH},
Win32::System::ProcessStatus::GetModuleBaseNameW, Win32::System::ProcessStatus::GetModuleBaseNameW,
Win32::System::Threading::{OpenProcess, PROCESS_QUERY_INFORMATION, PROCESS_VM_READ}, Win32::System::Threading::{OpenProcess, PROCESS_QUERY_INFORMATION, PROCESS_VM_READ},
Win32::UI::WindowsAndMessaging::{GetForegroundWindow, GetWindowTextW, GetWindowThreadProcessId}, Win32::UI::WindowsAndMessaging::{GetForegroundWindow, GetWindowTextW, GetWindowThreadProcessId},

View File

@ -284,7 +284,6 @@ impl Database {
mod tests { mod tests {
use super::*; use super::*;
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
use chrono::Duration;
#[test] #[test]
fn test_database_creation() { fn test_database_creation() {