Preparing report...

Report for github.com/codefresh-io/argocd-agent

A+    Excellent!    Found 81 issues across 111 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!


gocyclo99%

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.


golint27%

Golint is a linter for Go source code.

    • argocd-agent/agent/pkg/infra/git/provider/api/cached_github.go
    • Line 8: warning: exported type CachedGithub should have comment or be unexported (golint)
    • Line 19: warning: exported function New should have comment or be unexported (golint)
    • Line 30: warning: error should be the last type when returning multiple items (golint)
    • Line 30: warning: exported method CachedGithub.GetCommitBySha should have comment or be unexported (golint)
    • Line 52: warning: error should be the last type when returning multiple items (golint)
    • Line 52: warning: exported method CachedGithub.GetCommitsBySha should have comment or be unexported (golint)
    • Line 86: warning: error should be the last type when returning multiple items (golint)
    • Line 86: warning: exported method CachedGithub.GetUserByUsername should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/api/codefresh/api.go
    • Line 12: warning: exported type Api should have comment or be unexported (golint)
    • Line 17: warning: exported type CodefreshApi should have comment or be unexported (golint)
    • Line 35: warning: exported function GetInstance should have comment or be unexported (golint)
    • Line 49: warning: exported function BuildCodefreshSdk should have comment or be unexported (golint)
    • Line 67: warning: error should be the last type when returning multiple items (golint)
    • Line 67: warning: exported method Api.GetDefaultGitContext should have comment or be unexported (golint)
    • Line 71: warning: error should be the last type when returning multiple items (golint)
    • Line 71: warning: exported method Api.GetGitContexts should have comment or be unexported (golint)
    • Line 75: warning: error should be the last type when returning multiple items (golint)
    • Line 75: warning: exported method Api.GetGitContextByName should have comment or be unexported (golint)
    • Line 79: warning: exported method Api.SendResources should have comment or be unexported (golint)
    • Line 94: warning: exported method Api.SendEvent should have comment or be unexported (golint)
    • Line 98: warning: exported method Api.HeartBeat should have comment or be unexported (golint)
    • Line 103: warning: exported method Api.GetEnvironments should have comment or be unexported (golint)
    • Line 107: warning: exported method Api.CreateIntegration should have comment or be unexported (golint)
    • Line 113: warning: exported method Api.UpdateIntegration should have comment or be unexported (golint)
    • Line 117: warning: exported method Api.SendEnvironment should have comment or be unexported (golint)
    • Line 124: warning: exported method Api.CreateEnvironment should have comment or be unexported (golint)
    • Line 135: warning: exported method Api.DeleteEnvironment should have comment or be unexported (golint)
    • Line 139: warning: exported method Api.SendApplicationResources should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/service/argo_resource.go
    • Line 17: warning: exported type Resource should have comment or be unexported (golint)
    • Line 26: warning: exported type ResourcesWrapper should have comment or be unexported (golint)
    • Line 31: warning: exported type ApplicationWrapper should have comment or be unexported (golint)
    • Line 36: warning: exported type ResourceCommit should have comment or be unexported (golint)
    • Line 45: warning: exported const ChangedResourceKey should have comment (or a comment on this block) or be unexported (golint)
    • Line 121: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/agent/pkg/util/util.go
    • Line 6: warning: exported const Base64 should have comment (or a comment on this block) or be unexported (golint)
    • Line 9: warning: exported function Contains should have comment or be unexported (golint)
    • Line 18: warning: exported function Convert should have comment or be unexported (golint)
    • Line 23: warning: exported function MaskLeft should have comment or be unexported (golint)
    • argocd-agent/installer/pkg/fs/fs.go
    • Line 10: warning: exported function WriteFile should have comment or be unexported (golint)
    • Line 25: warning: exported function GetPackageVersionFromFile should have comment or be unexported (golint)
    • Line 30: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • argocd-agent/agent/pkg/events/rollout_test.go
    • Line 19: warning: error should be the last type when returning multiple items (golint)
    • Line 74: warning: error should be the last type when returning multiple items (golint)
    • Line 78: warning: error should be the last type when returning multiple items (golint)
    • Line 123: warning: error should be the last type when returning multiple items (golint)
    • Line 176: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/agent/pkg/startup/runner.go
    • Line 14: warning: exported type Runner should have comment or be unexported (golint)
    • Line 19: warning: exported function NewRunner should have comment or be unexported (golint)
    • Line 38: warning: exported method Runner.Run should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/api/codefresh/types.go
    • Line 7: warning: exported type CodefreshError should have comment or be unexported (golint)
    • Line 20: warning: exported type AgentApplication should have comment or be unexported (golint)
    • Line 28: warning: exported type AgentProject should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/transform/env/env_transformer_test.go
    • Line 21: warning: receiver name m should be consistent with previous receiver name api for MockArgoApi (golint)
    • Line 25: warning: receiver name m should be consistent with previous receiver name api for MockArgoApi (golint)
    • Line 29: warning: receiver name m should be consistent with previous receiver name api for MockArgoApi (golint)
    • Line 33: warning: receiver name m should be consistent with previous receiver name api for MockArgoApi (golint)
    • Line 37: warning: receiver name m should be consistent with previous receiver name api for MockArgoApi (golint)
    • Line 60: warning: receiver name m should be consistent with previous receiver name api for MockArgoApi (golint)
    • Line 70: warning: receiver name m should be consistent with previous receiver name api for MockArgoApi (golint)
    • argocd-agent/agent/pkg/scheduler/env_initializer_test.go
    • Line 22: warning: error should be the last type when returning multiple items (golint)
    • Line 77: warning: error should be the last type when returning multiple items (golint)
    • Line 81: warning: error should be the last type when returning multiple items (golint)
    • Line 116: warning: error should be the last type when returning multiple items (golint)
    • Line 157: warning: error should be the last type when returning multiple items (golint)
    • Line 179: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/agent/pkg/startup/input_validator.go
    • Line 9: warning: exported type InputValidator should have comment or be unexported (golint)
    • Line 13: warning: exported function NewInputValidator should have comment or be unexported (golint)
    • Line 17: warning: exported method InputValidator.Validate should have comment or be unexported (golint)
    • argocd-agent/installer/pkg/logger/log.go
    • Line 8: warning: exported function Warning should have comment or be unexported (golint)
    • Line 13: warning: exported function Error should have comment or be unexported (golint)
    • Line 18: warning: exported function Success should have comment or be unexported (golint)
    • Line 23: warning: exported function Info should have comment or be unexported (golint)
    • Line 27: warning: exported function SuccessTest should have comment or be unexported (golint)
    • Line 34: warning: exported function FailureTest should have comment or be unexported (golint)
    • Line 41: warning: exported function Summary should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/infra/newrelic/newrelic.go
    • Line 12: warning: exported const EventGetUsers should have comment (or a comment on this block) or be unexported (golint)
    • Line 19: warning: exported type EventParams should have comment or be unexported (golint)
    • Line 24: warning: exported type NewrelicApp should have comment or be unexported (golint)
    • Line 35: warning: exported function GetInstance should have comment or be unexported (golint)
    • argocd-agent/installer/pkg/templates/action.go
    • Line 15: warning: exported type InstallOptions should have comment or be unexported (golint)
    • Line 27: warning: exported type DeleteOptions should have comment or be unexported (golint)
    • Line 50: warning: error should be the last type when returning multiple items (golint)
    • Line 50: warning: exported function DryRunInstall should have comment or be unexported (golint)
    • Line 59: warning: error should be the last type when returning multiple items (golint)
    • Line 59: warning: exported function Install should have comment or be unexported (golint)
    • Line 92: warning: error should be the last type when returning multiple items (golint)
    • Line 92: warning: exported function Delete should have comment or be unexported (golint)
    • argocd-agent/installer/pkg/templates/executor.go
    • Line 16: warning: exported function ExecuteTemplate should have comment or be unexported (golint)
    • Line 52: warning: exported function GenerateSingleManifest should have comment or be unexported (golint)
    • Line 85: warning: exported function GetKubeObjectsFromTemplate should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/service/gitops.go
    • Line 7: warning: exported type Gitops should have comment or be unexported (golint)
    • Line 11: warning: exported type EnvironmentWrapper should have comment or be unexported (golint)
    • Line 19: warning: exported function NewGitopsService should have comment or be unexported (golint)
    • Line 23: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/agent/pkg/events/sync_test.go
    • Line 49: warning: error should be the last type when returning multiple items (golint)
    • Line 56: warning: error should be the last type when returning multiple items (golint)
    • Line 101: warning: error should be the last type when returning multiple items (golint)
    • Line 105: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/installer/pkg/kube/kube.go
    • Line 10: warning: a blank import should be only in a main or test package, or have a comment justifying it (golint)
    • Line 17: warning: exported type Kube should have comment or be unexported (golint)
    • Line 38: warning: exported type Options should have comment or be unexported (golint)
    • Line 47: warning: exported function New should have comment or be unexported (golint)
    • Line 92: warning: exported function IsLoadBalancer should have comment or be unexported (golint)
    • Line 187: warning: exported function GetAllContexts should have comment or be unexported (golint)
    • Line 203: warning: should omit 2nd value from range; this loop is equivalent to `for k := range ...` (golint)
    • argocd-agent/agent/pkg/api/argo/types.go
    • Line 7: warning: exported type ManagedResourceState should have comment or be unexported (golint)
    • Line 13: warning: exported type ManagedResourceStateMetadata should have comment or be unexported (golint)
    • Line 17: warning: exported type ManagedResourceStateSpec should have comment or be unexported (golint)
    • Line 22: warning: exported type ManagedResourceStateStatus should have comment or be unexported (golint)
    • Line 29: warning: exported type ManagedResourceStateTemplate should have comment or be unexported (golint)
    • Line 33: warning: exported type ManagedResourceTemplateSpec should have comment or be unexported (golint)
    • Line 37: warning: exported type ManagedResourceTemplateContainer should have comment or be unexported (golint)
    • Line 41: warning: exported type ApplicationResource should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/infra/store/store.go
    • Line 9: warning: exported type Environment should have comment or be unexported (golint)
    • Line 14: warning: exported type Values should have comment or be unexported (golint)
    • Line 43: warning: exported function GetStore should have comment or be unexported (golint)
    • Line 51: warning: exported function SetArgo should have comment or be unexported (golint)
    • Line 64: warning: exported function SetArgoToken should have comment or be unexported (golint)
    • Line 70: warning: exported function SetCodefresh should have comment or be unexported (golint)
    • Line 78: warning: exported function SetSyncOptions should have comment or be unexported (golint)
    • Line 85: warning: exported function SetHeartbeatError should have comment or be unexported (golint)
    • Line 91: warning: exported function SetEnvironments should have comment or be unexported (golint)
    • Line 96: warning: exported function SetGit should have comment or be unexported (golint)
    • Line 102: warning: exported function SetGitContext should have comment or be unexported (golint)
    • Line 108: warning: exported function SetAgent should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/events/application_removed.go
    • Line 7: warning: exported type ApplicationRemovedHandler should have comment or be unexported (golint)
    • Line 12: warning: exported function GetApplicationRemovedHandlerInstance should have comment or be unexported (golint)
    • Line 20: warning: exported method ApplicationRemovedHandler.Handle should have comment or be unexported (golint)
    • argocd-agent/installer/pkg/install/cmd.go
    • Line 23: warning: exported type InstallIntegration should have comment or be unexported (golint)
    • Line 28: warning: error should be the last type when returning multiple items (golint)
    • Line 28: warning: exported function Run should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/infra/git/provider/api/github_api.go
    • Line 27: warning: exported type Api should have comment or be unexported (golint)
    • Line 37: warning: error should be the last type when returning multiple items (golint)
    • Line 37: warning: exported function GetInstance should have comment or be unexported (golint)
    • Line 62: warning: error should be the last type when returning multiple items (golint)
    • Line 93: warning: error should be the last type when returning multiple items (golint)
    • Line 126: warning: error should be the last type when returning multiple items (golint)
    • Line 135: warning: error should be the last type when returning multiple items (golint)
    • Line 144: warning: error should be the last type when returning multiple items (golint)
    • Line 153: warning: error should be the last type when returning multiple items (golint)
    • Line 174: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/agent/pkg/infra/git/provider/api/gitlab_api.go
    • Line 15: warning: exported type GitlabApi should have comment or be unexported (golint)
    • Line 22: warning: exported function NewGitlabApi should have comment or be unexported (golint)
    • Line 43: warning: error should be the last type when returning multiple items (golint)
    • Line 64: warning: error should be the last type when returning multiple items (golint)
    • Line 74: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/agent/pkg/infra/git/provider/gitlab.go
    • Line 15: warning: exported type Gitlab should have comment or be unexported (golint)
    • Line 22: warning: exported function NewGitlabProvider should have comment or be unexported (golint)
    • Line 29: warning: error should be the last type when returning multiple items (golint)
    • Line 29: warning: exported method Gitlab.GetCommitByRevision should have comment or be unexported (golint)
    • Line 86: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 89: warning: error should be the last type when returning multiple items (golint)
    • Line 89: warning: exported method Gitlab.GetManifestRepoInfo should have comment or be unexported (golint)
    • Line 89: warning: receiver name gitlab should be consistent with previous receiver name gitlabInstance for Gitlab (golint)
    • argocd-agent/installer/pkg/cliconfig/cli_config.go
    • Line 10: warning: exported type CliConfigItem should have comment or be unexported (golint)
    • Line 16: warning: exported type CFCliConfig should have comment or be unexported (golint)
    • Line 24: warning: exported type CliConfig should have comment or be unexported (golint)
    • Line 28: warning: exported function NewCliConfig should have comment or be unexported (golint)
    • argocd-agent/installer/pkg/prompt/prompt.go
    • Line 10: warning: exported type Prompt should have comment or be unexported (golint)
    • Line 19: warning: exported function NewPrompt should have comment or be unexported (golint)
    • Line 78: warning: error should be the last type when returning multiple items (golint)
    • Line 94: warning: error should be the last type when returning multiple items (golint)
    • Line 116: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/installer/pkg/util/util.go
    • Line 5: warning: exported function ResolvePackageVersion should have comment or be unexported (golint)
    • Line 14: warning: exported function GetMapKeys should have comment or be unexported (golint)
    • Line 22: warning: exported function ConvertIntToStringArray should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/startup/input_factory.go
    • Line 11: warning: exported type Input should have comment or be unexported (golint)
    • Line 29: warning: exported type InputFactory should have comment or be unexported (golint)
    • Line 32: warning: exported function NewInputFactory should have comment or be unexported (golint)
    • Line 36: warning: exported method InputFactory.Create should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/infra/logger/logger.go
    • Line 8: warning: exported type Logger should have comment or be unexported (golint)
    • Line 13: warning: exported function GetLogger should have comment or be unexported (golint)
    • Line 26: warning: exported method Logger.Info should have comment or be unexported (golint)
    • Line 30: warning: exported method Logger.Infof should have comment or be unexported (golint)
    • Line 34: warning: exported method Logger.Errorf should have comment or be unexported (golint)
    • Line 42: warning: exported method Logger.ErrorE should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/events/application_created.go
    • Line 9: warning: exported type ApplicationCreatedHandler should have comment or be unexported (golint)
    • Line 14: warning: exported function GetApplicationCreatedHandlerInstance should have comment or be unexported (golint)
    • Line 22: warning: exported method ApplicationCreatedHandler.Handle should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/events/sync.go
    • Line 12: warning: exported type SyncHandler should have comment or be unexported (golint)
    • Line 20: warning: exported function GetSyncHandlerInstance should have comment or be unexported (golint)
    • Line 31: warning: exported method SyncHandler.Handle should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/transform/env/env_transformer.go
    • Line 14: warning: exported type EnvTransformer should have comment or be unexported (golint)
    • Line 18: warning: comment on exported type ETransformer should be of the form "ETransformer ..." (with optional leading article) (golint)
    • Line 25: warning: exported function GetEnvTransformerInstance should have comment or be unexported (golint)
    • Line 132: warning: error should be the last type when returning multiple items (golint)
    • Line 132: warning: exported method EnvTransformer.PrepareEnvironment should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/infra/git/provider/github.go
    • Line 10: warning: exported type Github should have comment or be unexported (golint)
    • Line 16: warning: exported function NewGithubProvider should have comment or be unexported (golint)
    • Line 23: warning: error should be the last type when returning multiple items (golint)
    • Line 23: warning: exported method Github.GetCommitByRevision should have comment or be unexported (golint)
    • Line 53: warning: error should be the last type when returning multiple items (golint)
    • Line 53: warning: exported method Github.GetManifestRepoInfo should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/startup/input_store.go
    • Line 9: warning: exported type InputStore should have comment or be unexported (golint)
    • Line 13: warning: exported function NewInputStore should have comment or be unexported (golint)
    • Line 17: warning: exported method InputStore.Store should have comment or be unexported (golint)
    • argocd-agent/installer/pkg/cfeventsender/cf_event_sender.go
    • Line 6: warning: exported const STATUS_SUCCESS should have comment (or a comment on this block) or be unexported (golint)
    • Line 16: warning: exported type CfEventSender should have comment or be unexported (golint)
    • Line 21: warning: exported function New should have comment or be unexported (golint)
    • Line 25: warning: exported method CfEventSender.WithCustomCodefreshApi should have comment or be unexported (golint)
    • Line 30: warning: exported method CfEventSender.Success should have comment or be unexported (golint)
    • Line 37: warning: exported method CfEventSender.Fail should have comment or be unexported (golint)
    • argocd-agent/agent/pkg/infra/queue/queue_processor.go
    • Line 15: warning: exported type QueueProcessor should have comment or be unexported (golint)
    • Line 19: warning: exported type EnvQueueProcessor should have comment or be unexported (golint)
    • Line 24: warning: exported method EnvQueueProcessor.New should have comment or be unexported (golint)
    • Line 31: warning: error should be the last type when returning multiple items (golint)
    • Line 49: warning: exported method EnvQueueProcessor.Run should have comment or be unexported (golint)
    • argocd-agent/installer/pkg/install/cmd_test.go
    • Line 46: warning: error should be the last type when returning multiple items (golint)
    • Line 53: warning: error should be the last type when returning multiple items (golint)
    • Line 97: warning: error should be the last type when returning multiple items (golint)
    • Line 101: warning: error should be the last type when returning multiple items (golint)
    • argocd-agent/installer/pkg/update/handler/handler.go
    • Line 16: warning: exported type UpdateHandler should have comment or be unexported (golint)
    • Line 23: warning: exported function New should have comment or be unexported (golint)
    • Line 30: warning: exported method UpdateHandler.Run should have comment or be unexported (golint)
    • Line 52: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
    • Line 64: warning: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign98%

IneffAssign detects ineffectual assignments in Go code.


misspell98%

Misspell Finds commonly misspelled English words