安装¶
根据您的环境,有多种方式安装 linthis。
方式 1:通过 Homebrew 安装(推荐 macOS/Linux 用户)¶
brew tap zhlinh/linthis
brew install linthis
升级到最新版本:
brew update
brew upgrade linthis
方式 2:通过 PyPI 安装(推荐 Python 用户)¶
# 使用 pip
pip install linthis
# 使用 uv(推荐)
# pip install uv
uv pip install linthis
方式 3:通过 Cargo 安装(推荐 Rust 用户)¶
cargo install linthis
方式 4:从源码构建¶
git clone https://github.com/zhlinh/linthis.git
cd linthis
cargo build --release
二进制文件将位于 target/release/linthis。
验证安装¶
安装后,验证 linthis 是否正常工作:
linthis --version
系统要求¶
- 操作系统:macOS、Linux、Windows
- 架构:x86_64、arm64
语言特定工具¶
linthis 封装了现有的语言特定工具。对于您想要检查/格式化的每种语言,您需要安装底层工具:
| 语言 | 所需工具 |
|---|---|
| Rust | rustfmt、clippy |
| Python | ruff 或 black、flake8、pylint |
| JavaScript/TypeScript | eslint、prettier |
| Go | gofmt、golangci-lint |
| Java | checkstyle、clang-format |
| C++ | clang-format、cpplint |
请参阅语言支持了解每种语言的详细设置说明。