Gapminder/vizabi

View on GitHub

Showing 540 of 540 total issues

Function getFilter has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  getFilter({ splash }) {
    const defaultStart = this.parse(this.startOrigin);
    const defaultEnd = this.parse(this.endOrigin);

    const dim = this.getDimension();
Severity: Minor
Found in src/models/time.js - 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 _toggleButtons has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  _toggleButtons() {
    const _this = this;
    const parent = this.parent.element.node ? this.parent.element : d3.select(this.parent.element);

    //HERE
Severity: Minor
Found in src/components/buttonlist/buttonlist.js - 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 getDimensionModelsForSpace has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getDimensionModelsForSpace(oldSpace, newSpaceDimensions) {

    this.updateDimensionModels();

    // match new space to entities
Severity: Major
Found in src/base/dimensionmanager.js - About 2 hrs to fix

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

        this.list.selectAll(".vzb-find-item")
          .classed("vzb-hidden", d => {
            const lower = (d.name || "").toString().toLowerCase();
            return (lower.indexOf(search) === -1);
          });
    Severity: Major
    Found in src/components/dialogs/find/find.js and 1 other location - About 2 hrs to fix
    src/components/dialogs/find/show.js on lines 283..287

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

    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

          "change:time.end": function(evt, path) {
            if (_this.slide) {
              //only set handle position if change is external
              if (!_this.model.time.dragging) _this._setHandle(_this.model.time.playing);
              _this.ready();
    Severity: Major
    Found in src/components/timeslider/timeslider.js and 1 other location - About 2 hrs to fix
    src/components/timeslider/timeslider.js on lines 101..107

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

    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

        this.howToStackEl = this.element.select(".vzb-howtostack").selectAll("input")
          .on("change", function() {
            _this.setModel("stack", d3.select(this).node().value);
          });
    Severity: Major
    Found in src/components/dialogs/stack/stack.js and 1 other location - About 2 hrs to fix
    src/components/dialogs/stack/stack.js on lines 58..61

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

    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

          "change:time.start": function(evt, path) {
            if (_this.slide) {
              //only set handle position if change is external
              if (!_this.model.time.dragging) _this._setHandle(_this.model.time.playing);
              _this.ready();
    Severity: Major
    Found in src/components/timeslider/timeslider.js and 1 other location - About 2 hrs to fix
    src/components/timeslider/timeslider.js on lines 108..114

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

    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

        this.howToMergeEl = this.element.select(".vzb-howtomerge").selectAll("input")
          .on("change", function() {
            _this.setModel("merge", d3.select(this).node().value);
          });
    Severity: Major
    Found in src/components/dialogs/stack/stack.js and 1 other location - About 2 hrs to fix
    src/components/dialogs/stack/stack.js on lines 54..57

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

    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

        this.list.selectAll(".vzb-show-item")
          .classed("vzb-hidden", d => {
            const lower = (d.label || "").toString().toLowerCase();
            return (lower.indexOf(search) === -1);
          });
    Severity: Major
    Found in src/components/dialogs/find/show.js and 1 other location - About 2 hrs to fix
    src/components/dialogs/find/find.js on lines 305..309

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

    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 getEntityLimits has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getEntityLimits(entity) {
        const _this = this;
        const timePoints = this._parent.time.getAllSteps();
        const selectedEdgeTimes = [];
        const hooks = [];
    Severity: Major
    Found in src/models/marker.js - About 2 hrs to fix

      Function readyOnce has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        readyOnce() {
          //this function is only called once at start, when both DOM and this.model are ready
          //this.element contains the view where you can append the menu
          this.element = d3.select(this.placeholder);
          //menu class private
      Severity: Major
      Found in src/components/treemenu/treemenu.js - About 2 hrs to fix

        Function set has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          set(attr, val, force, persistent, caller) {
            const setting = this._setting;
            let attrs;
            let freezeCall = false; // boolean, indicates if this .set()-call froze the modelTree
        
        
        Severity: Major
        Found in src/base/model.js - About 2 hrs to fix

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

            changeHandler(evt, path) {
              const extent = this.model.submodel.extent || [this.options.EXTENT_MIN, this.options.EXTENT_MAX];
              this._updateLabels(extent);
              this._super(evt, path);
            },
          Severity: Major
          Found in src/components/brushslider/sizeslider/sizeslider.js and 1 other location - About 2 hrs to fix
          src/components/brushslider/bubblesize/bubblesize.js on lines 70..74

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

          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

            changeHandler(evt, path) {
              const extent = this.model.submodel.extent || [this.options.EXTENT_MIN, this.options.EXTENT_MAX];
              this._updateLabels(extent);
              this._super(evt, path);
            },
          Severity: Major
          Found in src/components/brushslider/bubblesize/bubblesize.js and 1 other location - About 2 hrs to fix
          src/components/brushslider/sizeslider/sizeslider.js on lines 76..80

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

          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 (parent.classed("vzb-portrait") && parent.classed("vzb-small")) {
                if (this.model.state.marker.select.length > 0) target = this.element.node().scrollWidth;
                this.element.node().scrollLeft = target;
              } else {
          Severity: Major
          Found in src/components/buttonlist/buttonlist.js and 1 other location - About 2 hrs to fix
          src/components/buttonlist/buttonlist.js on lines 465..468

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

          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

              } else {
                if (this.model.state.marker.select.length > 0) target = this.element.node().scrollHeight;
                this.element.node().scrollTop = target;
              }
          Severity: Major
          Found in src/components/buttonlist/buttonlist.js and 1 other location - About 2 hrs to fix
          src/components/buttonlist/buttonlist.js on lines 462..465

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

          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 handleConceptPropsResponse has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            handleConceptPropsResponse(dataId) {
          
              this.conceptDictionary = { _default: { concept: "_default", concept_type: "string", use: "constant", scales: ["ordinal"], tags: "_root" } };
              this.conceptArray = [];
          
          
          Severity: Minor
          Found in src/models/data.js - About 1 hr to fix

            Function getBrowserDetails has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const getBrowserDetails = () => {
            
              const nVer = navigator.appVersion;
              const nAgt = navigator.userAgent;
              let browserName = navigator.appName;
            Severity: Minor
            Found in src/base/utils.js - About 1 hr to fix

              Function readyOnce has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                readyOnce() {
                  const _this = this;
              
                  this.element = d3.select(this.placeholder);
                  this.element.selectAll("div").remove();
              Severity: Minor
              Found in src/components/dialogs/dialogs.js - About 1 hr to fix

                Function getTickFormatter has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  getTickFormatter(_removePrefix) {
                
                    const _this = this;
                    const SHARE = "share";
                    const PERCENT = "percent";
                Severity: Minor
                Found in src/models/hook.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language