Making linting happy

This commit is contained in:
Andrew Morgan 2019-05-29 16:22:26 +01:00
parent fcdb18d77f
commit 9966b5b68c
8 changed files with 16 additions and 56 deletions

View file

@ -76,7 +76,7 @@ linters-settings:
# path to a file containing a list of functions to exclude from checking
# see https://github.com/kisielk/errcheck#excluding-functions for details
exclude: /path/to/file.txt
#exclude: /path/to/file.txt
govet:
# report about shadowed variables
check-shadowing: true
@ -163,28 +163,28 @@ linters-settings:
#enabled-checks:
# Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty
disabled-checks:
- regexpMust
#disabled-checks:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- performance
#enabled-tags:
# - performance
settings: # settings passed to gocritic
captLocal: # must be valid enabled check name
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
#rangeValCopy:
# sizeThreshold: 32
linters:
enable:
- megacheck
- govet
enable-all: false
disable:
- maligned
- prealloc
- gosec
- scopelint
disable-all: false
presets:
- bugs
@ -248,7 +248,7 @@ issues:
new: false
# Show only new issues created after git revision `REV`
new-from-rev: REV
#new-from-rev: REV
# Show only new issues created in git patch with set file path.
new-from-patch: path/to/patch/file
#new-from-patch: path/to/patch/file

View file

@ -75,7 +75,8 @@ func parseEventIDParam(
) (eventID string, resErr *util.JSONResponse) {
URL, err := url.Parse(request.RequestURI())
if err != nil {
*resErr = util.ErrorResponse(err)
response := util.ErrorResponse(err)
resErr = &response
return
}

View file

@ -1,16 +0,0 @@
{
"Vendor": true,
"Cyclo": 12,
"Deadline": "5m",
"Enable": [
"vetshadow",
"deadcode",
"gocyclo",
"ineffassign",
"misspell",
"errcheck",
"vet",
"gofmt",
"goconst"
]
}

View file

@ -1,20 +0,0 @@
{
"Vendor": true,
"Cyclo": 12,
"Deadline": "5m",
"Enable": [
"vetshadow",
"deadcode",
"gocyclo",
"golint",
"varcheck",
"structcheck",
"ineffassign",
"misspell",
"unparam",
"errcheck",
"vet",
"gofmt",
"goconst"
]
}

View file

@ -20,9 +20,11 @@ import (
"context"
"image"
"image/draw"
// Imported for gif codec
_ "image/gif"
"image/jpeg"
// Imported for png codec
_ "image/png"
"os"
@ -258,9 +260,6 @@ func adjustSize(dst types.Path, img image.Image, w, h int, crop bool, logger *lo
out = target
} else {
out = resize.Thumbnail(uint(w), uint(h), img, resize.Lanczos3)
if err != nil {
return -1, -1, err
}
}
if err = writeFile(out, string(dst)); err != nil {

View file

@ -29,4 +29,4 @@ echo "Looking for lint..."
golangci-lint run $args
echo "Checking spelling..."
golangci-lint -E "misspell" ./*.md
misspell -error src *.md

View file

@ -134,10 +134,6 @@ func (s *OutputRoomEventConsumer) onNewRoomEvent(
msg.RemovesStateEventIDs,
msg.TransactionID,
)
if err != nil {
return err
}
if err != nil {
// panic rather than continue with an inconsistent database
log.WithFields(log.Fields{

View file

@ -38,7 +38,7 @@ func TestTypingCache(t *testing.T) {
})
}
func testAddTypingUser(t *testing.T, tCache *TypingCache) {
func testAddTypingUser(t *testing.T, tCache *TypingCache) { // nolint: unparam
present := time.Now()
tests := []struct {
userID string