Skip to content

Commit

Permalink
cleanup: resolves cyclop linter issue
Browse files Browse the repository at this point in the history
this commit adds `// nolint:cyclop` for the
fucntions whose complexity is above 20

Updates: ceph#1586

Signed-off-by: Yati Padia <ypadia@redhat.com>
  • Loading branch information
yati1998 authored and mergify-bot committed Jul 22, 2021
1 parent 1b2c87f commit 0d3c72d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion e2e/staticpvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock, checkI
return err
}

// nolint:gocyclo // reduce complexity
// nolint:gocyclo,cyclop // reduce complexity
func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) error {
opt := make(map[string]string)
var (
Expand Down
4 changes: 2 additions & 2 deletions e2e/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func writeDataAndCalChecksum(app *v1.Pod, opt *metav1.ListOptions, f *framework.
return checkSum, nil
}

// nolint:gocyclo,gocognit,nestif // reduce complexity
// nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
func validatePVCClone(
totalCount int,
sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath string,
Expand Down Expand Up @@ -728,7 +728,7 @@ func validatePVCClone(
validateRBDImageCount(f, 0, defaultRBDPool)
}

// nolint:gocyclo,gocognit,nestif // reduce complexity
// nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
func validatePVCSnapshot(
totalCount int,
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,
Expand Down
4 changes: 2 additions & 2 deletions internal/cephfs/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func checkContentSource(
}

// CreateVolume creates a reservation and the volume in backend, if it is not already present.
// nolint:gocognit,gocyclo,nestif // TODO: reduce complexity
// nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity
func (cs *ControllerServer) CreateVolume(
ctx context.Context,
req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
Expand Down Expand Up @@ -508,7 +508,7 @@ func (cs *ControllerServer) ControllerExpandVolume(

// CreateSnapshot creates the snapshot in backend and stores metadata
// in store
// nolint:gocyclo // golangci-lint did not catch this earlier, needs to get fixed late
// nolint:gocyclo,cyclop // golangci-lint did not catch this earlier, needs to get fixed late
func (cs *ControllerServer) CreateSnapshot(
ctx context.Context,
req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/cephfs/fsjournal.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ because, the order of omap creation and deletion are inverse of each other, and
request name lock, and hence any stale omaps are leftovers from incomplete transactions and are
hence safe to garbage collect.
*/
// nolint:gocognit,gocyclo,nestif // TODO: reduce complexity
// nolint:gocognit,gocyclo,nestif,cyclop // TODO: reduce complexity
func checkVolExists(ctx context.Context,
volOptions,
parentVolOpt *volumeOptions,
Expand Down
2 changes: 1 addition & 1 deletion internal/util/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func setConfigString(option *string, config map[string]interface{}, key string)
// these settings will be used when connecting to the Vault service with
// vc.connectVault().
//
// nolint:gocyclo // iterating through many config options, not complex at all.
// nolint:gocyclo,cyclop // iterating through many config options, not complex at all.
func (vc *vaultConnection) initConnection(config map[string]interface{}) error {
vaultConfig := make(map[string]interface{})
keyContext := make(map[string]string)
Expand Down
2 changes: 1 addition & 1 deletion internal/util/vault_tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func (kms *VaultTokensKMS) setTokenName(config map[string]interface{}) error {
// initCertificates updates the kms.vaultConfig with the options from config
// it calls the kubernetes secrets and get the required data.

// nolint:gocyclo // iterating through many config options, not complex at all.
// nolint:gocyclo,cyclop // iterating through many config options, not complex at all.
func (vtc *vaultTenantConnection) initCertificates(config map[string]interface{}) error {
vaultConfig := make(map[string]interface{})

Expand Down

0 comments on commit 0d3c72d

Please sign in to comment.