lint

GitHub

指导在 Ray 项目中对修改文件运行 pre-commit 进行代码检查与格式化。涵盖安装、处理残留错误(如缺失导入)、使用 noqa 注释及排除规则,旨在确保代码符合规范。

.claude/skills/lint/SKILL.md ray-project/ray

触发场景

提交代码前检查 修复 lint 报错

安装

npx skills add ray-project/ray --skill lint -g -y
更多选项

非标准路径

npx skills add https://github.com/ray-project/ray/tree/master/.claude/skills/lint -g -y

不安装直接使用

npx skills use ray-project/ray@lint

指定 Agent (Claude Code)

npx skills add ray-project/ray --skill lint -a claude-code -g -y

安装 repo 全部 skill

npx skills add ray-project/ray --all -g -y

预览 repo 内 skill

npx skills add ray-project/ray --list

SKILL.md

Frontmatter
{
    "name": "lint",
    "description": "Run linting and formatting checks on Ray code"
}

Lint Modified Files

Run pre-commit on the files you changed:

pre-commit run --files $(git diff --name-only HEAD)

pre-commit run without --files only operates on staged files, so pass the modified file list explicitly.

If pre-commit is not installed:

pip install -c python/requirements_compiled.txt pre-commit && pre-commit install

Handling remaining errors

Pre-commit auto-fixes simple issues (formatting, long lines, unused imports). Review any remaining errors — these typically need code changes such as adding a missing import, resolving a name conflict, or restructuring logic. Fix them by editing the source code directly.

Use # noqa only for false positives that cannot be resolved by changing the code, and include the rule code and reason: # noqa: E501 — URL cannot be split.

Exclusions

pyproject.toml lists files in per-file-ignores and extend-exclude. When the PR modifies a file that is on one of these lists, fix the lint issues in your changes and consider removing the file from the list. Leave exclusion entries for files outside the PR scope untouched.

Reference

  • Hook config: .pre-commit-config.yaml
  • Ruff config: pyproject.toml ([tool.ruff] section)
  • Docs: doc/source/ray-contribute/development.md ("Development tooling")

版本历史

  • 3fb63d9 当前 2026-07-25 11:18

同 Skill 集合

.claude/skills/backport-docs/SKILL.md
.claude/skills/fetch-buildkite-logs/SKILL.md
.claude/skills/ray-dependencies/SKILL.md
.claude/skills/rebuild/SKILL.md
doc/.claude/skills/ray-soft-wrap/SKILL.md
doc/.claude/skills/rst-to-myst/SKILL.md
doc/.claude/skills/sphinx-fix/SKILL.md

元信息

文件数
0
版本
1cf93ad
Hash
a47670f1
收录时间
2026-07-25 11:18

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-13 12:00
浙ICP备14020137号-1