Skip to content
Unverified Commit dea81b7a authored by Thiago Bellini Ribeiro's avatar Thiago Bellini Ribeiro Committed by GitHub
Browse files

Provide a stdin-filename to allow stdin to respect force-exclude rules (#1780)



* Provide a stdin-filename to allow stdin to respect exclude/force-exclude rules

This will allow automatic tools to enforce the project's
exclude/force-exclude rules even if they pass the file through stdin to
update its buffer.

This is a similar solution to --stdin-display-name in flake8.

* Update src/black/__init__.py

Co-authored-by: default avatarRichard Si <63936253+ichard26@users.noreply.github.com>

* --stdin-filename should only respect --exclude-filename

* Update README with the new --stdin-filename option

* Write some tests for the new stdin-filename functionality

* Apply suggestions from code review

Co-authored-by: default avatarHugo van Kemenade <hugovk@users.noreply.github.com>

* Force stdin output when we asked for stdin even if the file exists

* Add an entry in the changelog regarding --stdin-filename

* Reduce disk reads if possible

Co-authored-by: default avatarRichard Si <63936253+ichard26@users.noreply.github.com>

* Check for is_stdin and p.is_file before checking for p.is_dir()

Co-authored-by: default avatarRichard Si <63936253+ichard26@users.noreply.github.com>
Co-authored-by: default avatarHugo van Kemenade <hugovk@users.noreply.github.com>
parent 7d032fa8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment