Fix integration between stdin filename and --force-exclude (#4539)

This commit is contained in:
GiGaGon 2024-12-27 16:48:23 -08:00 committed by GitHub
parent 3b00112ac5
commit 9431e98522
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -56,6 +56,9 @@
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
- If using stdin with `--stdin-filename` set to a force excluded path, stdin won't be
formatted. (#4539)
### Documentation
<!-- Major changes to documentation and policies. Small docs changes

View File

@ -749,6 +749,12 @@ def get_sources(
for s in src:
if s == "-" and stdin_filename:
path = Path(stdin_filename)
if path_is_excluded(stdin_filename, force_exclude):
report.path_ignored(
path,
"--stdin-filename matches the --force-exclude regular expression",
)
continue
is_stdin = True
else:
path = Path(s)