Gapminder/vizabi

View on GitHub

Showing 540 of 540 total issues

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

    buttons.on("click", function() {

      d3.event.preventDefault();
      d3.event.stopPropagation();

Severity: Major
Found in src/components/zoombuttonlist/zoombuttonlist.js and 1 other location - About 2 hrs to fix
src/components/buttonlist/buttonlist.js on lines 446..453

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

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

    buttons.on("click", function() {

      d3.event.preventDefault();
      d3.event.stopPropagation();

Severity: Major
Found in src/components/buttonlist/buttonlist.js and 1 other location - About 2 hrs to fix
src/components/zoombuttonlist/zoombuttonlist.js on lines 158..165

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

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

File show.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as utils from "base/utils";
import Component from "base/component";

/*!
 * VIZABI SHOW PANEL CONTROL
Severity: Minor
Found in src/components/dialogs/find/show.js - About 2 hrs to fix

    Function getQuery has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getQuery(splashScreen) {
        let filters;
    
        //error if there's nothing to hook to
        if (Object.keys(this._space).length < 1) {
    Severity: Major
    Found in src/models/hook.js - About 2 hrs to fix

      Function firstBy has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      export function firstBy() {
      
        function identity(v) {
          return v;
        }
      Severity: Minor
      Found in src/base/utils.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 updateLabel has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        updateLabel(d, index, cache, valueX, valueY, valueS, valueC, valueL, valueLST, duration, showhide) {
          const _this = this;
          const KEYS = this.KEYS;
          const KEY = this.KEY;
          if (d[KEY] == _this.dragging)
      Severity: Minor
      Found in src/helpers/labels.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 ajax has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      export const ajax = function(options) {
        const request = new XMLHttpRequest();
        request.open(options.method, options.url, true);
        if (options.method === "POST" && !options.json) {
          request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
      Severity: Minor
      Found in src/base/utils.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 setWidth has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        setWidth(width, recursive, immediate) {
          if (this.width != width && this.entity.node()) {
            this.width = width;
            if ((this.entity.classed(css.list_top_level) || this.entity.classed("active")) && this.direction == MENU_HORIZONTAL) {
              if (!immediate) {
      Severity: Minor
      Found in src/components/treemenu/treemenu.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 init has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        init(config, parent) {
          this.name = "find";
          const _this = this;
      
          this.components = [{
      Severity: Minor
      Found in src/components/dialogs/find/find.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 splitEventParameters has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        splitEventParameters(type, path, func, eventFunc) {
          let i;
          const calls = [];
      
          // multiple at a time, array format: [{type: function}, {'type:path': function}, ... ]
      Severity: Minor
      Found in src/base/events.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

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

            "change:time.end": function(evt, original) {
              if (!_this._readyOnce || _this.model.time.splash) return;
              if (_this.colorModel.which == _this.model.time.dim) {
                _this.ready();
              }
      Severity: Major
      Found in src/components/colorlegend/colorlegend.js and 1 other location - About 2 hrs to fix
      src/components/colorlegend/colorlegend.js on lines 59..64

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

      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, original) {
              if (!_this._readyOnce || _this.model.time.splash) return;
              if (_this.colorModel.which == _this.model.time.dim) {
                _this.ready();
              }
      Severity: Major
      Found in src/components/colorlegend/colorlegend.js and 1 other location - About 2 hrs to fix
      src/components/colorlegend/colorlegend.js on lines 65..70

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

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

        readyOnce() {
          const version = globals.version;
          const updated = new Date(parseInt(globals.build));
      
          this.element = d3.select(this.element);
      Severity: Major
      Found in src/components/dialogs/about/about.js - About 2 hrs to fix

        Function update has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          update() {
            const _this = this;
        
            const margin = this.model.show.toolMargin.getPlainObject();
        
        
        Severity: Major
        Found in src/tools/axislabeler/axislabeler-component.js - About 2 hrs to fix

          Function start has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  .on("start", function start(d, i) {
                    //click сompatible node raise
                    let nextSibling = this.nextSibling;
                    while (nextSibling) {
                      this.parentNode.insertBefore(nextSibling, this);
          Severity: Major
          Found in src/components/colorlegend/colorlegend.js - About 2 hrs to fix

            Function aggregateData has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              aggregateData(dataId, query, readerObject, conceptProps) {
                if (Object.keys(query.grouping).every(key => query.grouping[key]["grouping"] === 1)) {
                  return Promise.resolve(dataId);
                }
            
            
            Severity: Major
            Found in src/base/datastorage.js - About 2 hrs to fix

              EntitiesModel has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              const EntitiesModel = DataConnected.extend({
              
                /**
                 * Default values for this model
                 */
              Severity: Minor
              Found in src/models/entities.js - About 2 hrs to fix

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

                  readyOnce() {
                    this._super();
                
                    this.panelComps = { find: this, show: this.findChildByName("show") };
                
                
                Severity: Major
                Found in src/components/dialogs/find/find.js - About 2 hrs to fix

                  File find.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import * as utils from "base/utils";
                  import Dialog from "components/dialogs/_dialog";
                  
                  import show from "./show";
                  import singlehandleslider from "components/brushslider/singlehandleslider/singlehandleslider";
                  Severity: Minor
                  Found in src/components/dialogs/find/find.js - About 2 hrs to fix

                    Function getBrowserDetails has a Cognitive Complexity of 16 (exceeds 5 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 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

                    Severity
                    Category
                    Status
                    Source
                    Language