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:Richard 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:
Hugo 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:
Richard Si <63936253+ichard26@users.noreply.github.com> * Check for is_stdin and p.is_file before checking for p.is_dir() Co-authored-by:
Richard Si <63936253+ichard26@users.noreply.github.com> Co-authored-by:
Hugo van Kemenade <hugovk@users.noreply.github.com>
Loading
Please register or sign in to comment