Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ TIDY_SOURCES = $(shell find src tests -type f -name '*.cpp')
# Conan's, not prettier's.
PRETTIER_SOURCES = $(shell git ls-files '*.md' '*.json' '*.yml' '*.yaml' ':!conan.lock')
MARKDOWN_SOURCES = $(shell git ls-files '*.md')
PYTHON_SOURCES = scripts/
# Lint and format conanfile.py alongside the first-party Python scripts
PYTHON_SOURCES = scripts/ conanfile.py

define require-tool
command -v $(1) >/dev/null || $(DIE) "$(1) not found"
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,20 @@ make lint
```

`make format` and `make format-check` cover C++ sources (clang-format), `CMakeLists.txt`
(cmake-format, from the [cmakelang](https://cmake-format.readthedocs.io) package), Python scripts
([ruff](https://docs.astral.sh/ruff/) format), and tracked Markdown/JSON/YAML files
([prettier](https://prettier.io); `conan.lock` is excluded because Conan owns its formatting).
`make lint` runs clang-tidy against the debug compilation database, `cmake-lint` on
`CMakeLists.txt`, `ruff check` on `scripts/`, and
(cmake-format, from the [cmakelang](https://cmake-format.readthedocs.io) package), Python sources in
`scripts/` and `conanfile.py` ([ruff](https://docs.astral.sh/ruff/) format), and tracked
Markdown/JSON/YAML files ([prettier](https://prettier.io); `conan.lock` is excluded because Conan
owns its formatting). `make lint` runs clang-tidy against the debug compilation database,
`cmake-lint` on `CMakeLists.txt`, `ruff check` on those Python sources, and
[markdownlint](https://github.com/DavidAnson/markdownlint-cli2) on Markdown files. Any reported
finding fails the target. CI pins all lint and format tool versions in
[`.github/ci.env`](.github/ci.env).

[`ruff.toml`](ruff.toml) extends Ruff's `E4`, `E7`, `E9`, and `F` defaults to all `E` checks, then
adds import ordering (`I`), Python modernization (`UP`), likely bugs (`B`), simplification (`SIM`),
Ruff-specific rules (`RUF`), and annotations (`ANN`). As with `.clang-tidy`, every finding fails the
lint target.

## Coverage

Build, test, and generate an HTML coverage report with an enforced line floor:
Expand Down
19 changes: 19 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 100 columns, matching the repo-wide convention (.clang-format, .cmake-format.yaml, and
# .editorconfig/markdownlint all use 100); ruff's default is 88.
line-length = 100

[lint]
# Ruff enables E4, E7, E9, and F by default. Add all E checks plus import ordering, Python
# modernization, likely bugs, simplification, Ruff-specific rules, and annotations. As with
# clang-tidy, every finding is an error. ANN keeps existing type annotations complete.
select = ["E", "F", "I", "UP", "B", "SIM", "RUF", "ANN"]

[lint.isort]
# The local conan/ directory contains settings_user.yml, but its name shadows the third-party conan
# package. isort's source detection therefore classifies `from conan import ConanFile` as
# first-party and separates it from the conan.tools imports. Mark the package as third-party
# explicitly.
known-third-party = ["conan"]

[lint.per-file-ignores]
# Conan reads the recipe's options and default_options class attributes as dictionaries, so
# RUF012's ClassVar/__init__ guidance does not apply. Conan also invokes recipe methods through an
# untyped callback API, where the annotations required by ANN would add no useful information.
"conanfile.py" = ["RUF012", "ANN"]
2 changes: 1 addition & 1 deletion scripts/rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from __future__ import annotations

import argparse
from pathlib import Path
import re
import shutil
import subprocess
import sys
from pathlib import Path

OLD_SNAKE = "cpp_boilerplate"
OLD_KEBAB = "cpp-boilerplate"
Expand Down
Loading