Merge pull request #461 from RainbowMango/pr_enable_gocyclo
Enable gocyclo static check
This commit is contained in:
commit
2a8dd53604
|
@ -42,12 +42,16 @@ linters:
|
|||
- unused
|
||||
- varcheck
|
||||
# other linters supported by golangci-lint.
|
||||
- gocyclo
|
||||
- gosec
|
||||
- whitespace
|
||||
|
||||
linters-settings:
|
||||
goimports:
|
||||
local-prefixes: github.com/karmada-io/karmada
|
||||
gocyclo:
|
||||
# minimal cyclomatic complexity to report
|
||||
min-complexity: 15
|
||||
|
||||
issues:
|
||||
# The list of ids of default excludes to include or disable. By default it's empty.
|
||||
|
|
|
@ -151,6 +151,8 @@ func (j *CommandJoinOption) AddFlags(flags *pflag.FlagSet) {
|
|||
}
|
||||
|
||||
// RunJoin is the implementation of the 'join' command.
|
||||
//nolint:gocyclo
|
||||
// Note: ignore the cyclomatic complexity issue to get gocyclo on board. Tracked by: https://github.com/karmada-io/karmada/issues/460
|
||||
func RunJoin(cmdOut io.Writer, karmadaConfig KarmadaConfig, opts CommandJoinOption) error {
|
||||
klog.V(1).Infof("joining cluster. cluster name: %s", opts.ClusterName)
|
||||
klog.V(1).Infof("joining cluster. cluster namespace: %s", opts.ClusterNamespace)
|
||||
|
|
|
@ -320,6 +320,8 @@ func (s *Scheduler) getPlacement(resourceBinding *workv1alpha1.ResourceBinding)
|
|||
return placement, string(placementBytes), nil
|
||||
}
|
||||
|
||||
//nolint:gocyclo
|
||||
// Note: ignore the cyclomatic complexity issue to get gocyclo on board. Tracked by: https://github.com/karmada-io/karmada/issues/460
|
||||
func (s *Scheduler) getScheduleType(key string) ScheduleType {
|
||||
ns, name, err := cache.SplitMetaNamespaceKey(key)
|
||||
if err != nil {
|
||||
|
|
|
@ -151,6 +151,8 @@ func FetchWorkload(dynamicClient dynamic.Interface, restMapper meta.RESTMapper,
|
|||
}
|
||||
|
||||
// EnsureWork ensure Work to be created or updated.
|
||||
//nolint:gocyclo
|
||||
// Note: ignore the cyclomatic complexity issue to get gocyclo on board. Tracked by: https://github.com/karmada-io/karmada/issues/460
|
||||
func EnsureWork(c client.Client, workload *unstructured.Unstructured, clusterNames []string, overrideManager overridemanager.OverrideManager,
|
||||
binding metav1.Object, scope apiextensionsv1.ResourceScope) error {
|
||||
referenceRSP, desireReplicaInfos, err := calculateReplicasIfNeeded(c, workload, clusterNames)
|
||||
|
|
|
@ -58,6 +58,9 @@ func retainPodFields(desiredObj, clusterObj *unstructured.Unstructured) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// retainServiceFields updates the desired service object with values retained from the cluster object.
|
||||
//nolint:gocyclo
|
||||
// Note: ignore the cyclomatic complexity issue to get gocyclo on board. Tracked by: https://github.com/karmada-io/karmada/issues/460
|
||||
func retainServiceFields(desiredObj, clusterObj *unstructured.Unstructured) error {
|
||||
// healthCheckNodePort is allocated by APIServer and unchangeable, so it should be retained while updating
|
||||
healthCheckNodePort, ok, err := unstructured.NestedInt64(clusterObj.Object, "spec", "healthCheckNodePort")
|
||||
|
|
Loading…
Reference in New Issue