Live data from Hacker News

Show HN: GitCop – Automated Commit Message Validation for GitHub Pull Requests

gitcop.com

21–29 of 29 posts

Re: Show HN: GitCop – Automated Commit Message Validation for GitHub Pull Requests

#21
post #19

Have you thought about opening this up for more than just commit messages? Many projects need to check a number of things on PRs, e.g. enforce coding style, bugfix has a corresponding test, user signed the CLA, owner of %{scope} is notified for review, etc. That would obviously need a way to tie into external/custom tools as everybody validates these things differently.

Thanks for the ideas. I think there are several avenues that could be explored with this. I wanted to stay away from explicitly checking the code initially, as there are other tools aimed at that specific task, however there is no reason something like this couldn't be added into GitCop at a later date. I had the idea of checking that the user exists in a list of users by specifying a JSON list of users. This means t…

I think what I was aiming at is integration with other tools, rather than adding those checks directly into GitCop (as you said, there are already services that check code, validate CLA etc).

Or maybe provide me with a Travis-like sandbox where I can run my checks with whatever linter/validator/custom code I want and report the results back?

Just fleshing out some ideas here :)

Re: Show HN: GitCop – Automated Commit Message Validation for GitHub Pull Requests

#22
It's a very nice idea, but the validation rules are extremely limited.

Perhaps I'm wrong, but all of the rule options on the site look like they could have been implemented via regular expressions. Given the technical expertise of your intended customers, why not allow them to set a list of rules in the format: [regex, error-message], e.g.

    "^.{0,50}\n"         "The subject should be 50 characters or under"
    "^.+\n(.{0,72}\n)*$" "The body should have lines of 72 characters or under"
    "^\p{Upper}"         "The subject should be capitalized"

Re: Show HN: GitCop – Automated Commit Message Validation for GitHub Pull Requests

#23
post #9

Earlier quoted context omitted.

A git hook would certainly work for this as you described and I would certainly encourage people to investigate that route if it is appropriate for them. http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks The goal for GitCop is to be fast and easy to set up in a way that integrates well into a GitHub pull request based flow.

By that point isn't it too late? Or do you expect people to commit --amend and force push?

I think that's a key point, the earlier you can catch the problem the less frustrating for both sides. There is https://www.npmjs.org/package/commitplease for commit hooks but it's still handy to have something audit pull requests.

Re: Show HN: GitCop – Automated Commit Message Validation for GitHub Pull Requests

#26
After the PR is opened is too late to warn about commit messages. They can't be changed without a destructive push to the remote, which is generally a no-no for a public branch, and when using github, closes the PR automatically. The correct place to do this is, I believe, in the `commit-msg` hook: http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

Re: Show HN: GitCop – Automated Commit Message Validation for GitHub Pull Requests

#27

It's a very nice idea, but the validation rules are extremely limited. Perhaps I'm wrong, but all of the rule options on the site look like they could have been implemented via regular expressions. Given the technical expertise of your intended customers, why not allow them to set a list of rules in the format: [regex, error-message], e.g. "^.{0,50}\n" "The subject should be 50 characters or under" "^.+\n(.{0,72}\n)*…

I think doing it like that is a neat idea. Perhaps there could be an "advanced" page which is as you describe and the current method could be the "simple" version?

Re: Show HN: GitCop – Automated Commit Message Validation for GitHub Pull Requests

#28
post #9

Earlier quoted context omitted.

A git hook would certainly work for this as you described and I would certainly encourage people to investigate that route if it is appropriate for them. http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks The goal for GitCop is to be fast and easy to set up in a way that integrates well into a GitHub pull request based flow.

By that point isn't it too late? Or do you expect people to commit --amend and force push?

It is common in many flows to expect people to do a force push if something is wrong with their pull request, e.g. having 15 commits that look like:

    Try stuff
    Another prototype
    Fix something
    ...
    Revert prototype
It is fairly common (in my experience) for the contributor to be asked to squash those commits.

In my opinion, the more guards in place the better.

Re: Show HN: GitCop – Automated Commit Message Validation for GitHub Pull Requests

#29
post #6

I'd love it if you could make this work with Atlassian Stash behind a firewall.

Stash has a number of integration points where similar checks could be applied, the most similar to GitCop being a merge check. That said, a pre-receive hook would make a lot more sense.

Disclosure: I work for Atlassian

Post reply on HN