Preparing report...

Report for github.com/CSCfi/qvain-api

A+    Excellent!    Found 45 issues across 89 files

Tweet

gofmt98%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


gocyclo86%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

    • qvain-api/pkg/metax/api.go
    • Line 554: warning: cyclomatic complexity 24 of function (*MetaxService).Store() is high (> 15) (gocyclo)
    • Line 388: warning: cyclomatic complexity 17 of function (*MetaxService).ReadStreamChannel() is high (> 15) (gocyclo)

golint61%

Golint is a linter for Go source code.

    • qvain-api/cmd/qvain-backend/main.go
    • Line 16: warning: comment on exported const ServiceName should be of the form "ServiceName ..." (golint)
    • Line 19: warning: comment on exported const HttpProxyPort should be of the form "HttpProxyPort ..." (golint)
    • Line 22: warning: comment on exported const HttpReadTimeout should be of the form "HttpReadTimeout ..." (golint)
    • Line 24: warning: exported const HttpWriteTimeout should have comment (or a comment on this block) or be unexported (golint)
    • qvain-api/cmd/metax-cli/main.go
    • Line 25: warning: exported const ProgramName should have comment or be unexported (golint)
    • Line 26: warning: exported const API_URL should have comment or be unexported (golint)
    • Line 28: warning: exported const METAX_HOST should have comment (or a comment on this block) or be unexported (golint)
    • Line 35: warning: exported var Verbose should have comment or be unexported (golint)
    • qvain-api/pkg/models/user.go
    • Line 66: warning: receiver name u should be consistent with previous receiver name user for User (golint)
    • Line 70: warning: comment on exported method User.UnmarshalJSONObject should be of the form "UnmarshalJSONObject ..." (golint)
    • Line 102: warning: exported method User.NKeys should have comment or be unexported (golint)
    • Line 102: warning: receiver name u should be consistent with previous receiver name user for User (golint)
    • qvain-api/internal/psql/dataset.go
    • Line 169: warning: exported method DB.Update should have comment or be unexported (golint)
    • Line 261: warning: exported method DB.Patch should have comment or be unexported (golint)
    • Line 310: warning: exported method DB.SmartGetWithOwner should have comment or be unexported (golint)
    • Line 338: warning: exported method DB.SmartUpdateWithOwner should have comment or be unexported (golint)
    • Line 394: warning: exported method DB.Clone should have comment or be unexported (golint)
    • qvain-api/internal/randomkey/randomkey.go
    • Line 11: warning: exported type Key should have comment or be unexported (golint)
    • Line 13: warning: exported method Key.Bytes should have comment or be unexported (golint)
    • Line 17: warning: exported method Key.Hex should have comment or be unexported (golint)
    • Line 21: warning: exported function FromHex should have comment or be unexported (golint)
    • Line 26: warning: exported method Key.Base64 should have comment or be unexported (golint)
    • Line 30: warning: exported function FromBase64 should have comment or be unexported (golint)
    • Line 35: warning: exported method Key.Len should have comment or be unexported (golint)
    • Line 43: warning: exported method Key.GoString should have comment or be unexported (golint)
    • Line 59: warning: exported function Random8 should have comment or be unexported (golint)
    • Line 63: warning: exported function Random16 should have comment or be unexported (golint)
    • Line 67: warning: exported function Random32 should have comment or be unexported (golint)
    • Line 71: warning: exported function Random64 should have comment or be unexported (golint)
    • qvain-api/pkg/concat/concat.go
    • Line 43: warning: comment on exported const UseTemp should be of the form "UseTemp ..." (golint)
    • Line 46: warning: comment on exported const SkipOnError should be of the form "SkipOnError ..." (golint)
    • Line 164: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • Line 191: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)
    • qvain-api/pkg/metax/errors.go
    • Line 9: warning: exported var ErrInvalidContentType should have comment or be unexported (golint)
    • Line 46: warning: exported type ApiError should have comment or be unexported (golint)
    • Line 56: warning: exported method ApiError.StatusCode should have comment or be unexported (golint)
    • Line 60: warning: exported method ApiError.OriginalError should have comment or be unexported (golint)
    • qvain-api/cmd/qvain-backend/dataset_api.go
    • Line 24: warning: exported type DatasetApi should have comment or be unexported (golint)
    • Line 33: warning: exported function NewDatasetApi should have comment or be unexported (golint)
    • Line 90: warning: exported method DatasetApi.ListDatasets should have comment or be unexported (golint)
    • Line 496: warning: exported method DatasetApi.Published should have comment or be unexported (golint)
    • qvain-api/cmd/qvain-backend/api_helpers.go
    • Line 211: warning: exported function ShiftPath should have comment or be unexported (golint)
    • Line 223: warning: exported function ShiftUrlWithTrailing should have comment or be unexported (golint)
    • Line 236: warning: exported function ShiftUrl should have comment or be unexported (golint)
    • Line 241: warning: exported function StripPrefix should have comment or be unexported (golint)
    • Line 249: warning: exported function HasSubroutes should have comment or be unexported (golint)
    • Line 253: warning: exported function GetStringParam should have comment or be unexported (golint)
    • Line 260: warning: exported function GetUuidParam should have comment or be unexported (golint)
    • Line 264: warning: exported function TrimSlash should have comment or be unexported (golint)
    • qvain-api/pkg/metax/versioning.go
    • Line 16: warning: comment on exported var NewVersionIdKey should be of the form "NewVersionIdKey ..." (golint)
    • Line 19: warning: comment on exported var EditorKey should be of the form "EditorKey ..." (golint)
    • Line 22: warning: comment on exported var QvainIdKey should be of the form "QvainIdKey ..." (golint)
    • Line 25: warning: comment on exported var QvainIdentifierKey should be of the form "QvainIdentifierKey ..." (golint)
    • Line 41: warning: exported function GetIdentifier should have comment or be unexported (golint)
    • Line 66: warning: exported function IsPublished should have comment or be unexported (golint)
    • qvain-api/pkg/models/dataset.go
    • Line 16: warning: exported type Dataset should have comment or be unexported (golint)
    • Line 80: warning: exported method Dataset.Family should have comment or be unexported (golint)
    • Line 84: warning: exported method Dataset.Schema should have comment or be unexported (golint)
    • Line 88: warning: exported method Dataset.Blob should have comment or be unexported (golint)
    • Line 92: warning: exported method Dataset.SetValid should have comment or be unexported (golint)
    • Line 96: warning: exported method Dataset.IsValid should have comment or be unexported (golint)
    • qvain-api/internal/sessions/manager.go
    • Line 1: warning: package comment should be of the form "Package sessions ..." (golint)
    • Line 34: warning: exported type ManagerOption should have comment or be unexported (golint)
    • Line 36: warning: exported function WithRequireCSCUserName should have comment or be unexported (golint)
    • Line 122: warning: exported method Manager.Get should have comment or be unexported (golint)
    • Line 133: warning: exported method Manager.Exists should have comment or be unexported (golint)
    • Line 137: warning: exported method Manager.Destroy should have comment or be unexported (golint)
    • Line 146: warning: exported method Manager.DestroyWithCookie should have comment or be unexported (golint)
    • Line 151: warning: exported method Manager.Count should have comment or be unexported (golint)
    • Line 155: warning: exported method Manager.List should have comment or be unexported (golint)
    • Line 167: warning: exported method Manager.Save should have comment or be unexported (golint)
    • Line 252: warning: exported method Manager.GetRedis should have comment or be unexported (golint)
    • Line 261: warning: exported type SessionOption should have comment or be unexported (golint)
    • Line 263: warning: exported function WithExpiration should have comment or be unexported (golint)
    • Line 269: warning: exported function WithDuration should have comment or be unexported (golint)
    • qvain-api/pkg/proxy/proxy.go
    • Line 15: warning: exported const BufferSize should have comment or be unexported (golint)
    • Line 21: warning: exported function NewBufferPool should have comment or be unexported (golint)
    • Line 39: warning: exported function NewSingleHostReverseProxy should have comment or be unexported (golint)
    • qvain-api/internal/psql/psql.go
    • Line 63: warning: comment on exported function NewPoolServiceFromEnv should be of the form "NewPoolServiceFromEnv ..." (golint)
    • Line 105: warning: exported type Tx should have comment or be unexported (golint)
    • Line 109: warning: exported method DB.Begin should have comment or be unexported (golint)
    • Line 117: warning: exported method DB.Version should have comment or be unexported (golint)
    • Line 124: warning: exported method DB.Check should have comment or be unexported (golint)
    • Line 138: warning: exported method DB.Log should have comment or be unexported (golint)
    • qvain-api/internal/sessions/session.go
    • Line 49: warning: exported method Session.MarshalJSONObject should have comment or be unexported (golint)
    • Line 63: warning: exported method Session.UnmarshalJSONObject should have comment or be unexported (golint)
    • Line 91: warning: exported method Session.NKeys should have comment or be unexported (golint)
    • qvain-api/pkg/models/registry.go
    • Line 9: warning: exported var ErrInvalidFamily should have comment or be unexported (golint)
    • Line 13: warning: exported type TypeRegistry should have comment or be unexported (golint)
    • Line 17: warning: exported function NewTypeRegistry should have comment or be unexported (golint)
    • Line 21: warning: exported method TypeRegistry.Register should have comment or be unexported (golint)
    • Line 31: warning: exported method TypeRegistry.Lookup should have comment or be unexported (golint)
    • Line 94: warning: comment on exported function LoadOpenDataset should be of the form "LoadOpenDataset ..." (golint)
    • qvain-api/internal/psql/batch.go
    • Line 10: warning: exported type BatchManager should have comment or be unexported (golint)
    • Line 16: warning: exported method DB.NewBatch should have comment or be unexported (golint)
    • Line 24: warning: exported method DB.NewBatchForUser should have comment or be unexported (golint)
    • Line 34: warning: exported method BatchManager.Create should have comment or be unexported (golint)
    • Line 38: warning: exported method BatchManager.CreateWithMetadata should have comment or be unexported (golint)
    • Line 43: warning: exported method BatchManager.UpdateSynced should have comment or be unexported (golint)
    • Line 47: warning: exported method BatchManager.Update should have comment or be unexported (golint)
    • Line 51: warning: exported method BatchManager.Upsert should have comment or be unexported (golint)
    • Line 55: warning: exported method BatchManager.Delete should have comment or be unexported (golint)
    • Line 67: warning: exported method BatchManager.Commit should have comment or be unexported (golint)
    • Line 75: warning: exported method BatchManager.Rollback should have comment or be unexported (golint)
    • Line 79: warning: exported method DB.GetLastSync should have comment or be unexported (golint)
    • qvain-api/pkg/metax/api.go
    • Line 28: warning: exported const Verbose should have comment (or a comment on this block) or be unexported (golint)
    • Line 58: warning: exported type MetaxOption should have comment or be unexported (golint)
    • Line 60: warning: exported function DisableHttps should have comment or be unexported (golint)
    • Line 64: warning: exported function WithLogger should have comment or be unexported (golint)
    • Line 70: warning: exported function WithUserAgent should have comment or be unexported (golint)
    • Line 76: warning: exported function WithInsecureCertificates should have comment or be unexported (golint)
    • Line 82: warning: exported function WithCredentials should have comment or be unexported (golint)
    • Line 89: warning: exported function WithLatestVersion should have comment or be unexported (golint)
    • Line 149: warning: exported type PaginatedResponse should have comment or be unexported (golint)
    • Line 156: warning: exported method MetaxService.UrlForId should have comment or be unexported (golint)
    • Line 160: warning: exported type DatasetOption should have comment or be unexported (golint)
    • Line 224: warning: exported method MetaxService.Datasets should have comment or be unexported (golint)
    • Line 699: warning: comment on exported method MetaxService.GetIdRemoved should be of the form "GetIdRemoved ..." (golint)
    • qvain-api/internal/oidc/client.go
    • Line 1: warning: package comment should be of the form "Package oidc ..." (golint)
    • Line 26: warning: exported var ErrMissingCSCUserName should have comment or be unexported (golint)
    • Line 28: warning: comment on exported var ErrMissingOrganization should be of the form "ErrMissingOrganization ..." (golint)
    • Line 241: warning: exported method OidcClient.DumpToken should have comment or be unexported (golint)
    • qvain-api/internal/shared/fetch.go
    • Line 15: warning: exported const DefaultRequestTimeout should have comment or be unexported (golint)
    • Line 18: warning: exported const SyncWritten should have comment (or a comment on this block) or be unexported (golint)
    • Line 24: warning: exported function Fetch should have comment or be unexported (golint)
    • Line 32: warning: exported function FetchSince should have comment or be unexported (golint)
    • Line 36: warning: exported function FetchAll should have comment or be unexported (golint)
    • qvain-api/internal/secmsg/secmsg.go
    • Line 13: warning: exported var ErrSecretKeyLength should have comment or be unexported (golint)
    • Line 17: warning: exported type MessageService should have comment or be unexported (golint)
    • Line 52: warning: comment on exported method MessageService.Decode should be of the form "Decode ..." (golint)
    • Line 61: warning: comment on exported method MessageService.MustDecode should be of the form "MustDecode ..." (golint)
    • qvain-api/internal/psql/views.go
    • Line 80: warning: exported method DB.ViewDatasetWithOwner should have comment or be unexported (golint)
    • Line 201: warning: exported method DB.ExportAsJson should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign97%

IneffAssign detects ineffectual assignments in Go code.

    • qvain-api/pkg/metax/api.go
    • Line 225: warning: ineffectual assignment to err (ineffassign)
    • Line 310: warning: ineffectual assignment to err (ineffassign)
    • Line 391: warning: ineffectual assignment to err (ineffassign)
    • Line 434: warning: ineffectual assignment to err (ineffassign)
    • Line 482: warning: ineffectual assignment to t (ineffassign)
    • Line 507: warning: ineffectual assignment to err (ineffassign)

misspell94%

Misspell Finds commonly misspelled English words