import_sorter
import_sorter copied to clipboard
Pre-commit now throws a warning when targeting a specific branch
Describe the bug
When running pre-commit with this config:
repos:
- repo: https://github.com/fluttercommunity/import_sorter
rev: "master"
hooks:
- id: flutter-import-sorter
A warning is thrown:
[WARNING] The 'rev' field of repo 'https://github.com/fluttercommunity/import_sorter' appears to be a mutable reference (moving tag / branch). Mutable references are never updated after first install and are not supported. See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.
Expected behavior
I would like a tag to be added to GitHub which I can reference in my pre-commit config.
Meta Information:
- Dart Version: 2.10.5
import_sorterVersion: master- Is it a Flutter project? Yes
- What version of Flutter are you using (if flutter project): 1.22.6
👋 Hello! Thanks for submitting a issue! @Matt-Gleich will try to respond as soon as possible.
@lig any idea why this might be going on?
@Matt-Gleich I'll try to look into this a bit later
So, according to pre-commit docs, this is by pre-commit design for mutable git references, aka branch references.
@Matt-Gleich Using tags in the import_sorter repo would be beneficial for pre-commit hooks as it will allow using tags instead of the master reference in pre-commit configs.
@ptrbrynt as a workaround, I recommend following pre-commit docs advice and use --bleeding-edge argument for pre-commit autoupdate, i.e.
pre-commit autoupdate --bleeding-edge --repo https://github.com/fluttercommunity/import_sorter
This should point the revision to the latest commit hash in master instead of referencing master by mutable named reference.
See #63