edisonywh / committee Goto Github PK
View Code? Open in Web Editor NEW️⚡️ Supercharged git hooks manager in pure Elixir
License: MIT License
️⚡️ Supercharged git hooks manager in pure Elixir
License: MIT License
Currently as it stands, mix committee.install
will override the existing hooks scripts, so it would be nice if we could back up the existing scripts also.
By backup, I'm just thinking maybe it's just renaming + prefixing the executables from pre-commit
to like old-pre-commit
, but any other ideas are also welcomed.
This would also allow for a nicer uninstallation process where it reverts the changes made by committee
#3
Relevant Elixir documentation for File.rename/2
A little oversight, but right now the installation script will check if commit.exs
exists, and if it does, stops the execution of installation.
However, this means that let's say in a team of 3, if one person in the team installed, commit.exs
will be git-tracked, now if it's pushed to repo and then the other two people pull it down, and try to run mix committee.install
again, they won't run the git hooks installation part, because commit.exs
exists.
Not quite sure what will be fix, maybe always run the git hooks installation? (but then this will override the backup). So ideally other team members should be able to run it.
Another idea I can think of is to create sort of like a "sentinel file". commit.exs
should be that, but that's not enough because it's git-tracked, which means I need a gitignored version of sentinel file. Maybe could create a file inside .git/hooks/committee.checksum
or something that acts as a sentinel, and run install if that file doesn't exist?
It'd be nice to have a way to get rid of Committee
. As it stands now, once you've ran mix committee.install
, you'd get the executables in .git/hooks
, however they'll remain there even if you remove committee
as a dependency. That's no good, so it'd be nice to have a way to remove all script generated by committee
.
Maybe as part of uninstallation, we could revert the backup (#4), that might be nice.
When you run a git hook, the Runner task works, your .commitee.exs
works, but then the message does not print out.
Relevant line in mix commitee.runner
, right here
Right now if a client has ran mix committee.install
, the .git/hooks
hooks will be installed for the supported hooks and those hooks scripts will just run a mix committee.runner #{hook_name}
.
Inside the runner file, it will attempt to compile the existing commit.exs
, however here's the issue, if commit.exs
file is deleted, git actions will fail now.
The fix is probably to just check if the file exists before compiling, if not then give a friendly warning message that it wasn't found and is running without one. If #3 happens also it would be nice to prompt user to run this task to cleanly uninstall Committee
It's possible to stop anyone comitting on master branch via git-hook.
How to do the same with committee ?
I think the file shouldn't be deleted but maybe moved to .committee.backup.exs
, we can add an option to committee.uninstall
like --delete
to delete the hooks file.
I did lost my hooks while testing them because before committing it I wanting to just deactivate committee by running mix committee.uninstall
.
From my point of you, a config file shouldn't be deleted while uninstalling/removing, instead it depends of the user to do it or not.
Maybe it's just me ^^
Thanks
I'd like to have a section on README that is basically just a compilation of different scripts, such as branch naming convention etc.
One good example might be to add one to show what packages are outdated with mix deps.outdated
, and can maybe even take it a step further and disallow commit if packages are outdated (can be done by chaining mix deps.update --all && git diff --exit-code
)
That's is a common pattern in elixir for config file, as we have for the formatter config been .formatter.exs
and credo config file been .credo.exs
. We could do the same thing on committee
. I think it also would avoid confusing because commit.exs
seems to be something really specific for pre/pos-commit hooks, and if we intend to add another types of hooks that name could be a little strange.
Downloaded it to another project and realised the path resolution was wrong (I've been testing with the Committee repo itself so did not realise it)
Hi,
I regularly use committee to help me with formatting, so I decided to have a go at updating the CI (I saw it is still using old elixir versions, with old source formatting).
It may be a minor change, but in case you want to have a look at it, I have a working workflow for elixir 1.12, 1.13 and 1.14 there.
I also changed my default branch to main, but I am not sure if it is something you'd want to do here ?
Anyway, let me know if you want a specific PR related to some of these changes in this repo.
Cheers !
Well yes it's a shame, but I'm going to get to it...
Would definitely appreciate any ideas about testing though!
https://github.com/edisonywh/committee/pull/21/checks?check_run_id=275629230
The function Code.compile_file/1
does not work at elixir 1.6 as it was only introduced at version 1.7, but that seems to be our version requirement. Should we bump the required to elixir 1.7?
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.