cjtterabytesoft/yii2-jvectormap

View on GitHub

Showing 117 of 117 total issues

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

    this.container.find('.jvectormap-zoomout').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 2591..2593

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

Function handler has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function handler(event) {
        var orgEvent   = event || window.event,
            args       = slice.call(arguments, 1),
            delta      = 0,
            deltaX     = 0,
Severity: Major
Found in assets/js/jquery-jvectormap.min.js - About 2 hrs to fix

    Function bindElementEvents has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      bindElementEvents: function(){
        var map = this,
            pageX,
            pageY,
            mouseMoved;
    Severity: Major
    Found in assets/js/jquery-jvectormap.min.js - About 2 hrs to fix

      Function setScale has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        setScale: function(scale, anchorX, anchorY, isCentered, animate) {
          var viewportChangeEvent = jvm.$.Event('zoom.jvectormap'),
              interval,
              that = this,
              i = 0,
      Severity: Major
      Found in assets/js/jquery-jvectormap.min.js - About 2 hrs to fix

        Function handleTouchEvent has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                handleTouchEvent = function(e){
                  var touches = e.originalEvent.touches,
                      offset,
                      scale,
                      transXOld,
        Severity: Major
        Found in assets/js/jquery-jvectormap.min.js - About 2 hrs to fix

          Function indexOf has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

            Array.prototype.indexOf = function (searchElement, fromIndex) {
          
              var k;
          
              // 1. Let O be the result of calling ToObject passing
          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

                if (typeof this.params.min === 'undefined') {
                  this.scale.setMin(min);
                  this.params.min = min;
                } else {
                  this.scale.setMin(this.params.min);
          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 1615..1620

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

          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

                jvm.$(region.shape).bind('selected', function(e, isSelected){
                  map.container.trigger('regionSelected.jvectormap', [jvm.$(this.node).attr('data-code'), isSelected, map.getSelectedRegions()]);
                });
          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 2923..2925

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

          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 (typeof this.params.max === 'undefined') {
                  this.scale.setMax(max);
                  this.params.max = max;
                } else {
                  this.scale.setMax(this.params.max);
          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 1608..1613

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

          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

                  jvm.$(marker.shape).bind('selected', function(e, isSelected){
                    map.container.trigger('markerSelected.jvectormap', [jvm.$(this.node).attr('data-index'), isSelected, map.getSelectedMarkers()]);
                  });
          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 2876..2878

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

          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

              } else {
                this.baseScale = this.width / this.defaultWidth;
                this.baseTransY = Math.abs(this.height - this.defaultHeight * this.baseScale) / (2 * this.baseScale);
              }
          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 2264..2267

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

          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.width / this.height > this.defaultWidth / this.defaultHeight) {
                this.baseScale = this.height / this.defaultHeight;
                this.baseTransX = Math.abs(this.width - this.defaultWidth * this.baseScale) / (2 * this.baseScale);
              } else {
          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 2267..2270

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

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

            createMarkers: function(markers) {
              var i,
                  marker,
                  point,
                  markerConfig,
          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

          Function render has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jvm.Legend.prototype.render = function(){
            var ticks = this.series.scale.getTicks(),
                i,
                inner = jvm.$('<div/>').addClass('jvectormap-legend-inner'),
                tick,
          Severity: Minor
          Found in assets/js/jquery-jvectormap.min.js - About 2 hrs to fix

            Function setFocus has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              setFocus: function(config){
                var bbox,
                    itemBbox,
                    newBbox,
                    codes,
            Severity: Minor
            Found in assets/js/jquery-jvectormap.min.js - About 1 hr to fix

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

                vectorSubtract: function(vector1, vector2) {
                  var vector = [],
                      i;
              
                  for (i = 0; i < vector1.length; i++) {
              Severity: Major
              Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 1 hr to fix
              assets/js/jquery-jvectormap.min.js on lines 1332..1340

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

              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

                vectorAdd: function(vector1, vector2) {
                  var vector = [],
                      i;
              
                  for (i = 0; i < vector1.length; i++) {
              Severity: Major
              Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 1 hr to fix
              assets/js/jquery-jvectormap.min.js on lines 1322..1330

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

              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

                setMax: function(max) {
                  this.clearMaxValue = max;
                  if (typeof this.normalize === 'function') {
                    this.maxValue = this.normalize(max);
                  } else {
              Severity: Major
              Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 1 hr to fix
              assets/js/jquery-jvectormap.min.js on lines 1225..1232

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

              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

                setMin: function(min) {
                  this.clearMinValue = min;
                  if (typeof this.normalize === 'function') {
                    this.minValue = this.normalize(min);
                  } else {
              Severity: Major
              Found in assets/js/jquery-jvectormap.min.js and 1 other location - About 1 hr to fix
              assets/js/jquery-jvectormap.min.js on lines 1234..1241

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

              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 setValues has 46 lines of code (exceeds 25 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 1 hr to fix
                Severity
                Category
                Status
                Source
                Language