1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright 2024 zhlinh and linthis Project Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found at
//
// https://opensource.org/license/MIT
//
// The above copyright notice and this permission
// notice shall be included in all copies or
// substantial portions of the Software.
//! Language-specific linter implementations.
//!
//! This module provides checker implementations for each supported language.
//! Each checker wraps one or more external linting tools and normalizes their
//! output to the common [`LintIssue`](crate::utils::types::LintIssue) format.
//!
//! ## Supported Languages and Tools
//!
//! | Language | Checker | Primary Tool | Fallback |
//! |----------|---------|--------------|----------|
//! | Rust | [`RustChecker`] | clippy | rustc |
//! | Python | [`PythonChecker`] | ruff | - |
//! | TypeScript/JS | [`TypeScriptChecker`] | eslint | - |
//! | Go | [`GoChecker`] | golangci-lint | go vet |
//! | Java | [`JavaChecker`] | checkstyle | - |
//! | C++/C | [`CppChecker`] | cpplint, clang-tidy | - |
//! | Objective-C | [`CppChecker`] | cpplint, clang-tidy | - |
//! | Swift | [`SwiftChecker`] | swiftlint | - |
//! | Kotlin | [`KotlinChecker`] | ktlint, detekt | - |
//! | Dart | [`DartChecker`] | dart analyze | - |
//! | Lua | [`LuaChecker`] | luacheck | - |
//! | Shell/Bash | [`ShellChecker`] | shellcheck | - |
//! | Ruby | [`RubyChecker`] | rubocop | - |
//! | PHP | [`PhpChecker`] | phpcs | - |
//! | Scala | [`ScalaChecker`] | scalafix | - |
//! | C# | [`CSharpChecker`] | dotnet-format | - |
//!
//! ## Checker Trait
//!
//! All checkers implement the [`Checker`] trait:
//!
//! ```rust,ignore
//! pub trait Checker: Send + Sync {
//! /// Returns the checker name (e.g., "rust", "python")
//! fn name(&self) -> &str;
//!
//! /// Check if the underlying tool is available
//! fn is_available(&self) -> bool;
//!
//! /// Run the checker on a file
//! fn check(&self, path: &Path) -> Result<Vec<LintIssue>>;
//! }
//! ```
//!
//! ## Usage
//!
//! ```rust,no_run
//! use linthis::checkers::{Checker, RustChecker};
//! use std::path::Path;
//!
//! let checker = RustChecker::new();
//!
//! if checker.is_available() {
//! let issues = checker.check(Path::new("src/main.rs")).unwrap();
//! for issue in issues {
//! println!("{}:{}: {}", issue.file_path.display(), issue.line, issue.message);
//! }
//! } else {
//! eprintln!("Clippy not available. Install with: rustup component add clippy");
//! }
//! ```
pub use CppChecker;
pub use CSharpChecker;
pub use DartChecker;
pub use GoChecker;
pub use JavaChecker;
pub use KotlinChecker;
pub use LuaChecker;
pub use PhpChecker;
pub use PythonChecker;
pub use RubyChecker;
pub use RustChecker;
pub use ScalaChecker;
pub use ShellChecker;
pub use SwiftChecker;
pub use Checker;
pub use TypeScriptChecker;