Skip to content

Commit 5871b6c

Browse files
unhappychoiceclaude
andcommitted
refactor: eliminate long namespace usage outside use statements
Replace direct long namespace references (crate::some::long::path::Type) with proper imports and short type names for better code readability: - Add missing imports to files throughout the codebase - Replace long namespace paths with short type names - Maintain consistent import style across the project - Fix related module declarations and exports Examples of changes: - `crate::domain::error::GitTypeError::` → `GitTypeError::` (with proper import) - `crate::presentation::game::models::ScreenType::` → `ScreenType::` - `crate::domain::services::scoring::Rank::` → `Rank::` All functionality preserved, no implementation changes. All 589 tests passing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9db229c commit 5871b6c

File tree

118 files changed

+368
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+368
-432
lines changed

src/domain/models/challenge.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use super::git_repository::GitRepository;
22
use crate::presentation::game::DifficultyLevel;
3+
use std::path::Path;
34

45
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
56
pub struct Challenge {
@@ -91,8 +92,6 @@ impl Challenge {
9192
}
9293

9394
fn get_relative_path(&self, path: &str) -> String {
94-
use std::path::Path;
95-
9695
// Try to extract just the filename if it's a full path
9796
if let Some(file_name) = Path::new(path).file_name() {
9897
if let Some(parent) = Path::new(path).parent() {

src/domain/models/extraction_options.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use crate::domain::services::extractor::LanguageRegistry;
2+
13
#[derive(Debug, Clone)]
24
pub struct ExtractionOptions {
35
pub include_patterns: Vec<String>,
@@ -10,7 +12,7 @@ pub struct ExtractionOptions {
1012
impl Default for ExtractionOptions {
1113
fn default() -> Self {
1214
Self {
13-
include_patterns: crate::domain::services::extractor::LanguageRegistry::all_file_patterns(),
15+
include_patterns: LanguageRegistry::all_file_patterns(),
1416
exclude_patterns: vec![
1517
// === Common build directories ===
1618
"**/build/**".to_string(),
@@ -101,7 +103,7 @@ impl Default for ExtractionOptions {
101103
impl ExtractionOptions {
102104
pub fn apply_language_filter(&mut self) {
103105
if let Some(ref languages) = self.languages {
104-
let registry = crate::domain::services::extractor::LanguageRegistry::all_languages();
106+
let registry = LanguageRegistry::all_languages();
105107
self.include_patterns = registry
106108
.into_iter()
107109
.filter(|lang| {

src/domain/models/languages/c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::domain::models::Language;
2+
use crate::presentation::ui::Colors;
23
use std::hash::Hash;
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -13,7 +14,6 @@ impl Language for C {
1314
}
1415

1516
fn color(&self) -> ratatui::style::Color {
16-
use crate::presentation::ui::Colors;
1717
Colors::lang_c()
1818
}
1919

src/domain/models/languages/cpp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::domain::models::Language;
2+
use crate::presentation::ui::Colors;
23
use std::hash::Hash;
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -16,7 +17,6 @@ impl Language for Cpp {
1617
}
1718

1819
fn color(&self) -> ratatui::style::Color {
19-
use crate::presentation::ui::Colors;
2020
Colors::lang_cpp()
2121
}
2222

src/domain/models/languages/csharp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::domain::models::Language;
2+
use crate::presentation::ui::Colors;
23
use std::hash::Hash;
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -16,7 +17,6 @@ impl Language for CSharp {
1617
}
1718

1819
fn color(&self) -> ratatui::style::Color {
19-
use crate::presentation::ui::Colors;
2020
Colors::lang_csharp()
2121
}
2222

src/domain/models/languages/dart.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::domain::models::Language;
2+
use crate::presentation::ui::Colors;
23
use std::hash::Hash;
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -13,7 +14,6 @@ impl Language for Dart {
1314
}
1415

1516
fn color(&self) -> ratatui::style::Color {
16-
use crate::presentation::ui::Colors;
1717
Colors::lang_dart()
1818
}
1919

src/domain/models/languages/go.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::domain::models::Language;
2+
use crate::presentation::ui::Colors;
23
use std::hash::Hash;
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -13,7 +14,6 @@ impl Language for Go {
1314
}
1415

1516
fn color(&self) -> ratatui::style::Color {
16-
use crate::presentation::ui::Colors;
1717
Colors::lang_go()
1818
}
1919

src/domain/models/languages/haskell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::domain::models::Language;
2+
use crate::presentation::ui::Colors;
23
use std::hash::Hash;
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -16,7 +17,6 @@ impl Language for Haskell {
1617
}
1718

1819
fn color(&self) -> ratatui::style::Color {
19-
use crate::presentation::ui::Colors;
2020
Colors::lang_haskell()
2121
}
2222

src/domain/models/languages/java.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::domain::models::Language;
2+
use crate::presentation::ui::Colors;
23
use std::hash::Hash;
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -13,7 +14,6 @@ impl Language for Java {
1314
}
1415

1516
fn color(&self) -> ratatui::style::Color {
16-
use crate::presentation::ui::Colors;
1717
Colors::lang_java()
1818
}
1919

src/domain/models/languages/javascript.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::domain::models::Language;
2+
use crate::presentation::ui::Colors;
23
use std::hash::Hash;
34

45
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -16,7 +17,6 @@ impl Language for JavaScript {
1617
}
1718

1819
fn color(&self) -> ratatui::style::Color {
19-
use crate::presentation::ui::Colors;
2020
Colors::lang_javascript()
2121
}
2222

0 commit comments

Comments
 (0)