lint

$npx mdskill add ray-project/ray/lint

Runs linting and formatting checks on modified Ray code

  • Ensures code quality and formatting consistency in Ray projects
  • Uses pre-commit, Ruff, and git to analyze staged or modified files
  • Checks for style violations, formatting issues, and code errors
  • Reports findings and suggests fixes or manual review for unresolved issues

SKILL.md

.github/skills/lintView on GitHub ↗
---
name: lint
description: Run linting and formatting checks on Ray code
---

# Lint Modified Files

Run pre-commit on the files you changed:

```bash
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:
```bash
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")

More from ray-project/ray

SkillDescription
backport-docsCherry-pick documentation changes from master onto a release branch so they appear on the docs.ray.io /latest build
bazel-visibilityRules for setting Bazel target visibility in Ray BUILD files — keep every target as private as possible, grant the minimal visibility needed, and lay out tests in a subdir. Applies when adding or editing any BUILD.bazel target.
fetch-buildkite-logsFetch Buildkite CI job logs, and a job's artifacts when the logs are not enough, from a Buildkite build URL or build number, then summarize the failures
ray-dependenciesManage Python dependencies in Ray — add/remove/upgrade packages, work with raydepsets lock files, debug dependency conflicts, and regenerate compiled requirements. Covers `python/requirements*`, `python/requirements/**`, `python/deplocks/**`, and `ci/raydepsets/configs/*.depsets.yaml`.
ray-soft-wrapSoft-wrap (unwrap) hard-wrapped prose in Markdown/MyST files in the ray-project/ray repo so each paragraph and list item is one line, with deterministic content-invariant, render-equality, and idempotency checks. Use when asked to soft-wrap, unwrap, or reflow Ray docs (.md/.markdown), or to normalize line wrapping before style and grammar edits. Markdown only — rST files are converted to MyST first by a separate effort.
rebuildRebuild Ray from source — determines the right build mode based on what changed
rst-to-mystConvert Ray documentation pages from reStructuredText (.rst) to MyST Markdown (.md). Use when migrating existing files under doc/source/ to MyST, finishing a partial MyST migration of a directory, or when asked to convert/migrate a doc page to markdown. Covers the RST-to-MyST directive mapping, label and cross-reference preservation, sphinx-design tabs/dropdowns/card grids, doctest/testcode handling, the doc/BUILD.bazel doctest exclusions, and the build and doctest verification needed to land a clean docs PR.
sphinx-fixDiagnose a failing Ray Sphinx / Read the Docs documentation build. Parses the Sphinx warning stream (an RtD build log, a local build, or pasted text), classifies each warning against a rules table, and proposes the canonical fix in severity-tier order. Detects a hard-broken build, segregates known-benign suppressed classes, and lists every unclassified warning. Use when a `docs/readthedocs.com:anyscale-ray` check fails, when asked "why is the docs build failing?" or "what warning is breaking this PR?", or to turn a Sphinx warning dump into an ordered fix list.