Skip to content

server-side support? #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aspiers opened this issue Dec 12, 2016 · 4 comments
Closed

server-side support? #19

aspiers opened this issue Dec 12, 2016 · 4 comments

Comments

@aspiers
Copy link

aspiers commented Dec 12, 2016

It's great having client-side validation, but let's face it some developers will simply forget or be too lazy to set it up, and then they'll submit bad commits for review regardless. So ideally there should be a way to enforce validation server-side. Of course the implementation depends on the server in question, but GitHub might be a good place to start. For example might it be possible to create a GitHub third-party service which runs gitlint server-side whenever a PR is submitted / updated, and then updates a status check on the PR accordingly?

See also codeclimate/spec#45 (allow analysis of commit messages)

@jorisroovers
Copy link
Owner

Well, gitlint already supports this if you have a check job in e.g. jenkins, travis or whatever CI system. Just run the gitlint command on any git repository to check the latest commit message. Alternatively, pipe any commit message into gitlint for it to validate it: git log -1 --pretty=%B | gitlint. See the docs for more details: http://jorisroovers.github.io/gitlint/

Additionally gitlint validates itself on every commit already, see here: https://github.com/jorisroovers/gitlint/blob/master/run_tests.sh#L107-L113. We run this check in travis for every PR or commit.

If you mean you want support for gitlint installing server-side git hooks, that's not something I have experience with but can explore in the future. In my opinion, gitlint does already support most of what you're looking for though.

@aspiers
Copy link
Author

aspiers commented Dec 13, 2016

D'oh! I don't know why it didn't occur to me that gitlint could simply be installed and run as part of a custom CI job ... yes, of course that will work fine :) For example since Travis uses git to checkout the code under test, all the git metadata is present including the commit message. The only minor challenge is figuring out which commits are part of the PR without already being merged upstream, but this should be as easy as HEAD@{1}..HEAD or similar.

Server-side git hooks would of course work in the case where you have control over the server, but this doesn't apply for hosted services.

But yes, I think this can be closed. Thanks, and sorry for the noise ;-)

@jorisroovers
Copy link
Owner

No worries, thanks for the interest!

FYI that I've started work on the next release that will bring user-defined rules, proper unicode support and bugfixes. ETA: end of year.

@aspiers
Copy link
Author

aspiers commented Dec 13, 2016

Sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants