From 7746142d974a6ce270461f634d44296683a01e0e Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 1 Feb 2022 14:25:37 -0800 Subject: [PATCH] ci: add codespell job, fix existing warnings The following warnings were fixed: ./variant.go:52: unambigously ==> unambiguously ./conn.go:172: useable ==> usable ./dbus_test.go:32: parm ==> param, pram, parma ./dbus_test.go:42: parm ==> param, pram, parma ./dbus_test.go:42: parm ==> param, pram, parma ./dbus_test.go:44: parm ==> param, pram, parma ./encoder_test.go:268: occured ==> occurred ./encoder_test.go:315: occured ==> occurred ./object_test.go:111: Catched ==> Caught ./sequential_handler_test.go:235: occured ==> occurred ./server_interfaces.go:66: incase ==> in case ./introspect/introspect.go:53: retured ==> returned Signed-off-by: Kir Kolyshkin --- .github/workflows/test.yml | 10 ++++++++++ conn.go | 2 +- dbus_test.go | 6 +++--- encoder_test.go | 4 ++-- introspect/introspect.go | 2 +- object_test.go | 2 +- sequential_handler_test.go | 2 +- server_interfaces.go | 2 +- variant.go | 2 +- 9 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b0deaf75..6aec30d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,3 +35,13 @@ jobs: - name: Test run: go test ${{ matrix.race }} -v ./... + + 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 diff --git a/conn.go b/conn.go index 1a92b8bf..69bfb50f 100644 --- a/conn.go +++ b/conn.go @@ -169,7 +169,7 @@ func Connect(address string, opts ...ConnOption) (*Conn, error) { // SystemBusPrivate returns a new private connection to the system bus. // Note: this connection is not ready to use. One must perform Auth and Hello -// on the connection before it is useable. +// on the connection before it is usable. func SystemBusPrivate(opts ...ConnOption) (*Conn, error) { return Dial(getSystemBusPlatformAddress(), opts...) } diff --git a/dbus_test.go b/dbus_test.go index 10060014..18c7f63b 100644 --- a/dbus_test.go +++ b/dbus_test.go @@ -29,7 +29,7 @@ func Test_VariantOfSlicePtr(t *testing.T) { value := []TestStruct{{1, "1"}} dest := []*TestStruct{} - parm := &Message{ + param := &Message{ Type: TypeMethodCall, Flags: FlagNoAutoStart, Headers: map[HeaderField]Variant{ @@ -39,9 +39,9 @@ func Test_VariantOfSlicePtr(t *testing.T) { }, Body: []interface{}{value}, } - parm.Headers[FieldSignature] = MakeVariant(SignatureOf(parm.Body...)) + param.Headers[FieldSignature] = MakeVariant(SignatureOf(param.Body...)) buf := new(bytes.Buffer) - err := parm.EncodeTo(buf, nativeEndian) + err := param.EncodeTo(buf, nativeEndian) if err != nil { t.Fatal(err) } diff --git a/encoder_test.go b/encoder_test.go index c38b7e04..ae3c3275 100644 --- a/encoder_test.go +++ b/encoder_test.go @@ -265,7 +265,7 @@ func TestEncodeIntToNonCovertible(t *testing.T) { err = Store(v, &out) if err == nil { t.Logf("%t\n", out) - t.Fatal("Type mismatch should have occured") + t.Fatal("Type mismatch should have occurred") } } @@ -312,7 +312,7 @@ func TestEncodeUintToNonCovertible(t *testing.T) { var out bool err = Store(v, &out) if err == nil { - t.Fatal("Type mismatch should have occured") + t.Fatal("Type mismatch should have occurred") } } diff --git a/introspect/introspect.go b/introspect/introspect.go index b06c3f1c..8ee61055 100644 --- a/introspect/introspect.go +++ b/introspect/introspect.go @@ -50,7 +50,7 @@ type Interface struct { Annotations []Annotation `xml:"annotation"` } -// Method describes a Method on an Interface as retured by an introspection. +// Method describes a Method on an Interface as returned by an introspection. type Method struct { Name string `xml:"name,attr"` Args []Arg `xml:"arg"` diff --git a/object_test.go b/object_test.go index f1753c96..1e9ba1f5 100644 --- a/object_test.go +++ b/object_test.go @@ -108,7 +108,7 @@ func TestObjectSignalHandling(t *testing.T) { go func() { defer func() { if err := recover(); err != nil { - t.Errorf("Catched panic in emitter goroutine: %v", err) + t.Errorf("Caught panic in emitter goroutine: %v", err) } }() diff --git a/sequential_handler_test.go b/sequential_handler_test.go index 3adc52d7..3a2d36aa 100644 --- a/sequential_handler_test.go +++ b/sequential_handler_test.go @@ -232,7 +232,7 @@ func readSignals(t *testing.T, channel <-chan *Signal, count int) error { return fmt.Errorf("Received signal out of order. Expected %v, got %v", i, signal.Sequence) } case <-ctx.Done(): - return errors.New("Timeout occured before all messages received") + return errors.New("Timeout occurred before all messages received") } } return nil diff --git a/server_interfaces.go b/server_interfaces.go index 79d97edf..e4e0389f 100644 --- a/server_interfaces.go +++ b/server_interfaces.go @@ -63,7 +63,7 @@ type Method interface { // any other decoding scheme. type ArgumentDecoder interface { // To decode the arguments of a method the sender and message are - // provided incase the semantics of the implementer provides access + // provided in case the semantics of the implementer provides access // to these as part of the method invocation. DecodeArguments(conn *Conn, sender string, msg *Message, args []interface{}) ([]interface{}, error) } diff --git a/variant.go b/variant.go index f1e81f3e..ca3dbe16 100644 --- a/variant.go +++ b/variant.go @@ -49,7 +49,7 @@ func ParseVariant(s string, sig Signature) (Variant, error) { } // format returns a formatted version of v and whether this string can be parsed -// unambigously. +// unambiguously. func (v Variant) format() (string, bool) { switch v.sig.str[0] { case 'b', 'i':