1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-07-01 00:25:00 +02:00

style: Fix staticcheck (static analysis) errors for this library (#283)

* style: Fix staticcheck errors for "error strings should not be capitalized (ST1005)"

staticcheck is a static analysis tool for go.
It reports several "error strings should not be capitalized (ST1005)" messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280

* style: Fix staticcheck errors for "printf-style function with dynamic format ... (SA1006)"

staticcheck is a static analysis tool for go.
It reports several "printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)" messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280

* style: Fix staticcheck errors for "type X is unused (U1000)"

staticcheck is a static analysis tool for go.
It reports several "type X is unused (U1000)" messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280

* style: Fix staticcheck errors for "should use X instead (S1003 & SA6005)"

staticcheck is a static analysis tool for go.
It reports several

- should use !bytes.Contains(b, []byte(`"password":"bar"`)) instead (S1003)
- should use strings.EqualFold instead (SA6005)

messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280

* style: Fix staticcheck errors for "unnecessary use of fmt.Sprintf (S1039)"

staticcheck is a static analysis tool for go.
It report several "unnecessary use of fmt.Sprintf (S1039)" messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280

* style: Fix staticcheck errors for "this value of X is never used (SA4006)"

staticcheck is a static analysis tool for go.
It report several "this value of X is never used (SA4006)" messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280

* style: Fix staticcheck errors for "redundant return statement (S1023)"

staticcheck is a static analysis tool for go.
It report several "redundant return statement (S1023)" messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280

* style: Fix staticcheck errors for "possible nil pointer dereference (SA5011)"

staticcheck is a static analysis tool for go.
It report several

    file.go:Line:character: possible nil pointer dereference (SA5011)
        file.go:Line:character: this check suggests that the pointer can be nil

messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280

* style: Fix staticcheck errors for "this value of X is never used (SA4006)"

staticcheck is a static analysis tool for go.
It report several "this value of X is never used (SA4006)" messages.
Here, we fix it to be more compliant with the go coding styleguide.

Related: #280
This commit is contained in:
Andy Grunwald
2020-05-02 23:08:01 +02:00
committed by GitHub
parent c357b61a40
commit 43e8242f2c
20 changed files with 100 additions and 96 deletions

View File

@ -19,10 +19,10 @@ func TestAuthenticationService_AcquireSessionCookie_Failure(t *testing.T) {
if err != nil {
t.Errorf("Error in read body: %s", err)
}
if bytes.Index(b, []byte(`"username":"foo"`)) < 0 {
if !bytes.Contains(b, []byte(`"username":"foo"`)) {
t.Error("No username found")
}
if bytes.Index(b, []byte(`"password":"bar"`)) < 0 {
if !bytes.Contains(b, []byte(`"password":"bar"`)) {
t.Error("No password found")
}
@ -53,10 +53,10 @@ func TestAuthenticationService_AcquireSessionCookie_Success(t *testing.T) {
if err != nil {
t.Errorf("Error in read body: %s", err)
}
if bytes.Index(b, []byte(`"username":"foo"`)) < 0 {
if !bytes.Contains(b, []byte(`"username":"foo"`)) {
t.Error("No username found")
}
if bytes.Index(b, []byte(`"password":"bar"`)) < 0 {
if !bytes.Contains(b, []byte(`"password":"bar"`)) {
t.Error("No password found")
}
@ -144,10 +144,10 @@ func TestAithenticationService_GetUserInfo_AccessForbidden_Fail(t *testing.T) {
if err != nil {
t.Errorf("Error in read body: %s", err)
}
if bytes.Index(b, []byte(`"username":"foo"`)) < 0 {
if !bytes.Contains(b, []byte(`"username":"foo"`)) {
t.Error("No username found")
}
if bytes.Index(b, []byte(`"password":"bar"`)) < 0 {
if !bytes.Contains(b, []byte(`"password":"bar"`)) {
t.Error("No password found")
}
@ -182,10 +182,10 @@ func TestAuthenticationService_GetUserInfo_NonOkStatusCode_Fail(t *testing.T) {
if err != nil {
t.Errorf("Error in read body: %s", err)
}
if bytes.Index(b, []byte(`"username":"foo"`)) < 0 {
if !bytes.Contains(b, []byte(`"username":"foo"`)) {
t.Error("No username found")
}
if bytes.Index(b, []byte(`"password":"bar"`)) < 0 {
if !bytes.Contains(b, []byte(`"password":"bar"`)) {
t.Error("No password found")
}
@ -238,10 +238,10 @@ func TestAuthenticationService_GetUserInfo_Success(t *testing.T) {
if err != nil {
t.Errorf("Error in read body: %s", err)
}
if bytes.Index(b, []byte(`"username":"foo"`)) < 0 {
if !bytes.Contains(b, []byte(`"username":"foo"`)) {
t.Error("No username found")
}
if bytes.Index(b, []byte(`"password":"bar"`)) < 0 {
if !bytes.Contains(b, []byte(`"password":"bar"`)) {
t.Error("No password found")
}
@ -280,10 +280,10 @@ func TestAuthenticationService_Logout_Success(t *testing.T) {
if err != nil {
t.Errorf("Error in read body: %s", err)
}
if bytes.Index(b, []byte(`"username":"foo"`)) < 0 {
if !bytes.Contains(b, []byte(`"username":"foo"`)) {
t.Error("No username found")
}
if bytes.Index(b, []byte(`"password":"bar"`)) < 0 {
if !bytes.Contains(b, []byte(`"password":"bar"`)) {
t.Error("No password found")
}