cleanup: resolves cyclop linter issue

this commit adds `// nolint:cyclop` for the
fucntions whose complexity is above 20

Updates: #1586

Signed-off-by: Yati Padia <ypadia@redhat.com>
This commit is contained in:
Yati Padia 2021-07-12 16:29:25 +05:30 committed by mergify[bot]
parent e85c0eedc4
commit 172b66f73f
6 changed files with 8 additions and 8 deletions

View File

@ -188,7 +188,7 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock, checkI
return err return err
} }
// nolint:gocyclo // reduce complexity // nolint:gocyclo,cyclop // reduce complexity
func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) error { func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) error {
opt := make(map[string]string) opt := make(map[string]string)
var ( var (

View File

@ -527,7 +527,7 @@ func writeDataAndCalChecksum(app *v1.Pod, opt *metav1.ListOptions, f *framework.
return checkSum, nil return checkSum, nil
} }
// nolint:gocyclo,gocognit,nestif // reduce complexity // nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
func validatePVCClone( func validatePVCClone(
totalCount int, totalCount int,
sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath string, sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath string,
@ -728,7 +728,7 @@ func validatePVCClone(
validateRBDImageCount(f, 0, defaultRBDPool) validateRBDImageCount(f, 0, defaultRBDPool)
} }
// nolint:gocyclo,gocognit,nestif // reduce complexity // nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
func validatePVCSnapshot( func validatePVCSnapshot(
totalCount int, totalCount int,
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,

View File

@ -145,7 +145,7 @@ func checkContentSource(
} }
// CreateVolume creates a reservation and the volume in backend, if it is not already present. // 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( func (cs *ControllerServer) CreateVolume(
ctx context.Context, ctx context.Context,
req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) { req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) {
@ -508,7 +508,7 @@ func (cs *ControllerServer) ControllerExpandVolume(
// CreateSnapshot creates the snapshot in backend and stores metadata // CreateSnapshot creates the snapshot in backend and stores metadata
// in store // 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( func (cs *ControllerServer) CreateSnapshot(
ctx context.Context, ctx context.Context,
req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) { req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {

View File

@ -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 request name lock, and hence any stale omaps are leftovers from incomplete transactions and are
hence safe to garbage collect. 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, func checkVolExists(ctx context.Context,
volOptions, volOptions,
parentVolOpt *volumeOptions, parentVolOpt *volumeOptions,

View File

@ -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 // these settings will be used when connecting to the Vault service with
// vc.connectVault(). // 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 { func (vc *vaultConnection) initConnection(config map[string]interface{}) error {
vaultConfig := make(map[string]interface{}) vaultConfig := make(map[string]interface{})
keyContext := make(map[string]string) keyContext := make(map[string]string)

View File

@ -339,7 +339,7 @@ func (kms *VaultTokensKMS) setTokenName(config map[string]interface{}) error {
// initCertificates updates the kms.vaultConfig with the options from config // initCertificates updates the kms.vaultConfig with the options from config
// it calls the kubernetes secrets and get the required data. // 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 { func (vtc *vaultTenantConnection) initCertificates(config map[string]interface{}) error {
vaultConfig := make(map[string]interface{}) vaultConfig := make(map[string]interface{})