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

precommit black doesn't read from pyproject.toml file. #4317

Open
arshan-ritual opened this issue Apr 21, 2024 · 1 comment
Open

precommit black doesn't read from pyproject.toml file. #4317

arshan-ritual opened this issue Apr 21, 2024 · 1 comment
Labels
T: bug Something isn't working

Comments

@arshan-ritual
Copy link

Describe the bug

My precommit file:

repos:
  - repo: https://github.com/psf/black
    rev: 24.4.0
    hooks:
      - id: black

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.0.289
    hooks:
      - id: ruff
        args: [--fix, --exit-non-zero-on-fix]

etc.

My pyproject.toml file:

[tool.black]
line-length = 89

[tool.isort]
profile = "black"
skip = [".gitignore", ".dockerignore"]

I'm running this. Black sets line length to 120 by default & doesn't read from my config.

pre-commit run --all-files
black....................................................................Passed
ruff.....................................................................Failed
- hook id: ruff
- exit code: 1

src/chain/errors.py:56:90: E501 Line too long (103 > 89 characters)
src/chain/errors.py:57:90: E501 Line too long (103 > 89 characters)
src/chain/errors.py:58:90: E501 Line too long (107 > 89 characters)
src/chain/errors.py:59:90: E501 Line too long (112 > 89 characters)
src/chain/errors.py:61:90: E501 Line too long (96 > 89 characters)
src/chain/errors.py:63:90: E501 Line too long (99 > 89 characters)
src/chain/errors.py:64:90: E501 Line too long (115 > 89 characters)
Found 7 errors.

mypy.....................................................................Passed
isort (python)...........................................................Passed
Fix End of Files.........................................................Passed
Check for added large files..............................................Passed
Trim Trailing Whitespace.................................................Passed
@arshan-ritual arshan-ritual added the T: bug Something isn't working label Apr 21, 2024
@JelleZijlstra
Copy link
Collaborator

Black does not fix all issues with line length; see https://github.com/psf/black/issues?q=is%3Aopen+is%3Aissue+label%3A%22F%3A+linetoolong%22. Are you sure Black is applying a line length of 120, as opposed to just leaving some long lines alone?

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

No branches or pull requests

3 participants
@JelleZijlstra @arshan-ritual and others