yagoferrer/map-tools

View on GitHub

Showing 29 of 35 total issues

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

  addFeatureOptions(features:{}[], options?:featureOption):void {

    var feature, x;
    for (x in features) {
      if (features.hasOwnProperty(x)) {
Severity: Minor
Found in lib/addFeature.ts - 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 constructor has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor(options: mapToolsOptions, cb: mapToolsCallback) {


    var addMarkerInstance = new addMarker(this);

Severity: Minor
Found in lib/mapTools.ts - About 1 hr to fix

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

      onSuccess(options, position, panel, cb) {
    
        var e, rule;
    
        // positioning options
    Severity: Minor
    Found in lib/addPanel.ts - 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 clone has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      public static clone(o: {}, exceptionKeys?: string[]): utilsClone {
        var out, v, key;
        out = Array.isArray(o) ? [] : {};
        for (key in o) {
          if (o.hasOwnProperty(key)) {
    Severity: Minor
    Found in lib/utils.ts - 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 create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      create(args, cb) {
    
        cb = cb || function () {};
    
        var mapOptions = maps.mapOptions(args);
    Severity: Minor
    Found in lib/addMap.ts - 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 customUpdate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      public customUpdate(marker, options) {
    
        if (options.custom) {
          if (options.custom.move) {
            marker.setAnimation(google.maps.Animation[options.custom.move.toUpperCase()]);
    Severity: Minor
    Found in lib/updateMarker.ts - 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 filter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      public filter(args, options?) {
    
        // Return All items if no arguments are supplied
        if (typeof args === 'undefined' && typeof options === 'undefined') {
          return this.utils.toArray(this.that[this.type].all);
    Severity: Minor
    Found in lib/filter.ts - 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 onSuccess has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      onSuccess(options, position, panel, cb) {
    
        var e, rule;
    
        // positioning options
    Severity: Minor
    Found in lib/addPanel.ts - About 1 hr to fix

      Function filter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public filter(args, options?) {
      
          // Return All items if no arguments are supplied
          if (typeof args === 'undefined' && typeof options === 'undefined') {
            return this.utils.toArray(this.that[this.type].all);
      Severity: Minor
      Found in lib/filter.ts - About 1 hr to fix

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

          create(args, cb) {
        
            cb = cb || function () {};
        
            var mapOptions = maps.mapOptions(args);
        Severity: Minor
        Found in lib/addMap.ts - About 1 hr to fix

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

            public addMarker(args, options) {
              if (utils.isArray(args)) {
                if (args.length >= 1) {
                  var marker, markers = [];
                  for (var i in args) {
          Severity: Minor
          Found in lib/addMarker.ts - 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 addFilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            public addFilter(filters) {
          
              this.that[this.type].crossfilter = this.that[this.type].crossfilter || this.that.crossfilter([]);
              this.that[this.type].filter = this.that[this.type].filter || {};
          
          
          Severity: Minor
          Found in lib/addFilter.ts - 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 _addMarker has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private _addMarker(marker, options): {} {
              marker.map = this.that.instance;
              marker.position = new google.maps.LatLng(marker.lat, marker.lng);
          
          
          
          Severity: Minor
          Found in lib/addMarker.ts - About 1 hr to fix

            Function _addMarker has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              private _addMarker(marker, options): {} {
                marker.map = this.that.instance;
                marker.position = new google.maps.LatLng(marker.lat, marker.lng);
            
            
            
            Severity: Minor
            Found in lib/addMarker.ts - About 55 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function filterByTag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              filterByTag(query) {
                // if the search query is an array with only one item then just use that string
                if(this.utils.isArray(query) && query.length === 1){
                  query = query[0];
                }
            Severity: Minor
            Found in lib/filter.ts - About 55 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

              addMarkerByTag(marker, instance) {
            
                if (utils.isArray(marker.tags)) {
                  var i, tag;
                  for (i in marker.tags) {
            Severity: Minor
            Found in lib/addMarker.ts - 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 prepareOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              public static prepareOptions(options, custom) : {custom: {open?: {on: string}; close?: {on: string; duration: number}}; defaults: {}} {
                var result = {custom: {}, defaults: {}}, option;
                for (option in options) {
                  if (options.hasOwnProperty(option)) {
                    if (custom.indexOf(option) > -1) {
            Severity: Minor
            Found in lib/utils.ts - 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

            Avoid deeply nested control flow statements.
            Open

                        if (!this.that.json.filter) {
                          this.addFilter(options.filters);
                        }
            Severity: Major
            Found in lib/addFeature.ts - About 45 mins to fix

              Function removeTags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                removeTags(marker) {
                  if (utils.isArray(marker.tags)) {
                    var i, tag;
                    for (i in marker.tags) {
                      if (marker.tags.hasOwnProperty(i)) {
              Severity: Minor
              Found in lib/updateMarker.ts - 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                public update(args, options){
                  var type = Object.prototype.toString.call(args);
              
                  if (type === '[object Array]') {
                    var feature, x;
              Severity: Minor
              Found in lib/updateFeature.ts - 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

              Severity
              Category
              Status
              Source
              Language