KSXGitHub/perfectionist
GitHub: KSXGitHub/perfectionist
基于 Dylint 的 Rust 项目额外 lint 规则集合,弥补 Clippy 未覆盖的代码风格与细节检查空白。
Stars: 2 | Forks: 0
# 完美主义者
针对 Rust 项目的额外 lint 规则。
## 规则
请参阅[主页](https://KSXGitHub.github.io/perfectionist/)了解目前所有已实现的规则。
请参阅[`planned-rules/`](https://github.com/KSXGitHub/perfectionist/tree/master/planned-rules)了解所有尚未实现的规则。
## 用法
安装 [Dylint](https://github.com/trailofbits/dylint),然后将 `perfectionist` 添加到您工作区的 `dylint.toml` 中:
```
[workspace.metadata.dylint]
libraries = [
{ git = "https://github.com/KSXGitHub/perfectionist" },
]
```
运行 lint:
```
cargo dylint --all -- --all-targets
```
每条 lint 都注册在 `perfectionist` 工具的命名空间下。可以在特定位置按名称屏蔽某条检查结果。例如:
```
#[expect(perfectionist::unicode_ellipsis_in_comments, reason = "3 ASCII dots would be incorrect here")]
```
## 配置
逐规则配置从工作区根目录的 `dylint.toml` 中读取。每条规则的配置项都记录在该规则的规划文件中。规则实现后,相同的信息也会在其模块文档中列出。
## 开发
**前置条件:**
* [Rustup](https://rustup.rs/)
* [Just](https://github.com/casey/just/)
`cargo-dylint` 和 `dylint-link` 不属于 cargo 依赖图,但它们的 ABI 与之耦合。它们会被安装到工作区本地的 `.dev-tools/` 目录中(锁定在 `Cargo.lock` 中的 `dylint_linting` 版本),通过以下命令执行:
```
just install-dev-tools
```
在克隆后运行一次此命令,并在每次 `dylint_linting` 升级时再次运行。其他所有的 `just` recipe 都会将 `.dev-tools/bin` 添加到 `PATH` 的前面,因此后续命令会自动使用锁定版本的二进制文件。
运行以下命令检查所有内容:
```
just all
```
## 许可证
[MIT](https://github.com/KSXGitHub/perfectionist/blob/master/LICENSE.md) © [Hoàng Văn Khải](https://github.com/KSXGitHub/)。
标签:DNS解析, Dylint, Linting, procedural-macro, Rust, Rust开发工具, 代码规范, 可视化界面, 开源项目, 编译器插件, 网络流量审计, 软件开发, 通知系统, 错误基检测, 静态代码分析