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:
parent
9eea0199bb
commit
792f3bb310
@ -91,10 +91,15 @@ impl EntityExtractor {
|
||||
// Pattern 2: Extract from path
|
||||
if text.contains('/') || text.contains('\\') {
|
||||
let parts: Vec<&str> = text.split(&['/', '\\'][..]).collect();
|
||||
// Find directory name before filename
|
||||
if parts.len() >= 2 {
|
||||
let potential_project = parts[parts.len() - 2];
|
||||
if !potential_project.is_empty() && potential_project.len() > 2 {
|
||||
// Common directory names to skip (not project names)
|
||||
let skip_dirs = ["src", "lib", "bin", "tests", "test", "examples", "target", "build", "dist", "node_modules"];
|
||||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
/// Window metadata extraction (Windows uniquement)
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::error::{AppError, Result};
|
||||
use crate::error::Result;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
use crate::error::AppError;
|
||||
|
||||
#[cfg(windows)]
|
||||
use windows::{
|
||||
core::PWSTR,
|
||||
Win32::Foundation::{HWND, MAX_PATH},
|
||||
Win32::Foundation::MAX_PATH,
|
||||
Win32::System::ProcessStatus::GetModuleBaseNameW,
|
||||
Win32::System::Threading::{OpenProcess, PROCESS_QUERY_INFORMATION, PROCESS_VM_READ},
|
||||
Win32::UI::WindowsAndMessaging::{GetForegroundWindow, GetWindowTextW, GetWindowThreadProcessId},
|
||||
|
||||
@ -284,7 +284,6 @@ impl Database {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use tempfile::NamedTempFile;
|
||||
use chrono::Duration;
|
||||
|
||||
#[test]
|
||||
fn test_database_creation() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user