Today, one of the most annoying parts of my workfl...
# contributing-to-airbyte
d
Today, one of the most annoying parts of my workflow is remembering to run
./gradlew format
before pushing a change. Do other people feel the same way? How would people feel if Github did this for us?
u
e.g. For PR, Github automatically formats and commits any differences it finds
u
I always forget to run, whats about using
pre-commit
?
u
maybe. format takes a while to run (40 sec - 1 min) so it might be heavy if it's a pre-commit hook before every commit
u
that's why I'm leaning more towards a github action thing
u
however want to get people's opinion in case others don't think this is worth spending time on
u
It’s way too long as a hook
u
yeah. my current germinating idea is currently some sort of action that commits formatting changes to the branch on a push (if there are any). the only change to the local dev workflow is having to pull/merge before the next commit to grab formatting changes. still noodling
u
I suppose the 40 sec - 1 min format run is for the entire codebase, right? Can the pre-commit hook just run for the changed files to be committed?
u
Incremental formatting would help a lot.
u
Liren - possible. Haven’t looked in depth
u
Jared you meant incremental via gradle?
u
yeah
u
like if this command took like 1 second
u
it’d be fine as a hook
u
the formatting we use should be able to only look at the files which changed compare to a base
u
there is an option in the plugin
u
Looks like there is no exact option to format code just for changed files. But
ratchetFrom
is pretty close. Here is an issue with some candidate solutions: https://github.com/diffplug/spotless/issues/178
u
I can take care of this after May 7th, if it is not resolved sooner.