]> git.madduck.net Git - etc/vim.git/blob - docs/usage_and_configuration/file_collection_and_discovery.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Bump sphinx-copybutton from 0.5.1 to 0.5.2 in /docs (#3651)
[etc/vim.git] / docs / usage_and_configuration / file_collection_and_discovery.md
1 # File collection and discovery
2
3 You can directly pass _Black_ files, but you can also pass directories and _Black_ will
4 walk them, collecting files to format. It determines what files to format or skip
5 automatically using the inclusion and exclusion regexes and as well their modification
6 time.
7
8 ## Ignoring unmodified files
9
10 _Black_ remembers files it has already formatted, unless the `--diff` flag is used or
11 code is passed via standard input. This information is stored per-user. The exact
12 location of the file depends on the _Black_ version and the system on which _Black_ is
13 run. The file is non-portable. The standard location on common operating systems is:
14
15 - Windows:
16   `C:\\Users\<username>\AppData\Local\black\black\Cache\<version>\cache.<line-length>.<file-mode>.pickle`
17 - macOS:
18   `/Users/<username>/Library/Caches/black/<version>/cache.<line-length>.<file-mode>.pickle`
19 - Linux:
20   `/home/<username>/.cache/black/<version>/cache.<line-length>.<file-mode>.pickle`
21
22 `file-mode` is an int flag that determines whether the file was formatted as 3.6+ only,
23 as .pyi, and whether string normalization was omitted.
24
25 To override the location of these files on all systems, set the environment variable
26 `BLACK_CACHE_DIR` to the preferred location. Alternatively on macOS and Linux, set
27 `XDG_CACHE_HOME` to your preferred location. For example, if you want to put the cache
28 in the directory you're running _Black_ from, set `BLACK_CACHE_DIR=.cache/black`.
29 _Black_ will then write the above files to `.cache/black`. Note that `BLACK_CACHE_DIR`
30 will take precedence over `XDG_CACHE_HOME` if both are set.
31
32 ## .gitignore
33
34 If `--exclude` is not set, _Black_ will automatically ignore files and directories in
35 `.gitignore` file(s), if present.
36
37 If you want _Black_ to continue using `.gitignore` while also configuring the exclusion
38 rules, please use `--extend-exclude`.