Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

2.4 KiB

Ruff and Tooling Rules — AI-Authoritative Reference

These rules summarize the project's automated linting and formatting requirements. Canonical configuration: pyproject.toml


Line Length

Hard limit: 88 characters per line. This is enforced by ruff (line-length = 88 in pyproject.toml).

  • Do not generate lines that exceed 88 characters.
  • Break long function arguments, chained calls, or comments across multiple lines.
  • Use implicit string concatenation or backslash continuation for long strings.
# Correct — argument list broken across lines
result = some_function(
    argument_one,
    argument_two,
    argument_three,
)

# Flagged by Ruff (E501)
result = some_function(argument_one, argument_two, argument_three, argument_four_long_name)

Enforced Ruff Rules

The following rules are enforced on all files in src/ (see pyproject.toml for full config):

Rule Set Code Requirement
Line length E501 Maximum 88 characters per line
Type annotations ANN All function arguments and return values must have type hints (except self, cls, _ args)
Modern syntax UP Use f-strings, not .format() or %
Path handling PTH Use pathlib.Path, not os.path
Pyflakes F No unused imports or variables
pycodestyle E, W PEP 8 compliance
isort I Sorted imports

Quick Reference

Type Annotations

# Correct
def process_data(name: str, values: list[float]) -> dict[str, Any]:
    ...

# Flagged by Ruff (ANN)
def process_data(name, values):
    ...

String Formatting

# Correct
message = f"Processing {name}"

# Flagged by Ruff (UP)
message = "Processing {}".format(name)

Path Handling

# Correct
config_path = Path.cwd() / "config" / "settings.yaml"

# Flagged by Ruff (PTH)
config_path = os.path.join(os.getcwd(), "config", "settings.yaml")

Suppressing Rules

Use sparingly and only when genuinely necessary:

  • # fmt: off / # fmt: on — disable/re-enable formatting for a block
  • # fmt: skip — skip formatting for a single line
  • # noqa: <RULE> — suppress a specific lint rule for a line

Running Ruff Locally

# Check for issues
ruff check .
ruff format --check .

# Auto-fix
ruff check --fix .
ruff format .

# Check specific rule set
ruff check --select ANN .