insideout10/wordlift-plugin-js

View on GitHub
bower_components/leaflet/src/map/Map.js

Summary

Maintainability
F
4 days
Test Coverage

Map has 75 functions (exceeds 20 allowed). Consider refactoring.
Open

L.Map = L.Class.extend({

    includes: L.Mixin.Events,

    options: {
Severity: Major
Found in bower_components/leaflet/src/map/Map.js - About 1 day to fix

    File Map.js has 565 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * L.Map is the central class of the API - it is used to create a map.
     */
    
    L.Map = L.Class.extend({
    Severity: Major
    Found in bower_components/leaflet/src/map/Map.js - About 1 day to fix

      Function invalidateSize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          invalidateSize: function (options) {
              if (!this._loaded) { return this; }
      
              options = L.extend({
                  animate: false,
      Severity: Minor
      Found in bower_components/leaflet/src/map/Map.js - About 1 hr to fix

        Function _resetView has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _resetView: function (center, zoom, preserveMapOffset, afterZoomAnim) {
        
                var zoomChanged = (this._zoom !== zoom);
        
                if (!afterZoomAnim) {
        Severity: Minor
        Found in bower_components/leaflet/src/map/Map.js - About 1 hr to fix

          Function invalidateSize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              invalidateSize: function (options) {
                  if (!this._loaded) { return this; }
          
                  options = L.extend({
                      animate: false,
          Severity: Minor
          Found in bower_components/leaflet/src/map/Map.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

          Consider simplifying this complex logical expression.
          Open

                  if (!this._loaded || (!e._simulated &&
                          ((this.dragging && this.dragging.moved()) ||
                           (this.boxZoom  && this.boxZoom.moved()))) ||
                              L.DomEvent._skipped(e)) { return; }
          Severity: Major
          Found in bower_components/leaflet/src/map/Map.js - About 1 hr to fix

            Function getBoundsZoom has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number
                    bounds = L.latLngBounds(bounds);
            
                    var zoom = this.getMinZoom() - (inside ? 1 : 0),
                        maxZoom = this.getMaxZoom(),
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js - About 45 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 _updateZoomLevels has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                _updateZoomLevels: function () {
                    var i,
                        minZoom = Infinity,
                        maxZoom = -Infinity,
                        oldZoomSpan = this._getZoomSpan();
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js - About 45 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 _initLayout has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                _initLayout: function () {
                    var container = this._container;
            
                    L.DomUtil.addClass(container, 'leaflet-container' +
                        (L.Browser.touch ? ' leaflet-touch' : '') +
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js - About 35 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 _resetView has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                _resetView: function (center, zoom, preserveMapOffset, afterZoomAnim) {
            
                    var zoomChanged = (this._zoom !== zoom);
            
                    if (!afterZoomAnim) {
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js - About 35 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 addLayer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                addLayer: function (layer) {
                    // TODO method is too big, refactor
            
                    var id = L.stamp(layer);
            
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js - About 25 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 _fireMouseEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                _fireMouseEvent: function (e) {
                    if (!this._loaded || L.DomEvent._skipped(e)) { return; }
            
                    var type = e.type;
            
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js - About 25 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

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

                    if (this.options.zoomAnimation && L.TileLayer && (layer instanceof L.TileLayer)) {
                        this._tileLayersNum++;
                        this._tileLayersToLoad++;
                        layer.on('load', this._onTileLayerLoad, this);
                    }
            Severity: Major
            Found in bower_components/leaflet/src/map/Map.js and 1 other location - About 1 hr to fix
            bower_components/leaflet/src/map/Map.js on lines 204..208

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

            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.options.zoomAnimation && L.TileLayer && (layer instanceof L.TileLayer)) {
                        this._tileLayersNum--;
                        this._tileLayersToLoad--;
                        layer.off('load', this._onTileLayerLoad, this);
                    }
            Severity: Major
            Found in bower_components/leaflet/src/map/Map.js and 1 other location - About 1 hr to fix
            bower_components/leaflet/src/map/Map.js on lines 170..174

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

            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

                unproject: function (point, zoom) { // (Point[, Number]) -> LatLng
                    zoom = zoom === undefined ? this._zoom : zoom;
                    return this.options.crs.pointToLatLng(L.point(point), zoom);
                },
            Severity: Major
            Found in bower_components/leaflet/src/map/Map.js and 1 other location - About 1 hr to fix
            bower_components/leaflet/src/map/Map.js on lines 417..420

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

            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

                project: function (latlng, zoom) { // (LatLng[, Number]) -> Point
                    zoom = zoom === undefined ? this._zoom : zoom;
                    return this.options.crs.latLngToPoint(L.latLng(latlng), zoom);
                },
            Severity: Major
            Found in bower_components/leaflet/src/map/Map.js and 1 other location - About 1 hr to fix
            bower_components/leaflet/src/map/Map.js on lines 422..425

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

            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

                eachLayer: function (method, context) {
                    for (var i in this._layers) {
                        method.call(context, this._layers[i]);
                    }
                    return this;
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js and 1 other location - About 50 mins to fix
            bower_components/leaflet/src/layer/LayerGroup.js on lines 84..89

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

            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 (!isNaN(layer.options.maxZoom)) {
                            maxZoom = Math.max(maxZoom, layer.options.maxZoom);
                        }
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js and 1 other location - About 30 mins to fix
            bower_components/leaflet/src/map/Map.js on lines 603..605

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

            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 (!isNaN(layer.options.minZoom)) {
                            minZoom = Math.min(minZoom, layer.options.minZoom);
                        }
            Severity: Minor
            Found in bower_components/leaflet/src/map/Map.js and 1 other location - About 30 mins to fix
            bower_components/leaflet/src/map/Map.js on lines 606..608

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

            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

            There are no issues that match your filters.

            Category
            Status