cjtterabytesoft/yii2-jvectormap

View on GitHub

Showing 117 of 117 total issues

File jquery-jvectormap.min.js has 2562 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * jVectorMap version 2.0.4
 *
 * Copyright 2011-2014, Kirill Lebedev
 *
Severity: Major
Found in assets/js/jquery-jvectormap.min.js - About 1 wk to fix

    Function setValues has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

      setValues: function(values) {
        var max = -Number.MAX_VALUE,
            min = Number.MAX_VALUE,
            val,
            cc,
    Severity: Minor
    Found in assets/js/jquery-jvectormap.min.js - 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

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

        if (this.defaultHeight * this.scale <= this.height) {
          maxTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
          minTransY = (this.height - this.defaultHeight * this.scale) / (2 * this.scale);
        } else {
          maxTransY = 0;
    Severity: Major
    Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 5 hrs to fix
    assets/js/jquery-jvectormap.min.js on lines 2311..2317

    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 151.

    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

        if (this.defaultWidth * this.scale <= this.width) {
          maxTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
          minTransX = (this.width - this.defaultWidth * this.scale) / (2 * this.scale);
        } else {
          maxTransX = 0;
    Severity: Major
    Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 5 hrs to fix
    assets/js/jquery-jvectormap.min.js on lines 2319..2325

    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 151.

    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

    prototype has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    jvm.Map.prototype = {
      transX: 0,
      transY: 0,
      scale: 1,
      baseTransX: 0,
    Severity: Minor
    Found in assets/js/jquery-jvectormap.min.js - About 5 hrs to fix

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

        min: function(values){
          var min = Number.MAX_VALUE,
              i;
      
          if (values instanceof Array) {
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 4 hrs to fix
      assets/js/jquery-jvectormap.min.js on lines 298..316

      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 129.

      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

        max: function(values){
          var max = Number.MIN_VALUE,
              i;
      
          if (values instanceof Array) {
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 4 hrs to fix
      assets/js/jquery-jvectormap.min.js on lines 278..296

      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 129.

      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

                    if (touches[0].pageX > touches[1].pageX) {
                      centerTouchX = touches[1].pageX + (touches[0].pageX - touches[1].pageX) / 2;
                    } else {
                      centerTouchX = touches[0].pageX + (touches[1].pageX - touches[0].pageX) / 2;
                    }
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 4 hrs to fix
      assets/js/jquery-jvectormap.min.js on lines 2449..2453

      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 117.

      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

                    if (touches[0].pageY > touches[1].pageY) {
                      centerTouchY = touches[1].pageY + (touches[0].pageY - touches[1].pageY) / 2;
                    } else {
                      centerTouchY = touches[0].pageY + (touches[1].pageY - touches[0].pageY) / 2;
                    }
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 4 hrs to fix
      assets/js/jquery-jvectormap.min.js on lines 2444..2448

      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 117.

      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 bindContainerTouchEvents has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        bindContainerTouchEvents: function(){
          var touchStartScale,
              touchStartDistance,
              map = this,
              touchX,
      Severity: Minor
      Found in assets/js/jquery-jvectormap.min.js - About 3 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

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

              n = Math.log( Math.cos(fi1) * (1 / Math.cos(fi2)) ) / Math.log( Math.tan( Math.PI / 4 + fi2 / 2) * (1 / Math.tan( Math.PI / 4 + fi1 / 2) ) ),
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 3 hrs to fix
      assets/js/jquery-jvectormap.min.js on lines 1824..1824

      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 105.

      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

              n = Math.log( Math.cos(fi1) * (1 / Math.cos(fi2)) ) / Math.log( Math.tan( Math.PI / 4 + fi2 / 2) * (1 / Math.tan( Math.PI / 4 + fi1 / 2) ) ),
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 3 hrs to fix
      assets/js/jquery-jvectormap.min.js on lines 1850..1850

      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 105.

      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 setFocus has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

        setFocus: function(config){
          var bbox,
              itemBbox,
              newBbox,
              codes,
      Severity: Minor
      Found in assets/js/jquery-jvectormap.min.js - About 3 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

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

          for(i = 0, l = groups.length; i < l; i++) {
            groups[i].coordsize = width+' '+height;
            groups[i].style.width = width+'px';
            groups[i].style.height = height+'px';
          }
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 3 hrs to fix
      assets/js/jquery-jvectormap.min.js on lines 980..984

      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 101.

      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

          for(i = 0, l = paths.length; i < l; i++) {
            paths[i].coordsize = width+' '+height;
            paths[i].style.width = width+'px';
            paths[i].style.height = height+'px';
          }
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 3 hrs to fix
      assets/js/jquery-jvectormap.min.js on lines 986..990

      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 101.

      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 pathSvgToVml has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      jvm.VMLPathElement.pathSvgToVml = function(path) {
        var cx = 0, cy = 0, ctrlx, ctrly;
      
        path = path.replace(/(-?\d+)e(-?\d+)/g, '0');
        return path.replace(/([MmLlHhVvCcSs])\s*((?:-?\d*(?:\.\d+)?\s*,?\s*)+)/g, function(segment, letter, coords, index){
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js - About 2 hrs to fix

        Function bindContainerTouchEvents has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          bindContainerTouchEvents: function(){
            var touchStartScale,
                touchStartDistance,
                map = this,
                touchX,
        Severity: Major
        Found in assets/js/jquery-jvectormap.min.js - About 2 hrs to fix

          Function Map has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jvm.Map = function(params) {
            var map = this,
                e;
          
            this.params = jvm.$.extend(true, {}, jvm.Map.defaultParams, params);
          Severity: Major
          Found in assets/js/jquery-jvectormap.min.js - About 2 hrs to fix

            Function Map has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            jvm.Map = function(params) {
              var map = this,
                  e;
            
              this.params = jvm.$.extend(true, {}, jvm.Map.defaultParams, params);
            Severity: Minor
            Found in assets/js/jquery-jvectormap.min.js - 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

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

                this.container.find('.jvectormap-zoomin').click(function(){
                  map.setScale(map.scale * map.params.zoomStep, map.width / 2, map.height / 2, false, map.params.zoomAnimate);
                });
            Severity: Major
            Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 2 hrs to fix
            assets/js/jquery-jvectormap.min.js on lines 2594..2596

            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 83.

            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