nbQA-dev / nbQA

Run ruff, isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks
https://nbqa.readthedocs.io/en/latest/index.html
MIT License
1.01k stars 39 forks source link

"Files were modified by this hook" but no files is modified in `git status` #831

Closed rdbisme closed 11 months ago

rdbisme commented 11 months ago

Hello, I have configured nbQA with pre-commit.

  - repo: https://github.com/nbQA-dev/nbQA
    rev: 1.7.0
    hooks:
      - id: nbqa-black
        additional_dependencies: [jupytext, black] # optional, only if you're using Jupytext
      - id: nbqa-isort
        additional_dependencies: [jupytext, isort] # optional, only if you're using Jupytext 

when I run pre-commit run --all-files it tells me that some files have been modified (so it fails), but I can't find the files in the tree. git status returns a clean tree.

Any idea on how to debug?

check yaml...............................................................Passed
check json...........................................(no files to check)Skipped
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check for added large files..............................................Passed
debug statements (python)................................................Passed
nbqa-black...............................................................Failed
- hook id: nbqa-black
- files were modified by this hook

reformatted docs/runbooks/get_email.md
reformatted docs/runbooks/obtain_correlation_table.md
reformatted docs/runbooks/rebackfill.md

All done! ✨ 🍰 ✨
3 files reformatted, 6 files left unchanged.

nbqa-isort...............................................................Failed
- hook id: nbqa-isort
- files were modified by this hook

Fixing /home/rxxxxxx/git/internal-docs/docs/runbooks/get_email.md
Fixing /home/rxxxxxx/git/internal-docs/docs/runbooks/obtain_correlation_table.md
Fixing /home/rxxxxxx/git/internal-docs/docs/runbooks/rebackfill.md
rdbisme commented 11 months ago

Ok, the problem was conflicts between isort and black. Needed to add args: [--profile=black].