Gapminder/vizabi

View on GitHub

Showing 358 of 540 total issues

Function axisSmart has a Cognitive Complexity of 582 (exceeds 5 allowed). Consider refactoring.
Open

export default function axisSmart(_orient) {

  return (function d3_axis_smart(_super) {

    const VERTICAL = "vertical axis";
Severity: Minor
Found in src/helpers/d3.axisWithLabelPicker.js - About 1 wk 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

File treemenu.js has 1273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as utils from "base/utils";
import Component from "base/component";
import Class from "base/class";
import Hook from "models/hook";
import Marker from "models/marker";
Severity: Major
Found in src/components/treemenu/treemenu.js - About 3 days to fix

    Function axisSmart has 644 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function axisSmart(_orient) {
    
      return (function d3_axis_smart(_super) {
    
        const VERTICAL = "vertical axis";
    Severity: Major
    Found in src/helpers/d3.axisWithLabelPicker.js - About 3 days to fix

      Function d3_axis_smart has 642 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        return (function d3_axis_smart(_super) {
      
          const VERTICAL = "vertical axis";
          const HORIZONTAL = "horizontal axis";
          const X = "labels stack side by side";
      Severity: Major
      Found in src/helpers/d3.axisWithLabelPicker.js - About 3 days to fix

        File utils.js has 1070 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import interpolator from "vizabi-interpolators/interpolators";
        
        
        export const d3json = function(path, callback) {
          d3.json(path)
        Severity: Major
        Found in src/base/utils.js - About 2 days to fix

          Function _updateRainbowLegend has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
          Open

            _updateRainbowLegend(isVisible) {
              const _this = this;
          
              //Hide rainbow element if showing minimap or if color is discrete
              this.rainbowEl.classed("vzb-hidden", !isVisible);
          Severity: Minor
          Found in src/components/colorlegend/colorlegend.js - About 1 day 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 label has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
          Open

          const label = function(context) {
          
            return (function d3_label() {
          
              const _this = context;
          Severity: Minor
          Found in src/helpers/labels.js - About 1 day 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

          File labels.js has 722 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import * as utils from "base/utils";
          import Class from "base/class";
          import cssEscape from "css.escape";
          
          import { close as iconClose } from "base/iconset";
          Severity: Major
          Found in src/helpers/labels.js - About 1 day to fix

            File marker.js has 694 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import * as utils from "base/utils";
            import Model from "base/model";
            
            /*!
             * HOOK MODEL
            Severity: Major
            Found in src/models/marker.js - About 1 day to fix

              Function collisionResolver has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function collisionResolver() {
                return (function collision_resolver() {
                  const DURATION = 300;
                  let labelHeight = 0;
                  // MAINN FUNCTION. RUN COLLISION RESOLVER ON A GROUP g
              Severity: Minor
              Found in src/helpers/d3.collisionResolver.js - About 1 day 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

              File d3.axisWithLabelPicker.js has 647 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import * as utils from "base/utils";
              //d3.axisSmart
              
              export default function axisSmart(_orient) {
              
              
              Severity: Major
              Found in src/helpers/d3.axisWithLabelPicker.js - About 1 day to fix

                Function resize has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
                Open

                  resize() {
                    const _this = this;
                
                    this.profiles = {
                      "small": {
                Severity: Minor
                Found in src/components/treemenu/treemenu.js - About 1 day 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 labelFactory has 275 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    axis.labelFactory = function(options) {
                      if (options == null) options = {};
                      if (options.scaleType != "linear" &&
                        options.scaleType != "time" &&
                        options.scaleType != "genericLog" &&
                Severity: Major
                Found in src/helpers/d3.axisWithLabelPicker.js - About 1 day to fix

                  File datastorage.js has 621 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  
                  import * as utils from "base/utils";
                  import Class from "base/class";
                  
                  function _getQueryId(query, path, lastModified, readerName) {
                  Severity: Major
                  Found in src/base/datastorage.js - About 1 day to fix

                    File colorlegend.js has 601 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import * as utils from "base/utils";
                    import Component from "base/component";
                    import ColorPicker from "helpers/d3.colorPicker";
                    import axisSmart from "helpers/d3.axisWithLabelPicker";
                    import { close as iconClose } from "base/iconset";
                    Severity: Major
                    Found in src/components/colorlegend/colorlegend.js - About 1 day to fix

                      Function label has 249 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const label = function(context) {
                      
                        return (function d3_label() {
                      
                          const _this = context;
                      Severity: Major
                      Found in src/helpers/labels.js - About 1 day to fix

                        Function d3_label has 247 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          return (function d3_label() {
                        
                            const _this = context;
                        
                            let _cssPrefix;
                        Severity: Major
                        Found in src/helpers/labels.js - About 1 day to fix

                          File timeslider.js has 554 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import * as utils from "base/utils";
                          import Component from "base/component";
                          import axisSmart from "helpers/d3.axisWithLabelPicker";
                          
                          const precision = 1;
                          Severity: Major
                          Found in src/components/timeslider/timeslider.js - About 1 day to fix

                            File buttonlist.js has 553 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import * as utils from "base/utils";
                            import Component from "base/component";
                            import * as iconset from "base/iconset";
                            
                            /*!
                            Severity: Major
                            Found in src/components/buttonlist/buttonlist.js - About 1 day to fix

                              Function _updateRainbowLegend has 207 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                _updateRainbowLegend(isVisible) {
                                  const _this = this;
                              
                                  //Hide rainbow element if showing minimap or if color is discrete
                                  this.rainbowEl.classed("vzb-hidden", !isVisible);
                              Severity: Major
                              Found in src/components/colorlegend/colorlegend.js - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language