Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-commit hook doesn't work with custom dart/flutter executable locations #41

Open
lig opened this issue Dec 28, 2020 · 3 comments
Open
Labels
bug Something isn't working

Comments

@lig
Copy link
Contributor

lig commented Dec 28, 2020

At the moment, the pre-commit hook definition expects dart/flutter executables to be accessible in the search path.

However, it is a common practice to install several channels on the same machine and use different executable names for them. i.e. flutter-stable, dart-beta, etc.

It is possible to implement a hook that takes an executable name/path as an argument in the args parameter, see https://pre-commit.com/#passing-arguments-to-hooks. However, this requires transforming the definition in the script type and using an additional script that would construct the corresponding command to execute. The problem is we cannot just use bash for this as Windows users won't be able to use it.

@lig lig added the bug Something isn't working label Dec 28, 2020
@lig
Copy link
Contributor Author

lig commented Dec 28, 2020

Another option is to use python hook type as a wrapper. From the pre-commit docs: Support: python hooks work without any system-level dependencies. It has been tested on linux, macOS, windows, and cygwin. https://pre-commit.com/#python

A simple python script will work on any platform and it is easy enough to parse arguments and invoke the proper command from it.

@lig
Copy link
Contributor Author

lig commented Dec 28, 2020

Well, according to the docs the entire repo must be installable as a python package. This will require some additional files in the repo root. Seems a bit inconvenient.

@gleich
Copy link
Member

gleich commented Dec 7, 2021

See #63

@gleich gleich closed this as completed Dec 7, 2021
@gleich gleich reopened this Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants