Skip to content

Commit

Permalink
Fix(lint): Increase minimum cyclomatic complexity and exclude 'packag…
Browse files Browse the repository at this point in the history
…e-comments' & 'exported' lint errors

Signed-off-by: motilayo <joshuaagboola@live.ca>
  • Loading branch information
motilayo committed Nov 28, 2022
1 parent cbc40e4 commit 16bcc95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ linters-settings:

gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 30
min-complexity: 32

maligned:
# print struct with more effective memory layout or not, false by default
Expand Down Expand Up @@ -179,6 +179,14 @@ issues:
linters:
- revive

- text: "package-comments:"
linters:
- revive

- text: "exported:"
linters:
- revive

# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
Expand Down
5 changes: 2 additions & 3 deletions controllers/configuration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ func (r *ConfigurationReconciler) preCheck(ctx context.Context, configuration *v
}
meta.JobEnv = jobEnv
}

if err := meta.getCredentials(ctx, k8sClient, p); err != nil {
return err
}
Expand All @@ -557,9 +556,9 @@ func (r *ConfigurationReconciler) preCheck(ctx context.Context, configuration *v
if meta.GitCredentialsReference != nil {
gitCreds, err := tfcfg.GetGitCredentialsFromConfiguration(ctx, k8sClient, meta.GitCredentialsReference.Namespace, meta.GitCredentialsReference.Name)
if gitCreds == nil {
msg := "Git credentials Secret not found"
msg := "git credentials Secret not found"
if err != nil {
msg = fmt.Sprintf("git credentials Secret not found: %s", err)
msg = err.Error()
}
if updateStatusErr := meta.updateApplyStatus(ctx, k8sClient, types.Authorizing, msg); updateStatusErr != nil {
return errors.Wrap(updateStatusErr, msg)
Expand Down

0 comments on commit 16bcc95

Please sign in to comment.