Skip to content

Commit

Permalink
CI/GHA: add codespell check, fix typos found
Browse files Browse the repository at this point in the history
1. Fix a few typos found by codespell:

./seccomp_internal.go:820: reponse ==> response
./seccomp.go:267: notication ==> notification
./seccomp_test.go:19: statment ==> statement
./seccomp_test.go:140: nonexistant ==> nonexistent
./seccomp_test.go:363: nonexistant ==> nonexistent
./seccomp_test.go:366: nonexistant ==> nonexistent
./seccomp_test.go:423: correcly ==> correctly

2. Add a CI job to ensure that future PRs won't add typos (at least
   those that that are known to codespell).

Signed-off-by: Kir Kolyshkin <[email protected]>
Acked-by: Paul Moore <[email protected]>
Signed-off-by: Tom Hromatka <[email protected]>
  • Loading branch information
kolyshkin authored and drakenclimber committed Sep 24, 2021
1 parent 0bfc29a commit 4a0a385
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ jobs:
# must be specified without patch version
version: v1.41


codespell:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: install deps
# Version of codespell bundled with Ubuntu is way old, so use pip.
run: pip install codespell
- name: run codespell
run: codespell
2 changes: 1 addition & 1 deletion seccomp.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const (
// Userspace notification response flags

// NotifRespFlagContinue tells the kernel to continue executing the system
// call that triggered the notification. Must only be used when the notication
// call that triggered the notification. Must only be used when the notification
// response's error is 0.
NotifRespFlagContinue uint32 = 1
)
Expand Down
2 changes: 1 addition & 1 deletion seccomp_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ func notifRespond(fd ScmpFd, scmpResp *ScmpNotifResp) error {
return err
}

// we only use the reponse here; the request is discarded
// we only use the response here; the request is discarded
if retCode := C.seccomp_notify_alloc(&req, &resp); retCode != 0 {
return errRc(retCode)
}
Expand Down
10 changes: 5 additions & 5 deletions seccomp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

// execInSubprocess calls the go test binary again for the same test.
// This must be only top-level statment in the test function. Do not nest this.
// This must be only top-level statement in the test function. Do not nest this.
// It will slightly defect the test log output as the test is entered twice
func execInSubprocess(t *testing.T, f func(t *testing.T)) {
const subprocessEnvKey = `GO_SUBPROCESS_KEY`
Expand Down Expand Up @@ -137,7 +137,7 @@ func TestSyscallGetName(t *testing.T) {

_, err = callFail.GetName()
if err == nil {
t.Errorf("Getting nonexistant syscall should error!")
t.Errorf("Getting nonexistent syscall should error!")
}
}

Expand Down Expand Up @@ -360,10 +360,10 @@ func TestFilterArchFunctions(t *testing.T) {
t.Errorf("Arch not added to filter is present")
}

// Try removing the nonexistant arch - should succeed
// Try removing the nonexistent arch - should succeed
err = filter.RemoveArch(prospectiveArch)
if err != nil {
t.Errorf("Error removing nonexistant arch: %s", err)
t.Errorf("Error removing nonexistent arch: %s", err)
}

// Add an arch, see if it's in the filter
Expand Down Expand Up @@ -420,7 +420,7 @@ func TestFilterAttributeGettersAndSetters(t *testing.T) {
if err != nil {
t.Errorf("Error getting bad arch action")
} else if act != ActAllow {
t.Errorf("Bad arch action was not set correcly!")
t.Errorf("Bad arch action was not set correctly!")
}

err = filter.SetNoNewPrivsBit(false)
Expand Down

0 comments on commit 4a0a385

Please sign in to comment.