Skip to content

Fix ruff 0.16 compatibility (pin default rule set + concise output) - #70

Open
dchaudhari7177 wants to merge 1 commit into
pydantic:mainfrom
dchaudhari7177:fix/ruff-016-default-rules
Open

Fix ruff 0.16 compatibility (pin default rule set + concise output)#70
dchaudhari7177 wants to merge 1 commit into
pydantic:mainfrom
dchaudhari7177:fix/ruff-016-default-rules

Conversation

@dchaudhari7177

Copy link
Copy Markdown

Fixes #69.

Ruff 0.16 broke test_ruff_ok, test_ruff_error, and test_ruff_config with two independent changes:

  1. New rules in the default set. Ruff 0.16 promoted I (isort) and FA (flake8-future-annotations) into its default rule selection. Since ruff_config() used --extend-select on top of ruff's defaults, examples suddenly got I001 / FA100 that pytest-examples never opted into (import sorting is opt-in via isort=, and there's no future-annotations option at all).

    Fix: pin ruff's classic default base (E4,E7,E9,F) explicitly and use --select, so the enforced rule set no longer drifts with ruff's defaults. Opt-in flags (isort, upgrade, quotes, ruff_select) extend this base exactly as before. This reproduces the pre-0.16 behavior, so the existing test assertions pass unchanged.

  2. Default output format changed. Ruff 0.16 made the grouped full format the default, which breaks the ^-:(\d+) offset rewriting in ruff_check and the readable one-error-per-line output. Fix: pass --output-format=concise explicitly.

tests/test_lint.py and the ruff/isort/upgrade cases in tests/test_run_examples.py are green.

Out of scope: a few test_black_* / test_insert_print cases and test_update_examples_dir.py also fail on main, but those are due to a newer black/pytest, not ruff — happy to tackle them separately if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests fail with ruff 0.16

1 participant