Skip to content

[自荐] linthis:一条命令搞定多语言 lint / format / 安全 / 复杂度检查的 Rust 工具 #3248

@zhlinh

Description

@zhlinh

项目地址

https://github.com/zhlinh/linthis

类别

Rust

项目标题

一条命令搞定多语言 lint、格式化、安全扫描的 Rust 工具

项目描述

linthis 是一个用 Rust 写的跨平台多语言 Linter & Formatter,把 ruff、eslint、clippy、golangci-lint、clang-tidy、ktlint 等十几种工具封装在统一的命令行后面,一条 linthis 即可同时跑 lint、格式化、安全扫描(SAST)和复杂度分析。它支持自动识别项目语言、基于 Git 仓库分发团队规范的插件系统、git hook 与 AI agent hook(Claude Code / Cursor / Codex 等),适合多语言项目、monorepo 以及希望把代码规范沉淀成可版本化配置的团队,让新成员一行命令就能拿到完整的代码风格与质量门槛

亮点

  • 一条命令多任务:lint + format + security + complexity 一次跑完,不再为每种语言单独配工具。
  • 17+ 语言开箱即用:Rust / Python / TS / JS / Go / Java / C / C++ / Swift / Kotlin / Lua / Dart / Shell / Ruby / PHP / Scala / C# 自动识别,无需手动指定。
  • 基于 Git 的插件系统:团队规范打包成一个 Git 仓库,linthis plugin add 一行同步给所有人,告别"每个项目重复配 .eslintrc / pyproject.toml"。
  • AI 友好:内置 linthis review 跑 diff 生成评审并自动开 PR/MR;hook 可挂到 Claude Code、Cursor、Codex、Gemini 等 AI 编程助手上,失败后让 AI 按规范自动修复。
  • 安全 + 复杂度门禁:内置密钥泄漏检测,集成 OpenGrep / Semgrep / Bandit / Gosec / Flawfinder,函数级圈复杂度 / 认知复杂度可设阈值卡 CI。
  • Rust 性能 + 单文件缓存:多核并行处理,重复检查只跑变化文件。
  • 撤销友好:format 自动备份,linthis backup undo / redo 一键回滚,保留 git patch 便于 review。
  • 编辑器全覆盖:官方提供 VSCode、JetBrains、Neovim 插件,支持 Format on Save。

示例代码

# 安装(推荐 uv)
uv tool install linthis

# 添加团队规范插件
linthis plugin add -g sample https://github.com/zhlinh/linthis-plugin-template

# 安装 git + AI 自动修复 hook
linthis hook install -g --type git-with-agent --provider claude

# 检查并格式化指定目录
linthis -i src/

# 提交前只检查 staged 文件
git add src/main.py
linthis -s

# AI 代码评审 + 自动开 PR
linthis review --auto-fix

截图或演示视频

Image Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions