Skip to content

Discover markdown files by default in preview mode#23434

Merged
amyreese merged 6 commits intomainfrom
amy/discover-markdown-by-default
Mar 5, 2026
Merged

Discover markdown files by default in preview mode#23434
amyreese merged 6 commits intomainfrom
amy/discover-markdown-by-default

Conversation

@amyreese
Copy link
Member

@amyreese amyreese commented Feb 20, 2026

Adds *.md to the list of default globs in preview mode.

Adds a simple filter to the check CLI command to exclude file types that aren't
supported for linting before checking if the set of resolved paths is empty, preserving
existing behavior of warning "No Python files found under the given path(s)" even if
there are markdown files present and preview mode is enabled.

Fixes #3792

@astral-sh-bot
Copy link

astral-sh-bot bot commented Feb 20, 2026

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@amyreese amyreese force-pushed the amy/discover-markdown-by-default branch from 0a80e89 to dc1b131 Compare February 27, 2026 02:37
@amyreese amyreese marked this pull request as ready for review February 27, 2026 02:37
@amyreese amyreese requested a review from MichaReiser February 27, 2026 02:37
@amyreese amyreese requested a review from ntBre February 27, 2026 02:37
kdeldycke added a commit to kdeldycke/repomatic that referenced this pull request Feb 27, 2026
@ntBre
Copy link
Contributor

ntBre commented Feb 27, 2026

Oh does this mean you don't have to configure extend-include now? Do we need to update the docs?

@amyreese
Copy link
Member Author

Yes, I'll include docs update before landing this. I'm looking at how it affects file discovery in the linter, and whether we should update wording/behavior or not. Micha was concerned that this could result in losing the "no python files found" message when linting with markdown files in the discovery path, even though we aren't linting markdown files, but also I'm not sure how much of a blocker that is for landing in preview mode.

@ntBre
Copy link
Contributor

ntBre commented Feb 27, 2026

Oh right, I forgot there was more to it than the two line diff 😄 It seems okay to me to continue saying "no python files found" for the linter (less so for the formatter), but it also makes sense to check all the places this affects. I only briefly checked the references for INCLUDE_PREVIEW when reviewing.

@amyreese
Copy link
Member Author

Added a simple filter to the check CLI, and validated that it preserves the existing warning in preview mode, even if the directory/files to lint contains markdown files:

Target dir contains markdown and unsupported TOML file:

amethyst@lunatone ~/workspace/ruff amy/discover-markdown-by-default+ » ls tmp/
foo.md  Pipfile

amethyst@lunatone ~/workspace/ruff amy/discover-markdown-by-default+ » ruff-check --preview tmp/
   Compiling ruff v0.15.4 (/Users/amethyst/workspace/ruff/crates/ruff)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.51s
     Running `target/debug/ruff check --no-cache --preview tmp/`
warning: No Python files found under the given path(s)
All checks passed!

Add a python file:

amethyst@lunatone ~/workspace/ruff amy/discover-markdown-by-default+ » touch tmp/foo.py

amethyst@lunatone ~/workspace/ruff amy/discover-markdown-by-default+ » ruff-check --preview tmp/
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10s
     Running `target/debug/ruff check --no-cache --preview tmp/`
All checks passed!

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

We should more carefully review all call sites of python_files_in_path

@amyreese amyreese force-pushed the amy/discover-markdown-by-default branch from 51becbc to 70ecff6 Compare March 4, 2026 22:35
@amyreese amyreese merged commit 9a70f5e into main Mar 5, 2026
43 checks passed
@amyreese amyreese deleted the amy/discover-markdown-by-default branch March 5, 2026 17:55
@amyreese amyreese added formatter Related to the formatter preview Related to preview mode features labels Mar 5, 2026
carljm added a commit that referenced this pull request Mar 5, 2026
* main:
  Update conformance suite commit hash (#23746)
  conformance.py: Collapse the summary paragraph when nothing changed (#23745)
  [ty] Make inferred specializations line up with source types more better (#23715)
  Bump 0.15.5 (#23743)
  [ty] Render all changed diagnostics in conformance.py (#23613)
  [ty] Split deferred checks out of `types/infer/builder.rs` (#23740)
  Discover markdown files by default in preview mode (#23434)
  [ty] Use `HasOptionalDefinition` for `except` handlers (#23739)
  [ty] Fix precedence of `all` selector in TOML configurations (#23723)
  [ty] Make `all` selector case sensitive (#23713)
  [ty] Add a diagnostic if a `TypeVar` is used to specialize a `ParamSpec`, or vice versa (#23738)
  [ty] Override home directory in ty tests (#23724)
  [ty] More type-variable default validation (#23639)
  [ty] Validate bare ParamSpec usage in type annotations, and support stringified ParamSpecs as the first argument to `Callable` (#23625)
  [ty] Add `all` selector to ty.json's `schema` (#23721)
  [ty] Add quotes to related issues links (#23720)
  [ty] Fix panic on incomplete except handlers (#23708)
kdeldycke added a commit to kdeldycke/repomatic that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

formatter Related to the formatter preview Related to preview mode features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply ruff formatting to markdown code blocks

3 participants