-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
C: file collectionRelated to file collection (e.g. gitignore & cache) or file discovery and all of its configuration.Related to file collection (e.g. gitignore & cache) or file discovery and all of its configuration.T: bugSomething isn't workingSomething isn't working
Description
Describe the bug
I have a repo in which I use the following rule to ignore all files without extensions (e.g all compiled executables)
# To ignore compiled binaries that have no extensions we need to first ignore everything,
# then unignore files with extensions and directories
*
!*.*
!*/
When I run black in the root of this repo, none of the python files in any of the subdirectories are checked because black thinks those subdirectories are ignored:
$ black -v .
Identified `/home/ali/repos/tacs` as project root containing a .git directory.
Sources to be formatted: "."
.
.
.
/home/ali/repos/tacs/tests ignored: matches a .gitignore file content
/home/ali/repos/tacs/tacs ignored: matches a .gitignore file content
.
.
.
All done! ✨ 🍰 ✨
1 file left unchanged.
Presumably this is happening because black is checking whether /home/ali/repos/tacs/tests
would be ignored, which it would, while the correct path for that directory is actually /home/ali/repos/tacs/tests/
, which would not be ignored.
To Reproduce
clone the repo:
git clone [email protected]:smdogroup/tacs.git
Run black in verbose mode in the root directory
cd tacs
black -v .
The resulting error is:
/home/ali/repos/tacs/reports ignored: matches a .gitignore file content
/home/ali/repos/tacs/examples ignored: matches a .gitignore file content
/home/ali/repos/tacs/testflo_report.out ignored: matches a .gitignore file content
/home/ali/repos/tacs/Makefile ignored: matches a .gitignore file content
/home/ali/repos/tacs/Makefile.in ignored: matches a .gitignore file content
/home/ali/repos/tacs/build ignored: matches a .gitignore file content
/home/ali/repos/tacs/.git ignored: matches the --exclude regular expression
/home/ali/repos/tacs/.vscode ignored: matches a .gitignore file content
/home/ali/repos/tacs/src ignored: matches a .gitignore file content
/home/ali/repos/tacs/docs ignored: matches a .gitignore file content
/home/ali/repos/tacs/extern ignored: matches a .gitignore file content
/home/ali/repos/tacs/tests ignored: matches a .gitignore file content
/home/ali/repos/tacs/tacs.egg-info ignored: matches a .gitignore file content
/home/ali/repos/tacs/conda ignored: matches a .gitignore file content
/home/ali/repos/tacs/tacs ignored: matches a .gitignore file content
/home/ali/repos/tacs/roadmaps ignored: matches a .gitignore file content
/home/ali/repos/tacs/lib ignored: matches a .gitignore file content
/home/ali/repos/tacs/.pre-commit-config.yaml ignored: matches a .gitignore file content
/home/ali/repos/tacs/setup.py wasn't modified on disk since last run.
All done! ✨ 🍰 ✨
1 file left unchanged.
Expected behavior
black should run on all python files in the repo:
All done! ✨ 🍰 ✨
214 files left unchanged.
Environment
- Black's version: 23.3.0
- OS and Python version: Linux/Python 3.10.9
Metadata
Metadata
Assignees
Labels
C: file collectionRelated to file collection (e.g. gitignore & cache) or file discovery and all of its configuration.Related to file collection (e.g. gitignore & cache) or file discovery and all of its configuration.T: bugSomething isn't workingSomething isn't working