yagoferrer/map-tools

View on GitHub

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

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

    interface mapToolsOptions {
      id?: string;
      el?: string;
      lat: number;
      lng: number;
    Severity: Major
    Found in lib/mapTools.ts and 1 other location - About 1 hr to fix
    lib/addMap.ts on lines 2..11

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

    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

    interface mapToolsOptions {
      id?: string;
      el?: string;
      lat: number;
      lng: number;
    Severity: Major
    Found in lib/addMap.ts and 1 other location - About 1 hr to fix
    lib/mapTools.ts on lines 2..11

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

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

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

                var openOn = (args.custom && args.custom.open && args.custom.open.on) ?  args.custom.open.on : 'click';
            Severity: Major
            Found in lib/infoWindow.ts and 1 other location - About 1 hr to fix
            lib/infoWindow.ts on lines 54..54

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

            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

                var closeOn = (args.custom && args.custom.close && args.custom.close.on) ? args.custom.close.on : 'click';
            Severity: Major
            Found in lib/infoWindow.ts and 1 other location - About 1 hr to fix
            lib/infoWindow.ts on lines 53..53

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

            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 _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

            Severity
            Category
            Status
            Source
            Language