Skip to content

Add markdown to types_or - #159

Merged
ntBre merged 5 commits into
astral-sh:mainfrom
34j:patch-1
Aug 25, 2026
Merged

ntBre merged 5 commits into
astral-sh:mainfrom
34j:patch-1

Conversation

@34j

@34j 34j commented Mar 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Now *.md files are in tool.ruff.include by default and may be used with tool.ruff.format.preview = True, etc.

https://docs.astral.sh/ruff/settings/#include

astral-sh/ruff@4795eca#diff-959aaaf28345388cb476e91b1a8b127625bffba0ca2f8ed794f687bd27e50302

Test Plan

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.15.5
    hooks:
      - id: ruff-format
        types_or: [python, pyi, jupyter, markdown]

@MichaReiser

Copy link
Copy Markdown
Member

Thank you. I think we should wait until the feature is out of preview before changing our defaults.

@mxr

mxr commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Could you update the types_or in the README.md too?

@henryiii

Copy link
Copy Markdown
Contributor

It came out of preview! https://astral.sh/blog/ruff-v0.16.0

@ntBre ntBre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks straightforward to me, I just suggested dropping markdown from the linter invocation. Could you also add it to the README as suggested by the comments?

Happy to handle it if you'd prefer, I know it has been a long time :)

Comment thread .pre-commit-hooks.yaml Outdated
@GideonBear

GideonBear commented Aug 24, 2026 •

Copy link
Copy Markdown

@ntBre This has been stale for a while now, could you apply the suggestion and merge?
edit: oh I see the readme also needs to be updated. I could do that too, lmk what you want.

Comment thread README.md Outdated
@ntBre

ntBre commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Yep, thanks for the reminder!

@ntBre
ntBre merged commit e4c52d6 into astral-sh:main Aug 25, 2026
ntBre added a commit to astral-sh/ruff that referenced this pull request Aug 28, 2026
…28112)

Summary
--

This PR updates our ruff-pre-commit dependency to 0.16.5, which supports
the new category selectors,
and then enables `lint.preview` and the new default categories so that
we can dogfood them on our
code. There were 66 diagnostics initially, which I also fixed or
ignored:

```
28	FURB113 	[ ] repeated-append
12	ASYNC240	[ ] blocking-path-method-in-async-function
 6	RUF105  	[*] noqa-comments
 5	PLW1510 	[ ] subprocess-run-without-check
 3	PLW0108 	[ ] unnecessary-lambda
 2	EXE001  	[ ] shebang-not-executable
 2	RUF039  	[*] unraw-re-pattern
 1	B024    	[ ] abstract-base-class-without-abstract-method
 1	FURB142 	[*] for-loop-set-mutations
 1	PERF102 	[ ] incorrect-dict-iterator
 1	PLC0207 	[*] missing-maxsplit-arg
 1	PLW0127 	[ ] self-assigning-variable
 1	TRY004  	[ ] type-check-without-type-error
 1	PLW0120 	[*] useless-else-on-loop
 1	TRY201  	[ ] verbose-raise
 ```

Of these, I ignored `repeated-append` and `blocking-path-method-in-async-function`. I think they are
still reasonable defaults, just less useful/important in our uses.

0.16.5 also includes astral-sh/ruff-pre-commit#159, so I removed `markdown` from our main `ruff-format` hook, leaving it for the later mdtest formatting stage.

I also had to make a few changes related to config discovery in tests:
- move our cached ecosystem checkouts to `$RUNNER_TEMP` instead of inside of our checkout
- convert some CLI tests to use the `CliTest` helpers
- add `configurationPreference: editorOnly` to some notebook tests

In these cases, our own Ruff settings were being inherited by test code. This likely affects many other tests, but I only updated the obviously failing ones for now. I'm least confident about the notebook tests, but as far as I can tell from the history (#11944, #22810), the specific diagnostics are not the important parts being asserted.

Test Plan
--

CI on this PR
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.

7 participants