20201103 no commit title check (#12447)

* Turn off checking of format of commit message.

* scripts/fix.sh: Fix fixing whitespaces in *.sh scripts

Aparently there is a difference between:
  find ./ -print0 -name *.sh and
  find ./ -name *.sh -print0

* etcdserver unit tests: Do not call .Fatalf(...) from not test's goroutine.

Fixes following test failures:
https://travis-ci.com/github/etcd-io/etcd/jobs/425920416
```
% (cd server && go vet ./...)
stderr: # go.etcd.io/etcd/server/v3/etcdserver
stderr: etcdserver/server_test.go:1002:4: call to (*T).Fatalf from a non-test goroutine
stderr: etcdserver/server_test.go:1166:4: call to (*T).Fatalf from a non-test goroutine
FAIL: (code:2):
  % (cd server && go vet ./...)
FAIL: 'run go vet ./...' checking failed (!=0 return code)
FAIL: 'govet' failed at Tue Nov  3 04:07:47 UTC 2020
```
release-3.5
Piotr Tabor 2020-11-03 16:59:42 +01:00 committed by GitHub
parent 64e048bea9
commit 6e800b9b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 31 deletions

View File

@ -13,8 +13,8 @@ function mod_tidy_fix {
function bash_ws_fix {
log_callout "Fixing whitespaces in the bash scripts"
# Makes sure all bash scripts do use ' ' (double space) for indention.
log_cmd "% find ./ -name '*.sh' | xargs sed --follow-symlinks -i 's|\t| |g'"
find ./ -print0 -name '*.sh' | xargs -0 sed --follow-symlinks -i 's|\t| |g'
log_cmd "find ./ -name '*.sh' -print0 | xargs -0 sed --follow-symlinks -i 's|\t| |g'"
find ./ -name '*.sh' -print0 | xargs -0 sed --follow-symlinks -i 's|\t| |g'
}
log_callout -e "\nFixing etcd code for you...\n"

View File

@ -999,7 +999,8 @@ func TestSnapshot(t *testing.T) {
defer func() { ch <- struct{}{} }()
if len(gaction) != 2 {
t.Fatalf("len(action) = %d, want 2", len(gaction))
t.Errorf("len(action) = %d, want 2", len(gaction))
return
}
if !reflect.DeepEqual(gaction[0], testutil.Action{Name: "SaveSnap"}) {
t.Errorf("action = %s, want SaveSnap", gaction[0])
@ -1156,6 +1157,7 @@ func TestTriggerSnap(t *testing.T) {
donec := make(chan struct{})
go func() {
defer close(donec)
wcnt := 3 + snapc
gaction, _ := p.Wait(wcnt)
@ -1163,9 +1165,9 @@ func TestTriggerSnap(t *testing.T) {
// (SnapshotCount+1) * Puts + SaveSnap = (SnapshotCount+1) * Save + SaveSnap + Release
if len(gaction) != wcnt {
t.Logf("gaction: %v", gaction)
t.Fatalf("len(action) = %d, want %d", len(gaction), wcnt)
t.Errorf("len(action) = %d, want %d", len(gaction), wcnt)
return
}
if !reflect.DeepEqual(gaction[wcnt-2], testutil.Action{Name: "SaveSnap"}) {
t.Errorf("action = %s, want SaveSnap", gaction[wcnt-2])
}
@ -1173,7 +1175,6 @@ func TestTriggerSnap(t *testing.T) {
if !reflect.DeepEqual(gaction[wcnt-1], testutil.Action{Name: "Release"}) {
t.Errorf("action = %s, want Release", gaction[wcnt-1])
}
close(donec)
}()
for i := 0; i < snapc+1; i++ {

25
test
View File

@ -303,7 +303,6 @@ function fmt_pass {
revive \
license_header \
receiver_name \
commit_title \
mod_tidy \
dep \
shellcheck \
@ -421,30 +420,6 @@ function receiver_name_pass {
run_for_modules receiver_name_for_package
}
function commit_title_pass {
git log --oneline "$(git merge-base HEAD master)"...HEAD | while read -r l; do
commitMsg=$(echo "$l" | cut -f2- -d' ')
if [[ "$commitMsg" == Merge* ]]; then
# ignore "Merge pull" commits
continue
fi
if [[ "$commitMsg" == Revert* ]]; then
# ignore revert commits
continue
fi
pkgPrefix=$(echo "$commitMsg" | cut -f1 -d':')
spaceCommas=$(echo "$commitMsg" | sed 's/ /\n/g' | grep -c ',$' || echo 0)
commaSpaces=$(echo "$commitMsg" | sed 's/,/\n/g' | grep -c '^ ' || echo 0)
if [[ $(echo "$commitMsg" | grep -c ":..*") == 0 || "$commitMsg" == "$pkgPrefix" || "$spaceCommas" != "$commaSpaces" ]]; then
log_error "$l"...
log_error "Expected commit title format '<package>{\", \"<package>}: <description>'"
log_error "Got: $l"
return 255
fi
done
}
# goword_for_package package
# checks spelling and comments in the 'package' in the current module
#