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

Output claims the configuration came from project root (filesystem root) when in reality it was user-level config. #2850

Closed
ichard26 opened this issue Feb 1, 2022 · 1 comment · Fixed by #2861
Labels
C: configuration CLI and configuration T: bug Something isn't working

Comments

@ichard26
Copy link
Collaborator

ichard26 commented Feb 1, 2022

Describe the bug

The verbose would claim that the filesystem root was identified as the project root (this is correct) and the configuration file came from /pyproject.toml (this is false).

To Reproduce

  • Create a test file in a directory where is no pyproject.toml present (up the filesystem root)
  • Format it with Black with --verbose
  • Create a user level config file and configure line length to be something very small
  • Reformat using the same command and observe the wrong output
black test.py --check -v
Identified `/` as project root containing a file system root.
Sources to be formatted: "home/ichard26/programming/oss/test.py"
test.py already well formatted, good job.

All done! ✨ 🍰 ✨
1 file would be left unchanged.echo "[tool.black]
  line-length = 10" > ~/.config/blackblack test.py --check -v
Identified `/` as project root containing a file system root.
Sources to be formatted: "home/ichard26/programming/oss/test.py"
Using configuration from project root.
would reformat test.py

Oh no! 💥 💔 💥
1 file would be reformatted.

Expected behavior

That the output would report either it came from user level configuration or at least not claim it was project configuration 'cause it's not.

Environment

  • Black's version: 22.1.0 and d038a24
  • OS and Python version: CPython 3.8.5 under Ubuntu 20.04.03 LTS

Additional context

This made it very confusing to debug an unrelated test suite issue :)

cc @Shivansh-007

@ichard26 ichard26 added T: bug Something isn't working C: configuration CLI and configuration labels Feb 1, 2022
@Shivansh-007
Copy link
Contributor

I would look into this 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: configuration CLI and configuration T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants