Preparing report...

Report for github.com/mendersoftware/inventory

A+    Excellent!    Found 32 issues across 50 files

Tweet

gofmt100%

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

No problems detected. Good job!


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!


gocyclo96%

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.


golint42%

Golint is a linter for Go source code.

    • inventory/utils/search.go
    • Line 1: warning: package comment should be of the form "Package utils ..." (golint)
    • Line 16: warning: comment on exported function ContainsString should be of the form "ContainsString ..." (golint)
    • inventory/middleware.go
    • Line 30: warning: exported const EnvProd should have comment (or a comment on this block) or be unexported (golint)
    • Line 121: warning: exported function SetupMiddleware should have comment or be unexported (golint)
    • inventory/utils/identity/token.go
    • Line 1: warning: package comment should be of the form "Package identity ..." (golint)
    • Line 30: warning: exported type Identity should have comment or be unexported (golint)
    • Line 63: warning: comment on exported function ExtractIdentity should be of the form "ExtractIdentity ..." (golint)
    • Line 85: warning: comment on exported function ExtractIdentityFromHeaders should be of the form "ExtractIdentityFromHeaders ..." (golint)
    • inventory/utils/http.go
    • Line 45: warning: comment on exported function MsgQueryParmInvalid should be of the form "MsgQueryParmInvalid ..." (golint)
    • Line 50: warning: exported function MsgQueryParmMissing should have comment or be unexported (golint)
    • Line 54: warning: exported function MsgQueryParmLimit should have comment or be unexported (golint)
    • Line 58: warning: exported function MsgQueryParmOneOf should have comment or be unexported (golint)
    • Line 62: warning: comment on exported function ParseQueryParmUInt should be of the form "ParseQueryParmUInt ..." (golint)
    • Line 69: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 86: warning: exported function ParseQueryParmBool should have comment or be unexported (golint)
    • Line 92: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 105: warning: exported function ParseQueryParmStr should have comment or be unexported (golint)
    • Line 126: warning: comment on exported function ParsePagination should be of the form "ParsePagination ..." (golint)
    • Line 133: warning: don't use underscores in Go names; var per_page should be perPage (golint)
    • Line 141: warning: exported function MakePageLinkHdrs should have comment or be unexported (golint)
    • Line 141: warning: don't use underscores in Go names; func parameter per_page should be perPage (golint)
    • Line 141: warning: don't use underscores in Go names; func parameter has_next should be hasNext (golint)
    • Line 160: warning: exported function MakeLink should have comment or be unexported (golint)
    • Line 160: warning: don't use underscores in Go names; func parameter link_type should be linkType (golint)
    • Line 160: warning: don't use underscores in Go names; func parameter per_page should be perPage (golint)
    • inventory/utils/http_test.go
    • Line 45: warning: don't use underscores in Go names; func parameter has_scheme should be hasScheme (golint)
    • Line 55: warning: don't use underscores in Go names; func parameter per_page should be perPage (golint)
    • Line 143: warning: don't use underscores in Go names; var per_page should be perPage (golint)
    • Line 166: warning: don't use underscores in Go names; var per_page should be perPage (golint)
    • inventory/store/mongo/migrations.go
    • Line 38: warning: exported method DataStoreMongo.MigrateTenant should have comment or be unexported (golint)
    • Line 87: warning: exported method DataStoreMongo.Migrate should have comment or be unexported (golint)
    • Line 161: warning: exported method DataStoreMongo.Maintenance should have comment or be unexported (golint)
    • inventory/config/config.go
    • Line 1: warning: package comment should be of the form "Package config ..." (golint)
    • Line 24: warning: exported var Config should have comment or be unexported (golint)
    • Line 27: warning: exported function FromConfigFile should have comment or be unexported (golint)
    • Line 50: warning: exported type Reader should have comment or be unexported (golint)
    • Line 64: warning: exported type Writer should have comment or be unexported (golint)
    • Line 69: warning: exported type Handler should have comment or be unexported (golint)
    • Line 74: warning: exported type Default should have comment or be unexported (golint)
    • Line 79: warning: exported type Validator should have comment or be unexported (golint)
    • Line 94: warning: exported function SetDefaults should have comment or be unexported (golint)
    • inventory/inv/inventory.go
    • Line 27: warning: comment on exported type InventoryApp should be of the form "InventoryApp ..." (with optional leading article) (golint)
    • Line 67: warning: exported function NewInventory should have comment or be unexported (golint)
    • Line 248: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 261: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • inventory/version.go
    • Line 18: warning: comment on exported var Commit should be of the form "Commit ..." (golint)
    • Line 21: warning: comment on exported var Tag should be of the form "Tag ..." (golint)
    • Line 24: warning: comment on exported var Branch should be of the form "Branch ..." (golint)
    • Line 30: warning: comment on exported var BuildNumber should be of the form "BuildNumber ..." (golint)
    • Line 34: warning: exported function CreateVersionString should have comment or be unexported (golint)
    • inventory/api/http/routing.go
    • Line 1: warning: package comment should be of the form "Package http ..." (golint)
    • Line 24: warning: exported type HttpOptionsGenerator should have comment or be unexported (golint)
    • Line 26: warning: exported function AllowHeaderOptionsGenerator should have comment or be unexported (golint)
    • Line 39: warning: comment on exported function AutogenOptionsRoutes should be of the form "AutogenOptionsRoutes ..." (golint)
    • inventory/model/device.go
    • Line 32: warning: exported const AttrScopeInventory should have comment (or a comment on this block) or be unexported (golint)
    • Line 49: warning: exported type DeviceID should have comment or be unexported (golint)
    • Line 51: warning: exported var NilDeviceID should have comment or be unexported (golint)
    • Line 53: warning: exported type GroupName should have comment or be unexported (golint)
    • Line 55: warning: exported type DeviceAttribute should have comment or be unexported (golint)
    • Line 62: warning: exported method DeviceAttribute.Validate should have comment or be unexported (golint)
    • Line 149: warning: exported method Device.UnmarshalBSON should have comment or be unexported (golint)
    • Line 171: warning: exported method Device.MarshalBSON should have comment or be unexported (golint)
    • Line 185: warning: exported method Device.Validate should have comment or be unexported (golint)
    • Line 200: warning: exported method GroupName.Validate should have comment or be unexported (golint)
    • Line 218: warning: comment on exported type DeviceAttributes should be of the form "DeviceAttributes ..." (with optional leading article) (golint)
    • Line 221: warning: exported method DeviceAttributes.UnmarshalJSON should have comment or be unexported (golint)
    • Line 244: warning: exported method DeviceAttributes.Validate should have comment or be unexported (golint)
    • Line 253: warning: exported function GetDeviceAttributeNameReplacer should have comment or be unexported (golint)
    • Line 295: warning: exported type DeviceUpdate should have comment or be unexported (golint)
    • inventory/store/datastore.go
    • Line 25: warning: comment on exported var ErrDevNotFound should be of the form "ErrDevNotFound ..." (golint)
    • Line 28: warning: exported var ErrGroupNotFound should have comment or be unexported (golint)
    • Line 38: warning: comment on exported type DataStore should be of the form "DataStore ..." (with optional leading article) (golint)
    • inventory/model/attribute.go
    • Line 1: warning: package comment should be of the form "Package model ..." (golint)
    • Line 16: warning: exported type FilterAttribute should have comment or be unexported (golint)
    • inventory/store/mongo/datastore_mongo.go
    • Line 40: warning: exported const DbVersion should have comment (or a comment on this block) or be unexported (golint)
    • Line 73: warning: exported var ErrNotFound should have comment or be unexported (golint)
    • Line 76: warning: exported type DataStoreMongoConfig should have comment or be unexported (golint)
    • Line 89: warning: exported type DataStoreMongo should have comment or be unexported (golint)
    • Line 94: warning: exported function NewDataStoreMongoWithSession should have comment or be unexported (golint)
    • Line 98: warning: comment on exported function NewDataStoreMongo should be of the form "NewDataStoreMongo ..." (golint)
    • Line 156: warning: exported method DataStoreMongo.Ping should have comment or be unexported (golint)
    • Line 161: warning: exported method DataStoreMongo.GetDevices should have comment or be unexported (golint)
    • Line 239: warning: exported method DataStoreMongo.GetDevice should have comment or be unexported (golint)
    • Line 282: warning: exported method DataStoreMongo.UpsertDevicesAttributesWithRevision should have comment or be unexported (golint)
    • Line 290: warning: exported method DataStoreMongo.UpsertDevicesAttributesWithUpdated should have comment or be unexported (golint)
    • Line 298: warning: exported method DataStoreMongo.UpsertDevicesAttributes should have comment or be unexported (golint)
    • Line 391: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 543: warning: exported method DataStoreMongo.UpsertRemoveDeviceAttributes should have comment or be unexported (golint)
    • Line 602: warning: exported method DataStoreMongo.UpdateDevicesGroup should have comment or be unexported (golint)
    • Line 638: warning: exported method DataStoreMongo.GetFiltersAttributes should have comment or be unexported (golint)
    • Line 705: warning: exported method DataStoreMongo.UnsetDevicesGroup should have comment or be unexported (golint)
    • Line 756: warning: exported method DataStoreMongo.ListGroups should have comment or be unexported (golint)
    • Line 792: warning: exported method DataStoreMongo.GetDevicesByGroup should have comment or be unexported (golint)
    • Line 829: warning: exported method DataStoreMongo.GetDeviceGroup should have comment or be unexported (golint)
    • Line 838: warning: exported method DataStoreMongo.DeleteDevices should have comment or be unexported (golint)
    • Line 863: warning: exported method DataStoreMongo.GetAllAttributeNames should have comment or be unexported (golint)
    • Line 904: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 919: warning: exported method DataStoreMongo.SearchDevices should have comment or be unexported (golint)
    • Line 992: warning: context.Context should be the first parameter of a function (golint)
    • inventory/api/http/api_handler.go
    • Line 1: warning: package comment should be of the form "Package http ..." (golint)
    • Line 20: warning: comment on exported type ApiHandler should be of the form "ApiHandler ..." (with optional leading article) (golint)
    • inventory/api/http/api_inventory.go
    • Line 77: warning: exported const DefaultTimeout should have comment (or a comment on this block) or be unexported (golint)
    • Line 80: warning: comment on exported type InventoryApiGroup should be of the form "InventoryApiGroup ..." (with optional leading article) (golint)
    • Line 85: warning: exported method InventoryApiGroup.Validate should have comment or be unexported (golint)
    • Line 93: warning: comment on exported function NewInventoryApiHandlers should be of the form "NewInventoryApiHandlers ..." (golint)
    • inventory/store/query.go
    • Line 1: warning: package comment should be of the form "Package store ..." (golint)
    • Line 16: warning: exported type ComparisonOperator should have comment or be unexported (golint)
    • Line 19: warning: exported const Eq should have comment (or a comment on this block) or be unexported (golint)
    • Line 22: warning: exported type Filter should have comment or be unexported (golint)
    • Line 30: warning: exported type Sort should have comment or be unexported (golint)
    • Line 36: warning: exported type ListQuery should have comment or be unexported (golint)
    • inventory/model/filters.go
    • Line 1: warning: package comment should be of the form "Package model ..." (golint)
    • Line 28: warning: exported type SearchParams should have comment or be unexported (golint)
    • Line 37: warning: exported type Filter should have comment or be unexported (golint)
    • Line 43: warning: exported type FilterPredicate should have comment or be unexported (golint)
    • Line 50: warning: exported type SortCriteria should have comment or be unexported (golint)
    • Line 56: warning: exported type SelectAttribute should have comment or be unexported (golint)
    • Line 61: warning: exported method SearchParams.Validate should have comment or be unexported (golint)
    • Line 90: warning: exported method Filter.Validate should have comment or be unexported (golint)
    • Line 111: warning: exported method FilterPredicate.Validate should have comment or be unexported (golint)
    • inventory/config.go
    • Line 21: warning: exported const SettingListen should have comment (or a comment on this block) or be unexported (golint)
    • inventory/server.go
    • Line 29: warning: exported function SetupAPI should have comment or be unexported (golint)
    • Line 44: warning: exported function RunServer should have comment or be unexported (golint)
    • inventory/utils/responsetest.go
    • Line 25: warning: exported type JSONResponseParams should have comment or be unexported (golint)
    • Line 31: warning: exported function CheckRecordedResponse should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign96%

IneffAssign detects ineffectual assignments in Go code.


misspell94%

Misspell Finds commonly misspelled English words