Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black formatter not respecting pyproject.toml exclude #7047

Closed
Angry-Potato opened this issue Aug 21, 2019 · 2 comments
Closed

Black formatter not respecting pyproject.toml exclude #7047

Angry-Potato opened this issue Aug 21, 2019 · 2 comments
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@Angry-Potato
Copy link

Environment data

  • VS Code version: 1.37.1
  • Extension version (available under the Extensions sidebar): 2019.8.30787
  • OS and version: macOS Mojave 10.14.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: black==19.3b0
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Jedi

Expected behaviour

On save, Black will not format files that are excluded by pyproject.toml.

Actual behaviour

Black formats files regardless.

Steps to reproduce:

  1. Make a pyproject.toml file in your project, e.g.:
[tool.black]
exclude = '(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist|.*\/models\.py.*|.*\/models\/.*)'
  1. Create a models.py file, with a formatting problem:
# note space before print
 print("This line will be printed.")

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

> ~/anaconda2/envs/py_dev/bin/python -m black --config ~/work/example/pyproject.toml --diff --quiet ~/work/example/models.py.78c71eac353ea0a0b304502b320f3b03.py
cwd: ~/work/example
> ~/anaconda2/envs/py_dev/bin/python -m black --config ~/work/example/pyproject.toml --diff --quiet ~/work/example/models.py.78c71eac353ea0a0b304502b320f3b03.py
cwd: ~/work/example

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

> ~/anaconda2/envs/py_dev/bin/python -m black --config ~/work/example/pyproject.toml --diff --quiet ~/work/example/models.py.78c71eac353ea0a0b304502b320f3b03.py
cwd: ~/work/example
> ~/anaconda2/envs/py_dev/bin/python -m black --config ~/work/example/pyproject.toml --diff --quiet ~/work/example/models.py.78c71eac353ea0a0b304502b320f3b03.py
cwd: ~/work/example
@Angry-Potato Angry-Potato added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Aug 21, 2019
@Angry-Potato
Copy link
Author

could be solved by the outcome of psf/black#438

@karrtikr
Copy link

Closing as this is an issue of black upstream.

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Aug 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants