scop / pre-commit-shfmt Goto Github PK
View Code? Open in Web Editor NEWshfmt hook for pre-commit, with auto install
shfmt hook for pre-commit, with auto install
I want to use shfmt’s --func-next-line
option with one of these hooks. My pre-commit config used to look like this:
-
repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-1
hooks:
-
id: shfmt
args: ["-fn"]
Once I updated to v3.7.0-2, it started giving me these errors:
shfmt....................................................................Failed
- hook id: shfmt
- exit code: 2
flag provided but not defined: -fn
Usage of /home/jayman/.cache/pre-commit/repoqk0av65h/py_env-python3.11/bin/wrun:
-http-timeout duration
HTTP client timeout (default 5m0s)
-url value
[<OS>/<architecture>=]URL (at least one required to match)
wrun: ERROR: parse flags: flag provided but not defined: -fn
flag provided but not defined: -fn
Usage of /home/jayman/.cache/pre-commit/repoqk0av65h/py_env-python3.11/bin/wrun:
-http-timeout duration
HTTP client timeout (default 5m0s)
-url value
[<OS>/<architecture>=]URL (at least one required to match)
wrun: ERROR: parse flags: flag provided but not defined: -fn
I think that this is a result of 286f22a (feat: use prebuilt upstream exe in shfmt
, src install in shfmt-src
, 2023-11-13). I was able to work around this issue by switching to the shfmt-docker
hook.
See https://results.pre-commit.ci/run/github/114006193/1699907034.povI7ysrT0KE7N6-XDqIXA
shfmt....................................................................Failed
- hook id: shfmt
- exit code: 1
wrun: ERROR: get https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_amd64#0264c424278b18e22453fe523ec01a19805ce3b8ebf18eaf3aadc1edc23f42e3: Get "https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_amd64#0264c424278b18e22453fe523ec01a19805ce3b8ebf18eaf3aadc1edc23f42e3": dial tcp: lookup github.com on [::1]:53: read udp [::1]:42344->[::1]:53: read: connection refused
wrun: ERROR: get https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_amd64#0264c424278b18e22453fe523ec01a19805ce3b8ebf18eaf3aadc1edc23f42e3: Get "https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_amd64#0264c424278b18e22453fe523ec01a19805ce3b8ebf18eaf3aadc1edc23f42e3": dial tcp: lookup github.com on [::1]:53: read udp [::1]:33573->[::1]:53: read: connection refused
Sometimes the hook fails with output like this:
shfmt....................................................................Failed
- hook id: shfmt
- duration: 0.01s
- exit code: 1
wrun: ERROR: prepare hash: invalid fragment format, use hashAlgo-hexDigest
wrun: ERROR: prepare hash: invalid fragment format, use hashAlgo-hexDigest
Error: Process completed with exit code 1.
There is no information on what files these errors originated with, making it impossible to debug deeper. Running hook with verbose: true
does not provided additional output.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.