Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable unhelpful linters #957

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ linters-settings:
SPDX-License-Identifier: Apache-2.0
misspell:
locale: US
wsl:
allow-trailing-comment: true
enforce-err-cuddling: true

linters:
enable-all: true
Expand All @@ -43,6 +40,8 @@ linters:
- godot
- godox
- paralleltest
- nlreturn
- wsl
- goerr113 # TODO: Need to introduce error definition and bring this back
- goheader # TODO: Introduce back post fixing linter errors
- gci
Expand Down
13 changes: 0 additions & 13 deletions controllers/drcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func (r *DRClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
}

ctrl.Log.Info(fmt.Sprintf("DRCluster: Filtering DRPC (%s/%s)", drpc.Name, drpc.Namespace))

return filterDRPC(drpc)
}))

Expand All @@ -97,7 +96,6 @@ func (r *DRClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
}

ctrl.Log.Info(fmt.Sprintf("DRCluster: Filtering ManifestWork (%s/%s)", mw.Name, mw.Namespace))

return filterDRClusterMW(mw)
}))

Expand All @@ -110,7 +108,6 @@ func (r *DRClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
}

ctrl.Log.Info(fmt.Sprintf("DRCluster: Filtering MCV (%s/%s)", mcv.Name, mcv.Namespace))

return filterDRClusterMCV(mcv)
}))

Expand Down Expand Up @@ -180,7 +177,6 @@ func DRPCUpdateOfInterest(oldDRPC, newDRPC *ramen.DRPlacementControl) bool {
log.Info("Processing DRPC failover cluster change event",
"name", newDRPC.GetName(),
"namespace", newDRPC.GetNamespace())

return true
}

Expand All @@ -193,14 +189,12 @@ func DRPCUpdateOfInterest(oldDRPC, newDRPC *ramen.DRPlacementControl) bool {
log.Info("Processing DRPC failed over event",
"name", newDRPC.GetName(),
"namespace", newDRPC.GetNamespace())

return true
}

log.Info("Ignoring DRPC failed over event",
"name", newDRPC.GetName(),
"namespace", newDRPC.GetNamespace())

return false
}

Expand Down Expand Up @@ -509,17 +503,14 @@ func (u *drclusterInstance) statusUpdate() error {
if err := u.client.Status().Update(u.ctx, u.object); err != nil {
u.log.Info(fmt.Sprintf("Failed to update drCluster status (%s/%s/%v)",
u.object.Name, u.object.Namespace, err))

return fmt.Errorf("failed to update drCluster status (%s/%s)", u.object.Name, u.object.Namespace)
}

u.log.Info(fmt.Sprintf("Updated drCluster Status %+v", u.object.Status))

return nil
}

u.log.Info(fmt.Sprintf("Nothing to update %+v", u.object.Status))

return nil
}

Expand Down Expand Up @@ -647,7 +638,6 @@ func (u *drclusterInstance) clusterUnfence() (bool, error) {

if requeue {
u.log.Info("requing as cluster unfence operation is not complete")

return requeue, nil
}

Expand Down Expand Up @@ -710,7 +700,6 @@ func (u *drclusterInstance) fenceClusterOnCluster(peerCluster *ramen.DRCluster)
"fencing operation not successful")

u.log.Info("Fencing operation not successful", "cluster", u.object.Name)

return true, fmt.Errorf("fencing operation result not successful")
}

Expand Down Expand Up @@ -776,7 +765,6 @@ func (u *drclusterInstance) unfenceClusterOnCluster(peerCluster *ramen.DRCluster
"unfencing operation not successful")

u.log.Info("Unfencing operation not successful", "cluster", u.object.Name)

return true, fmt.Errorf("un operation result not successful")
}

Expand Down Expand Up @@ -1241,7 +1229,6 @@ func (u *drclusterInstance) createNFManifestWork(targetCluster *ramen.DRCluster,
u.object.Name, u.object.Namespace,
peerCluster.Name, nf, annotations); err != nil {
log.Error(err, "failed to create or update NetworkFence manifest")

return fmt.Errorf("failed to create or update NetworkFence manifest in cluster %s to fence off cluster %s (%w)",
peerCluster.Name, targetCluster.Name, err)
}
Expand Down
9 changes: 2 additions & 7 deletions controllers/drcluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ func updateDRClusterManifestWorkStatus(clusterNamespace string) {

Eventually(func() bool {
err := apiReader.Get(context.TODO(), manifestLookupKey, mw)

return err == nil
}, timeout, interval).Should(BeTrue(),
fmt.Sprintf("failed to get manifest for DRCluster %s", clusterNamespace))
Expand All @@ -244,18 +243,14 @@ func updateDRClusterManifestWorkStatus(clusterNamespace string) {
}

retryErr := retry.RetryOnConflict(retry.DefaultBackoff, func() error {
var err error

err = apiReader.Get(context.TODO(), manifestLookupKey, mw)
err := apiReader.Get(context.TODO(), manifestLookupKey, mw)
if err != nil {
return err
}

mw.Status = DRClusterStatusConditions

err = k8sClient.Status().Update(context.TODO(), mw)

return err
return k8sClient.Status().Update(context.TODO(), mw)
})

Expect(retryErr).NotTo(HaveOccurred())
Expand Down