Showing 93 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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              func TestSwitchRecordToNewVersionIfNeeded_Uint64ID(t *testing.T) {
                  db := testutils.GetTestDB()
                  testutils.ResetDBTables(db, &CollectionWithVersionAndUint64PrimaryKey{})
                  registerVersionNameCallback(db)
              
              
              Severity: Major
              Found in resource/meta_test.go and 2 other locations - About 2 hrs to fix
              resource/meta_test.go on lines 965..982
              resource/meta_test.go on lines 1029..1046

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 204.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              func TestSwitchRecordToNewVersionIfNeeded(t *testing.T) {
                  db := testutils.GetTestDB()
                  testutils.ResetDBTables(db, &CollectionWithVersion{})
                  registerVersionNameCallback(db)
              
              
              Severity: Major
              Found in resource/meta_test.go and 2 other locations - About 2 hrs to fix
              resource/meta_test.go on lines 984..1000
              resource/meta_test.go on lines 1029..1046

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 204.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              func TestSwitchRecordToNewVersionIfNeeded_WithNoAssignVersionMethod(t *testing.T) {
                  db := testutils.GetTestDB()
                  testutils.ResetDBTables(db, &Athlete{})
                  registerVersionNameCallback(db)
              
              
              Severity: Major
              Found in resource/meta_test.go and 2 other locations - About 2 hrs to fix
              resource/meta_test.go on lines 965..982
              resource/meta_test.go on lines 984..1000

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 204.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    gulp.task("release_css", function() {
                      return gulp
                        .src(styles.qorAdmin)
                        .pipe(concat("qor_admin_default.css"))
                        .pipe(gulp.dest(styles.dest));
                  Severity: Major
                  Found in gulpfile.js and 1 other location - About 1 hr to fix
                  gulpfile.js on lines 153..158

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 64.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    gulp.task("release_js", function() {
                      return gulp
                        .src(scripts.qorAdmin)
                        .pipe(concat("qor_admin_default.js"))
                        .pipe(gulp.dest(scripts.dest));
                  Severity: Major
                  Found in gulpfile.js and 1 other location - About 1 hr to fix
                  gulpfile.js on lines 160..165

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 64.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      for _, p := range associatedProducts {
                          if p.ID == p1.ID && p.CompositePrimaryKey == fmt.Sprintf("%d%s%s", p1.ID, resource.CompositePrimaryKeySeparator, p1.GetVersionName()) {
                              i += 1
                          }
                  
                  
                  Severity: Major
                  Found in resource/meta_test.go and 1 other location - About 1 hr to fix
                  resource/meta_test.go on lines 625..633

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 150.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language