Gapminder/vizabi

View on GitHub

Showing 527 of 527 total issues

Function axisSmart has a Cognitive Complexity of 568 (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

Function genericLog has a Cognitive Complexity of 215 (exceeds 5 allowed). Consider refactoring.
Open

export default function genericLog() {
  return (function d3_scale_genericLog(logScale) {
    const _this = this;
    let scales = [];
    let domainParts = [];
Severity: Minor
Found in src/helpers/d3.genericLogScale.js - About 4 days 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 axisSmart has 628 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 626 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 treemenu.js has 1188 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

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

        import interpolator from "vizabi-interpolators/interpolators";
        
        /*
         * Check if value A is in +- proximity of value B
         * @param {Number} a
        Severity: Major
        Found in src/base/utils.js - About 2 days to fix

          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 marker.js has 731 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 labels.js has 681 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

              Function genericLog has 293 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function genericLog() {
                return (function d3_scale_genericLog(logScale) {
                  const _this = this;
                  let scales = [];
                  let domainParts = [];
              Severity: Major
              Found in src/helpers/d3.genericLogScale.js - About 1 day to fix

                Function d3_scale_genericLog has 291 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  return (function d3_scale_genericLog(logScale) {
                    const _this = this;
                    let scales = [];
                    let domainParts = [];
                    let eps = 0.1;
                Severity: Major
                Found in src/helpers/d3.genericLogScale.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

                  File d3.axisWithLabelPicker.js has 631 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 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 586 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

                        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

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

                              updateSelectedStartLimiter() {
                                const _this = this;
                                this.select.select("#clip-start-" + _this._id).remove();
                                this.select.select(".selected-start").remove();
                                if (this.model.time.startSelected && this.model.time.startSelected > this.model.time.start) {
                            Severity: Major
                            Found in src/components/timeslider/timeslider.js and 1 other location - About 1 day to fix
                            src/components/timeslider/timeslider.js on lines 445..458

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

                            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

                              updateSelectedEndLimiter() {
                                const _this = this;
                                this.select.select("#clip-end-" + _this._id).remove();
                                this.select.select(".selected-end").remove();
                                if (this.model.time.endSelected && this.model.time.endSelected < this.model.time.end) {
                            Severity: Major
                            Found in src/components/timeslider/timeslider.js and 1 other location - About 1 day to fix
                            src/components/timeslider/timeslider.js on lines 430..443

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language