1
0
Fork 0
mirror of https://github.com/vbatts/git-validation.git synced 2024-12-28 08:16:31 +00:00
Commit graph

93 commits

Author SHA1 Message Date
Derek McGowan
742f9db7ae Add exclude pattern for git checks
Allows excluding of vendor directories for whitespace checks

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-04-26 14:29:57 -07:00
cf8d44cfd7 Merge pull request #20 from wking/replace-arg-order
main: Fix strings.Replace argument order
2017-03-21 18:20:26 -04:00
W. Trevor King
f94dce37d6 main: Fix strings.Replace argument order
It's (string, old, new, n), not (old, new, string, n) [1].  Fixes a
typo I'd introduced in cdd7165 (main: Return to using
TRAVIS_COMMIT_RANGE (with ... -> .. fix), 2017-03-21, #17).

[1]: https://golang.org/pkg/strings/#Replace

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-03-21 15:07:53 -07:00
4cee76b1df Merge pull request #17 from wking/test-merges-again
Test merges again and return to using TRAVIS_COMMIT_RANGE
2017-03-21 17:58:56 -04:00
fe12ea494a Merge pull request #19 from wking/log-failed-git-commands
git/commits: Log failed Git commands
2017-03-21 17:57:11 -04:00
af669a5d2b Merge pull request #18 from wking/dogfood
.travis.yml: Dogfood git-validation
2017-03-21 17:48:39 -04:00
W. Trevor King
5e1b04597c git/commits: Log failed Git commands
Before this commit:

  $ ./git-validation -run DCO -range HEAD^^..foo
  2017/03/21 13:00:30 exit status 128

With this commit:

  $ ./git-validation -run DCO -range HEAD^^..foo
  ERRO[0000] [git] cmd: "git --no-pager log --no-merges --pretty=format:%H HEAD^^..foo"
  2017/03/21 13:16:43 exit status 128

You can get similar output with -D, but folks are unlikely to set that
in production.  With the new error logs, Travis output and similar is
more likely to contain some useful information.

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-03-21 13:17:56 -07:00
W. Trevor King
2e3c157f4b .travis.yml: Dogfood git-validation
This makes it easier to test the script and avoids leaking dangling
whitespace, etc. into the repo.

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-03-21 12:27:53 -07:00
W. Trevor King
cdd7165f80 main: Return to using TRAVIS_COMMIT_RANGE (with ... -> .. fix)
Master builds only have a 'git clone ...' [1] so FETCH_HEAD isn't
defined and git-validation crashes [2].  This commit partially reverts
8a12a8fc (main: default travis commit range is unreliable, 2017-03-21,
#13) to avoid that crash.  If TRAVIS_COMMIT_RANGE is unset [3],
falling back to TRAVIS_COMMIT may be fine.

The ... -> .. replacement works around travis-ci/travis-ci#4596 until
that is fixed upstream [4].  This avoids pulling in commits from the
base tip that aren't reachable from the head tip (e.g. if master has
advanced since the PR branched off, and the PR is against master).  We
only want to check commits that are in the head branch but not in the
base branch (more details on the range syntax in [5]).

Once the Travis bug does get fixed, the shell replacement will be a
no-op.  So we don't have to worry about checks breaking once the bug
gets fixed, and can periodically poll the bug and remove the
workaround at out leisure after the fix.

