Other: add straightforward linters

This commit is contained in:
Jakub
2021-04-08 08:00:39 +02:00
parent 7d0af7624c
commit 2d95f21567
49 changed files with 148 additions and 139 deletions

View File

@ -132,8 +132,8 @@ func BenchmarkIMAPAppleMail(b *testing.B) {
`)])`,
`UID FETCH ` + newUID + ` (BODYSTRUCTURE BODY.PEEK[HEADER])`,
// if email has attachment it is splitted to several fetches
//`UID FETCH 133 (BODY.PEEK[3]<0.5877469> BODY.PEEK[1] BODY.PEEK[2])`,
//`UID FETCH 133 BODY.PEEK[3]<5877469.2925661>`,
// `UID FETCH 133 (BODY.PEEK[3]<0.5877469> BODY.PEEK[1] BODY.PEEK[2])`,
// `UID FETCH 133 BODY.PEEK[3]<5877469.2925661>`,
// here I will just use section download, which is used by AppleMail
`UID FETCH ` + newUID + ` BODY.PEEK[1]`,
// here I will just use partial download, which is used by AppleMail

View File

@ -43,8 +43,8 @@ func newFakeSettings() *fakeSettings {
}
// We should use nonstandard ports to not conflict with bridge.
s.SetInt(settings.IMAPPortKey, 21100+rand.Intn(100)) //noling[gosec] G404 It is OK to use weak random number generator here
s.SetInt(settings.SMTPPortKey, 21200+rand.Intn(100)) //noling[gosec] G404 It is OK to use weak random number generator here
s.SetInt(settings.IMAPPortKey, 21100+rand.Intn(100)) //nolint[gosec] G404 It is OK to use weak random number generator here
s.SetInt(settings.SMTPPortKey, 21200+rand.Intn(100)) //nolint[gosec] G404 It is OK to use weak random number generator here
return s
}

View File

@ -88,7 +88,7 @@ func (ctx *TestContext) GetTransferRemoteIMAPServer() *mocks.IMAPServer {
return ctx.transferRemoteIMAPServer
}
port := 21300 + rand.Intn(100)
port := 21300 + rand.Intn(100) //nolint[gosec] It is OK to use weaker rand generator here
ctx.transferRemoteIMAPServer = mocks.NewIMAPServer("user", "pass", "127.0.0.1", strconv.Itoa(port))
ctx.transferRemoteIMAPServer.Start()

View File

@ -37,7 +37,7 @@ func (ctx *TestContext) GetUsers() *users.Users {
// LoginUser logs in the user with the given username, password, and mailbox password.
func (ctx *TestContext) LoginUser(username, password, mailboxPassword string) (err error) {
srp.RandReader = rand.New(rand.NewSource(42))
srp.RandReader = rand.New(rand.NewSource(42)) //nolint[gosec] It is OK to use weaker random number generator here
client, auth, err := ctx.users.Login(username, password)
if err != nil {
@ -120,7 +120,7 @@ func (ctx *TestContext) eventuallySyncIsFinished(store *store.Store) {
}
// EventuallySyncIsFinishedForUsername will wait until sync is finished or
// deadline is reached see eventuallySyncIsFinished for timing
// deadline is reached see eventuallySyncIsFinished for timing.
func (ctx *TestContext) EventuallySyncIsFinishedForUsername(username string) {
store, err := ctx.GetStore(username)
assert.Nil(ctx.t, err)

View File

@ -47,8 +47,5 @@ func (api *FakePMAPI) CreateAttachment(attachment *pmapi.Attachment, data io.Rea
}
func (api *FakePMAPI) DeleteAttachment(attID string) error {
if err := api.checkAndRecordCall(DELETE, "/mail/v4/attachments/"+attID, nil); err != nil {
return err
}
return nil
return api.checkAndRecordCall(DELETE, "/mail/v4/attachments/"+attID, nil)
}

View File

@ -108,7 +108,7 @@ func thereIsNoDatabaseFileForUser(bddUserID string) error {
}
filePath := ctx.GetDatabaseFilePath(account.UserID())
if _, err := os.Stat(filePath); err != nil {
return nil
return nil //nolint[nilerr] Error means the file is not there or not accessible so test passed
}
return internalError(os.Remove(filePath), "removing database file of %s", account.Username())
}