fluttercommunity / import_sorter

🎯 Automatically organize your dart imports. Maintainer: @gleich
https://pub.dev/packages/import_sorter
MIT License
169 stars 40 forks source link

Pre-commit now throws a warning when targeting a specific branch #45

Open ptrbrynt opened 3 years ago

ptrbrynt commented 3 years ago

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:

github-actions[bot] commented 3 years ago

👋 Hello! Thanks for submitting a issue! @Matt-Gleich will try to respond as soon as possible.

gleich commented 3 years ago

@lig any idea why this might be going on?

lig commented 3 years ago

@Matt-Gleich I'll try to look into this a bit later

lig commented 3 years ago

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.

gleich commented 2 years ago

See #63