Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 1 addition & 2 deletions .ai/python-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ ruff format <touched_paths>
ruff check --fix <touched_paths>
```

Or use pre-commit (runs isort, black, flake8, ruff, and more):
Or use pre-commit (runs isort, black, ruff, and more):

```bash
pre-commit run --files <touched_files>
Expand All @@ -369,7 +369,6 @@ The repo's `.pre-commit-config.yaml` runs these Python hooks:

- **isort** -- import sorting (`profile = "black"`, configured in `pyproject.toml`)
- **black** -- code formatting
- **flake8** -- style checks (`max-line-length=88`)
- **ruff** -- fast linting with auto-fix
- **codespell** -- spelling checks
- **trailing-whitespace**, **end-of-file-fixer**, **check-yaml**, **check-json**, **check-toml**
Expand Down
10 changes: 2 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ repos:
hooks:
- id: black
types_or: [python, cython]
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0 # 5.0.4 crashes on Python 3.12+ (ast.Str removed)
hooks:
- id: flake8
args: [--max-line-length=88, --select=C,E,F,W,B,B950, --extend-ignore = E203,E501]
types_or: [python, cython]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.5
hooks:
Expand Down Expand Up @@ -71,9 +65,9 @@ repos:

# Fast linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
rev: v0.17.3
hooks:
- id: ruff
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]

# NOTE: pyright may be able to find other classes of errors not covered above,
Expand Down
2 changes: 1 addition & 1 deletion docs/fern/scripts/tests/test_gen_python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
``conftest.py`` next to this file owns the ``sys.path`` shim that makes the
top-level imports of ``api_discovery`` / ``api_rendering`` /
``gen_python_api`` resolve, so this module keeps every import at the top
and stays clean under the repo's flake8 config.
and stays clean under the repo's ruff config.

Invocation from an isolated environment (bypasses the repo's Python
resolution, which is unrelated to this generator)::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const MAX_LINE_LEN: usize = 88;

/// Emit one `NAME = "value"` assignment, wrapping in parentheses exactly the way black
/// does when the single-line form would exceed `MAX_LINE_LEN`. Comments are left alone —
/// black does not reflow them, and flake8 has `E501` in `extend-ignore`.
/// black does not reflow them, and the ruff hook does not select `E501`.
fn push_assignment(body_pad: &str, name: &str, value: &str, lines: &mut Vec<String>) {
let single = format!("{}{} = \"{}\"", body_pad, name, value);
if single.chars().count() <= MAX_LINE_LEN {
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ markers = [
line-length = 88
indent-width = 4

[tool.ruff.lint]
# The rules that ruff 0.5.2 enabled by default. Newer ruff enables many more by default.
select = ["E4", "E7", "E9", "F"]

[tool.ruff.lint.extend-per-file-ignores]
"icp/tests/**/test_*.py" = ["F811", "F401"]
"*_inc.py" = ["F821"]
Expand Down
Loading