[1]: https://travis-ci.org/opencontainers/runc/jobs/213508696#L243
[2]: https://travis-ci.org/opencontainers/runc/jobs/213508696#L347
[3]: https://github.com/opencontainers/runc/pull/1378#issuecomment-287903471
[4]: https://github.com/travis-ci/travis-ci/issues/4596
[5]: http://git-scm.com/docs/gitrevisions#_specifying_ranges

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-03-21 12:16:01 -07:00
W. Trevor King
a5aad5a99b git/commits: Test merge commits
Partially reverting ca825225 (git: do not include merges in the commit
range, 2017-03-21, #16).  I've kept the unrelated --no-pager addition
from that commit.

I think merges in the commit range should be checked against whatever
criteria the caller is asking for.  If the caller does not want to
check a machine-generated commit, they shouldn't include it in the
commit range.

And we already have special-cases for merges.  For example, we skip
DCO checks for merge commits.  I'd be happier without that special
case, because human-generated merge commits can still add novel code
(and therefore should have Signed-off-by), etc.  But I don't think we
want a blanket pass for merge commits.

Signed-off-by: W. Trevor King <wking@tremily.us>
2017-03-21 11:35:00 -07:00
9b7297d813 Merge pull request #16 from vbatts/no-merges
git: do not include merges in the commit range
2017-03-21 10:20:23 -04:00
ca8252252b
git: do not include merges in the commit range
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-03-21 10:13:01 -04:00
a23edf13d9 Merge pull request #15 from vbatts/fix_range_var
main: default travis commit range is unreliable
2017-03-21 09:49:53 -04:00
8a12a8fc7a
main: default travis commit range is unreliable
https://github.com/opencontainers/runc/pull/1378#issuecomment-287920287
points to an alternate approach.

Reported-by: Mrunal Patel <mrunalp@gmail.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-03-21 09:41:59 -04:00
3fd57e3bf5 Merge pull request #13 from wking/explicit-range-implies-no-travis
main: Explicit -range implies -no-travis
2017-01-27 09:34:07 -05:00
57e0595ad8 Merge pull request #14 from vbatts/go-version
travis: bump the golang versions
2017-01-27 09:33:33 -05:00
e0bc736c1c
travis: bump the golang versions
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-27 09:30:21 -05:00
W. Trevor King
0e135a4759 main: Explicit -range implies -no-travis
If someone went through the trouble to set -range, they probably don't
want you clobbering their value with something from a TRAVIS_*
environment variable.
2017-01-26 21:13:02 -08:00
206708c3bd Merge pull request #11 from vbatts/quiet_a_little_less
main: add a bit of output to -q
2016-05-03 15:26:23 -04:00
3bad322461 main: add a bit of output to -q
ideally `-q` would be only return code of 0 or non-zero, but it already
had some output. This adds only failed tests per commit.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-05-03 15:22:57 -04:00
8f67e735ee Merge pull request #12 from vbatts/travis_vet
travis: no need to get go vet
2016-05-03 15:22:17 -04:00
00bb98c063 travis: no need to get go vet
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-05-03 15:17:15 -04:00
be3aee9943 Merge pull request #10 from vbatts/no-pager
git: --no-page to curb this exit status 128
2016-04-06 13:41:53 -04:00
93700402a0 git: --no-page to curb this exit status 128
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-06 13:36:43 -04:00
39d22b3fd4 Merge pull request #9 from vbatts/show-check
whitespace: switch to cheaper check
2016-04-06 13:05:15 -04:00
3969e46e2b whitespace: switch to cheaper check
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-06 12:33:31 -04:00
8193a24bc4 dangling-whitespace: rule for trailing spaces
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 15:28:39 -04:00
1a447a0dfc git: fix corruption in field values
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 15:28:39 -04:00
3ff2ef6b70 travis: add build status to the README
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 15:28:38 -04:00
78001eac99 git: switch out the field names usage
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 15:28:38 -04:00
3ec88517cc git: restructured commit entries
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 15:28:38 -04:00
e3ba588c3a travis: adding checks for basic regressions
* go vet
* golint
* whether the tool builds
* tests (there are none yet)

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-04-05 15:28:38 -04:00
Jonathan Boulle
41062f1be2 *: fix typos and stuff
because that's what I do

Signed-off-by: Jonathan Boulle <jon.boulle@coreos.com>
2016-04-05 15:28:12 -04:00
769b4028a4 main: adding a quiet flag to reduce the output
so you can test and just check return code

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2016-01-14 10:29:35 -05:00
eba7575f7e README: information about rules
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-06 10:55:42 -04:00
09c2bd43dc README: more usage
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-06 10:51:22 -04:00
b243ca4770 README: adding install and usage
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-06 10:48:03 -04:00
d614ccf997 *: run tests in a runner
for cleanliness and ease of testing

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-06 10:44:04 -04:00
b9413c60c8 shortsubject: add a subject length check
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-05 19:02:31 -04:00
5e74abd1b2 *: comments and golint
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-05 18:55:05 -04:00
07a982ff94 git: add verbose output of the commands run
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-05 18:49:06 -04:00
03bda4bcb2 main: add filtering of rules to run
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-05 18:49:02 -04:00
c10ba9c097 Initial commit
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2015-10-05 18:48:23 -04:00