]> git.madduck.net Git - etc/vim.git/commitdiff

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:

Remove `language_version` for pre-commit (#2430)
authorAneesh Agrawal <aneeshusa@gmail.com>
Wed, 18 Aug 2021 16:24:14 +0000 (09:24 -0700)
committerGitHub <noreply@github.com>
Wed, 18 Aug 2021 16:24:14 +0000 (12:24 -0400)
* Remove `language_version` for pre-commit

At my company, we set the Python version in `default_language_version`
in each repo's `.pre-commit-config.yaml`,
so that all hooks are running with the same Python version.

However, this currently doesn't work for black,
as the `language_version` specified here
in the upstream `.pre-commit-hooks.yaml` takes precedence.
Currently, this requires us to manually set `language_version`
specifically for black,
duplicating the value from `default_language_version`.
The failure mode otherwise is subtle -
black works most of the time,
but try to add a walrus operator and it suddenly breaks!

Given that black's `setup.py` already has `python_requires>=3.6.2`,
specifying that `python3` must be used here isn't needed
as folks inadvertently using Python 2 will get hook-install-time failures anyways.
Remove the `language_version` from these upstream hook configs
so that users of black are able to use `default_language_version`
and have it apply to all their hooks, black included.

Example `.pre-commit-config.yaml` before:
```
default_language_version:
  python: python3.8
repos:
-   repo: https://github.com/psf/black
    rev: 21.7b0
    hooks:
    -   id: black
        language_version: python3.8
```

After:
```
default_language_version:
  python: python3.8
repos:
-   repo: https://github.com/psf/black
    rev: 21.7b0
    hooks:
    -   id: black
```

* Add changelog entry

.pre-commit-hooks.yaml
CHANGES.md

index 81848d7dcf73043bad53457b28b7ba03c355f10e..137957045a6c938eec1408ca9af8ba47d59f4caa 100644 (file)
@@ -3,7 +3,6 @@
   description: "Black: The uncompromising Python code formatter"
   entry: black
   language: python
-  language_version: python3
   minimum_pre_commit_version: 2.9.2
   require_serial: true
   types_or: [python, pyi]
@@ -13,7 +12,6 @@
     "Black: The uncompromising Python code formatter (with Jupyter Notebook support)"
   entry: black
   language: python
-  language_version: python3
   minimum_pre_commit_version: 2.9.2
   require_serial: true
   types_or: [python, pyi, jupyter]
index a678aaefc2acf1f027bc86db1086def322297003..a4b8e01fb93a8f651c18caed7e1a02e5aee372bf 100644 (file)
@@ -7,6 +7,11 @@
 - Add support for formatting Jupyter Notebook files (#2357)
 - Move from `appdirs` dependency to `platformdirs` (#2375)
 
+### Integrations
+
+- The provided pre-commit hooks no longer specify `language_version` to avoid overriding
+  `default_language_version` (#2430)
+
 ## 21.7b0
 
 ### _Black_