Showing 41 of 51 total issues
Method daemonset.Process
has 11 return statements (exceeds 4 allowed). Open
Open
func (d daemonset) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != daemonsetGVC {
return false, nil, nil
}
dae := appsv1.DaemonSet{}
Method svc.Process
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r svc) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != svcGVC {
return false, nil, nil
}
service := corev1.Service{}
Function Start
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func Start(stdin io.Reader, config config.Config) error {
err := config.Validate()
if err != nil {
return err
}
Method crd.Process
has 9 return statements (exceeds 4 allowed). Open
Open
func (c crd) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != crdGVC {
return false, nil, nil
}
name, ok, err := unstructured.NestedString(obj.Object, "spec", "names", "singular")
Method secret.Process
has 9 return statements (exceeds 4 allowed). Open
Open
func (d secret) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != configMapGVC {
return false, nil, nil
}
sec := corev1.Secret{}
Function ProcessSpec
has 8 return statements (exceeds 4 allowed). Open
Open
func ProcessSpec(objName string, appMeta helmify.AppMetadata, spec corev1.PodSpec) (map[string]interface{}, helmify.Values, error) {
values, err := processPodSpec(objName, appMeta, &spec)
if err != nil {
return nil, nil, err
}
Function processPodContainer
has 8 return statements (exceeds 4 allowed). Open
Open
func processPodContainer(name string, appMeta helmify.AppMetadata, c corev1.Container, values *helmify.Values) (corev1.Container, error) {
index := strings.LastIndex(c.Image, ":")
if strings.Contains(c.Image, "@") && strings.Count(c.Image, ":") >= 2 {
last := strings.LastIndex(c.Image, ":")
index = strings.LastIndex(c.Image[:last], ":")
Method output.Create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (o output) Create(chartDir, chartName string, crd bool, certManagerAsSubchart bool, certManagerVersion string, templates []helmify.Template, filenames []string) error {
Method clusterRoleBinding.Process
has 6 return statements (exceeds 4 allowed). Open
Open
func (r clusterRoleBinding) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != clusterRoleBindingGVC {
return false, nil, nil
}
Method role.Process
has 6 return statements (exceeds 4 allowed). Open
Open
func (r role) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
var aggregationRule string
if obj.GroupVersionKind() != clusterRoleGVC && obj.GroupVersionKind() != roleGVC {
return false, nil, nil
Function processContainers
has 6 return statements (exceeds 4 allowed). Open
Open
func processContainers(objName string, values helmify.Values, containerType string, containers []interface{}) ([]interface{}, helmify.Values, error) {
for i := range containers {
containerName := strcase.ToLowerCamel((containers[i].(map[string]interface{})["name"]).(string))
res, exists, err := unstructured.NestedMap(values, objName, containerName, "resources")
if err != nil {
Method pdb.Process
has 6 return statements (exceeds 4 allowed). Open
Open
func (r pdb) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != pdbGVC {
return false, nil, nil
}
pdb := policyv1.PodDisruptionBudget{}
Method cert.Process
has 6 return statements (exceeds 4 allowed). Open
Open
func (c cert) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != certGVC {
return false, nil, nil
}
name := appMeta.TrimName(obj.GetName())
Method configMap.Process
has 6 return statements (exceeds 4 allowed). Open
Open
func (d configMap) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != configMapGVC {
return false, nil, nil
}
var meta, immutable, binaryData, data string
Method roleBinding.Process
has 6 return statements (exceeds 4 allowed). Open
Open
func (r roleBinding) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != roleBindingGVC {
return false, nil, nil
}
rb := rbacv1.RoleBinding{}
Function templateSpecVal
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func templateSpecVal(val any, values *helmify.Values, specMap map[string]interface{}, objName string, fieldName ...string) error {
Method ingress.Process
has 5 return statements (exceeds 4 allowed). Open
Open
func (r ingress) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != ingressGVC {
return false, nil, nil
}
ing := networkingv1.Ingress{}
Method output.Create
has 5 return statements (exceeds 4 allowed). Open
Open
func (o output) Create(chartDir, chartName string, crd bool, certManagerAsSubchart bool, certManagerVersion string, templates []helmify.Template, filenames []string) error {
err := initChartDir(chartDir, chartName, crd, certManagerAsSubchart, certManagerVersion)
if err != nil {
return err
}
Function overwriteTemplateFile
has 5 return statements (exceeds 4 allowed). Open
Open
func overwriteTemplateFile(filename, chartDir string, crd bool, templates []helmify.Template) error {
// pull in crd-dir setting and siphon crds into folder
var subdir string
if strings.Contains(filename, "crd") && crd {
subdir = "crds"
Method secret.Process
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func (d secret) Process(appMeta helmify.AppMetadata, obj *unstructured.Unstructured) (bool, helmify.Template, error) {
if obj.GroupVersionKind() != configMapGVC {
return false, nil, nil
}
sec := corev1.Secret{}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"