Showing 42 of 93 total issues

Function setupSetter has a Cognitive Complexity of 109 (exceeds 20 allowed). Consider refactoring.
Open

func setupSetter(meta *Meta, fieldName string, record interface{}) {
    nestedField := strings.Contains(fieldName, ".")

    // Setup nested fields
    if nestedField {
Severity: Minor
Found in resource/meta.go - About 1 day to fix

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"

Further reading

File meta_test.go has 911 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package resource_test

import (
    "database/sql/driver"
    "fmt"
Severity: Major
Found in resource/meta_test.go - About 1 day to fix

    Function ConvertFormToMetaValues has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
    Open

    func ConvertFormToMetaValues(request *http.Request, metaors []Metaor, prefix string) (*MetaValues, error) {
        metaValues := &MetaValues{}
        metaorsMap := map[string]Metaor{}
        convertedNextLevel := map[string]bool{}
        nestedStructIndex := map[string]int{}
    Severity: Minor
    Found in resource/schema.go - About 5 hrs to fix

    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"

    Further reading

    File gulpfile.js has 402 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    
    let gulp = require("gulp"),
      babel = require("gulp-babel"),
      eslint = require("gulp-eslint"),
    Severity: Minor
    Found in gulpfile.js - About 5 hrs to fix

      Function adminTasks has 131 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function adminTasks() {
        let pathto = function(file) {
          return "../admin/views/assets/" + file;
        };
        let scripts = {
      Severity: Major
      Found in gulpfile.js - About 5 hrs to fix

        Method processor.decode has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
        Open

        func (processor *processor) decode() (errs []error) {
            if processor.checkSkipLeft() || processor.MetaValues == nil {
                return
            }
        
        
        Severity: Minor
        Found in resource/processor.go - About 4 hrs to fix

        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"

        Further reading

        Function moduleTasks has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function moduleTasks(moduleNames) {
          let moduleName = moduleNames.name,
            subModuleName = moduleNames.subName,
            useSubName = moduleNames.useSubName;
        
        
        Severity: Major
        Found in gulpfile.js - About 4 hrs to fix

          Function setupSetter has 137 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func setupSetter(meta *Meta, fieldName string, record interface{}) {
              nestedField := strings.Contains(fieldName, ".")
          
              // Setup nested fields
              if nestedField {
          Severity: Major
          Found in resource/meta.go - About 4 hrs to fix

            Function ParamsMatch has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
            Open

            func ParamsMatch(source string, pth string) (url.Values, string, bool) {
                var (
                    i, j int
                    p    = make(url.Values)
                    ext  = path.Ext(pth)
            Severity: Minor
            Found in utils/params.go - About 2 hrs to fix

            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"

            Further reading

            File meta.go has 525 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package resource
            
            import (
                "database/sql"
                "errors"
            Severity: Minor
            Found in resource/meta.go - About 2 hrs to fix

              Function pathto has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                let pathto = function(file) {
                  if (moduleName && subModuleName) {
                    if (subModuleName == "admin") {
                      return "../" + moduleName + "/views/assets/" + file;
                    } else if (subModuleName == "enterprise") {
              Severity: Minor
              Found in gulpfile.js - About 1 hr to fix

                Function moduleTasks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function moduleTasks(moduleNames) {
                  let moduleName = moduleNames.name,
                    subModuleName = moduleNames.subName,
                    useSubName = moduleNames.useSubName;
                
                
                Severity: Minor
                Found in gulpfile.js - About 1 hr to fix

                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"

                Further reading

                Function ConvertFormToMetaValues has 68 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func ConvertFormToMetaValues(request *http.Request, metaors []Metaor, prefix string) (*MetaValues, error) {
                    metaValues := &MetaValues{}
                    metaorsMap := map[string]Metaor{}
                    convertedNextLevel := map[string]bool{}
                    nestedStructIndex := map[string]int{}
                Severity: Minor
                Found in resource/schema.go - About 1 hr to fix

                  Function setupValuer has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func setupValuer(meta *Meta, fieldName string, record interface{}) {
                      nestedField := strings.Contains(fieldName, ".")
                  
                      // Setup nested fields
                      if nestedField {
                  Severity: Minor
                  Found in resource/meta.go - About 1 hr to fix

                  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"

                  Further reading

                  Function ParamsMatch has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func ParamsMatch(source string, pth string) (url.Values, string, bool) {
                      var (
                          i, j int
                          p    = make(url.Values)
                          ext  = path.Ext(pth)
                  Severity: Minor
                  Found in utils/params.go - About 1 hr to fix

                    Function TestJoinURL has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func TestJoinURL(t *testing.T) {
                        var cases = []struct {
                            original string
                            input    []interface{}
                            want     string
                    Severity: Minor
                    Found in utils/utils_test.go - About 1 hr to fix

                      Function convertMapToMetaValues has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func convertMapToMetaValues(values map[string]interface{}, metaors []Metaor) (*MetaValues, error) {
                          metaValues := &MetaValues{}
                          metaorMap := make(map[string]Metaor)
                          for _, metaor := range metaors {
                              metaorMap[metaor.GetName()] = metaor
                      Severity: Minor
                      Found in resource/schema.go - About 55 mins to fix

                      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"

                      Further reading

                      Function HandleManyToMany has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func HandleManyToMany(context *qor.Context, scope *gorm.Scope, meta *Meta, record interface{}, metaValue *MetaValue, field reflect.Value, fieldHasVersion bool) {
                      Severity: Major
                      Found in resource/meta.go - About 50 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        if isPtr {
                                            field.Set(reflect.Append(field, value))
                                        } else {
                                            field.Set(reflect.Append(field, value.Elem()))
                                        }
                        Severity: Major
                        Found in resource/meta_value.go - About 45 mins to fix

                          Function ParamsMatch has 7 return statements (exceeds 4 allowed).
                          Open

                          func ParamsMatch(source string, pth string) (url.Values, string, bool) {
                              var (
                                  i, j int
                                  p    = make(url.Values)
                                  ext  = path.Ext(pth)
                          Severity: Major
                          Found in utils/params.go - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language