Using pypyr to write pre-commit hooks? (instead of bash, for example) #283
Replies: 4 comments
-
yep, you certainly can use a pypyr pipeline here. I would be a bit hesitant to reinvent the wheel, though, given all the readymade/pluggable pre-commit hooks you can get via https://pre-commit.com But yes, of course, if you have something that you think isn't well-served by the existing ecosystem - I dunno, maybe a more complex sequence of steps, you can of course pop that into a pypyr pipeline and then have your Same principle if you're wanting to do custom python instead - just put the python shebang on top of the |
Beta Was this translation helpful? Give feedback.
-
(fun fact: I'm an amatuer bicyle mechanic. I love wheels)
... what I was getting at was that Robert has written some pre commit hooks
which do linting and they are implemented in bash/grep/awk, so it would
seem more portable to write them in python and then us pypyr to run the
steps and return results to `pre-commit`.
…On Sun, Jul 3, 2022 at 8:38 AM thomas ***@***.***> wrote:
yep, you certainly can use a pypyr pipeline here.
I would be a *bit* hesitant to reinvent the wheel, though, given all the
readymade/pluggable pre-commit hooks you can get via
https://pre-commit.com
But yes, of course, if you have something that you think isn't well-served
by the existing ecosystem - I dunno, maybe a more complex sequence of
steps, you can of course pop that into a pypyr pipeline and then have your
.git/hooks-precommit just invoke pypyr ops/my-precommit-pipeline!
—
Reply to this email directly, view it on GitHub
<#283 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AW5DD3XL7IUIRXEWQEMALTDVSGCVRANCNFSM52LKH6IA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Fixing wheels more so than re-inventing them, I hope 😆 😉 Yeah, I got you, it would be more portable, but I'm guessing it'll prob be quite a bit slower to do the parsing in python. 🤔 Added, slower is a relative term - if it still gets done <1s then the operator won't notice. |
Beta Was this translation helpful? Give feedback.
-
For yaml files it might also be an idea to use an actual yaml linter, rather than trying awkwardly to In this case pypyr would be ideal - have a pipeline that run all the various linters in sequence, one of which would be the yaml linter. |
Beta Was this translation helpful? Give feedback.
-
I'm writing a lot of Ansible and when I discovered
https://github.com/robertdebock/pre-commit/blob/master/ansible_role_find_unquoted_values.sh
I loved the pre-commit hooks, but I wonder if they might be better to write in pypr...
if not straight up python?
Beta Was this translation helpful? Give feedback.
All reactions