Gapminder/vizabi

View on GitHub
src/models/time.js

Summary

Maintainability
F
6 days
Test Coverage

File time.js has 442 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as utils from "base/utils";
import DataConnected from "models/dataconnected";

/*!
 * VIZABI Time Model
Severity: Minor
Found in src/models/time.js - About 6 hrs to fix

    TimeModel has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

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

      Function checkTimeLimits has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        checkTimeLimits() {
          //if all hooks are ready, check time limits and set time model to ready
          if ([...this.hooksToListen].every(hook => hook._ready)) {
            const minArray = [this.startOrigin], maxArray = [this.endOrigin];
            if (!this.showForecast) maxArray.push(this.endBeforeForecast);
      Severity: Minor
      Found in src/models/time.js - About 3 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 validate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        validate() {
      
          //check if time start and end are not defined but start and end origins are defined
          if (this.start == null && this.startOrigin) this.set("start", this.startOrigin, null, false);
          if (this.end == null && this.endOrigin) this.set("end", this.endOrigin, null, false);
      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 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 checkTimeLimits has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        checkTimeLimits() {
          //if all hooks are ready, check time limits and set time model to ready
          if ([...this.hooksToListen].every(hook => hook._ready)) {
            const minArray = [this.startOrigin], maxArray = [this.endOrigin];
            if (!this.showForecast) maxArray.push(this.endBeforeForecast);
      Severity: Minor
      Found in src/models/time.js - About 1 hr to fix

        Function validate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          validate() {
        
            //check if time start and end are not defined but start and end origins are defined
            if (this.start == null && this.startOrigin) this.set("start", this.startOrigin, null, false);
            if (this.end == null && this.endOrigin) this.set("end", this.endOrigin, null, false);
        Severity: Minor
        Found in src/models/time.js - About 1 hr to fix

          Function weekFormat has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function weekFormat() {
          
            const format = function(d) {
              return formatWeekYear(d) + "w" + formatWeek(d);
            };
          Severity: Minor
          Found in src/models/time.js - About 1 hr to fix

            Function playInterval has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              playInterval(immediatePlay) {
                if (!this.playing) return;
                const _this = this;
                this.delayAnimations = this.delay;
                if (this.delay < this.delayThresholdX2) this.delayAnimations *= 2;
            Severity: Minor
            Found in src/models/time.js - About 1 hr to fix

              Function init has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                init(name, values, parent, bind) {
                  this._type = "time";
                  this.hooksToListen = new Set([]);
              
                  //same constructor
              Severity: Minor
              Found in src/models/time.js - About 1 hr to fix

                Function getClassDefaults has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  getClassDefaults() {
                    const defaults = {
                      dim: null,
                      value: null,
                      start: null,
                Severity: Minor
                Found in src/models/time.js - About 1 hr to fix

                  Function weekFormat has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function weekFormat() {
                  
                    const format = function(d) {
                      return formatWeekYear(d) + "w" + formatWeek(d);
                    };
                  Severity: Minor
                  Found in src/models/time.js - 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

                  Consider simplifying this complex logical expression.
                  Open

                      if (!utils.isDate(this.start) || !utils.isDate(this.end) || !utils.isDate(this.value)
                        || !utils.isDate(this.startSelected) || !utils.isDate(this.endSelected) || !utils.isDate(this.endBeforeForecast)) {
                        this._formatToDates();
                      }
                  Severity: Major
                  Found in src/models/time.js - About 40 mins to fix

                    Function initFormatters has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      initFormatters() {
                        if (formats[this.unit]) {
                          this.formatters = formats[this.unit];
                        }
                        // specifically set formats overwrite unit defaults
                    Severity: Minor
                    Found in src/models/time.js - About 35 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 quarterFormat has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function quarterFormat() {
                    
                      const format = function(d) {
                        return formats.year.data(d) + "q" + formatQuarter(d);
                      };
                    Severity: Minor
                    Found in src/models/time.js - About 25 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

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

                      autoconfigureModel() {
                        if (!this.dim && this.autoconfig) {
                          const concept = this.dataSource.getConcept(this.autoconfig);
                    
                          if (concept) this.dim = concept.concept;
                    Severity: Major
                    Found in src/models/time.js and 1 other location - About 2 hrs to fix
                    src/models/entities.js on lines 53..60

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

                    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

                      setLinkWith(hook) {
                        this.hooksToListen.add(hook);
                        hook.on("startLoading", () => this.setReady(false));
                        hook.on("ready", this.checkTimeLimits.bind(this));
                      },
                    Severity: Major
                    Found in src/models/time.js and 1 other location - About 1 hr to fix
                    src/models/time.js on lines 160..164

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

                    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

                      unsetLinkWith(hook) {
                        this.hooksToListen.delete(hook);
                        hook.off("startLoading", () => this.setReady(false));
                        hook.off("ready", this.checkTimeLimits.bind(this));
                      },
                    Severity: Major
                    Found in src/models/time.js and 1 other location - About 1 hr to fix
                    src/models/time.js on lines 154..158

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

                    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 ((!this.startSelected || this.startSelected < this.start) && this.start != null) {
                            this.set({ startSelected: new Date(this.start) }, null, false /*make change non-persistent for URL and history*/);
                          }
                    Severity: Major
                    Found in src/models/time.js and 1 other location - About 1 hr to fix
                    src/models/time.js on lines 305..307

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

                    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 ((!this.endSelected || this.endSelected > this.end) && this.end != null) {
                            this.set({ endSelected: new Date(this.end) }, null, false /*make change non-persistent for URL and history*/);
                          }
                    Severity: Major
                    Found in src/models/time.js and 1 other location - About 1 hr to fix
                    src/models/time.js on lines 301..303

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

                    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 3 locations. Consider refactoring.
                    Open

                        if (this.value > this.endSelected && this.value != null && this.endSelected != null) {
                          this.set("value", new Date(this.endSelected), null, false);
                        }
                    Severity: Major
                    Found in src/models/time.js and 2 other locations - About 1 hr to fix
                    src/models/time.js on lines 293..295
                    src/models/time.js on lines 313..315

                    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

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

                        if (this.value < this.startSelected && this.value != null && this.startSelected != null) {
                          this.set("value", new Date(this.startSelected), null, false);
                        }
                    Severity: Major
                    Found in src/models/time.js and 2 other locations - About 1 hr to fix
                    src/models/time.js on lines 297..299
                    src/models/time.js on lines 313..315

                    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

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

                        } else if (this.value > this.end && this.value != null && this.end != null) {
                          this.set("value", new Date(this.end), null, false);
                        }
                    Severity: Major
                    Found in src/models/time.js and 2 other locations - About 1 hr to fix
                    src/models/time.js on lines 293..295
                    src/models/time.js on lines 297..299

                    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

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

                          if (this.format.data) {
                            this.formatters.data = d3.time.format.utc(this.format.data);
                          }
                    Severity: Minor
                    Found in src/models/time.js and 1 other location - About 55 mins to fix
                    src/models/time.js on lines 125..127

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

                    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 (this.format.ui) {
                            this.formatters.ui = d3.time.format.utc(this.format.ui);
                          }
                    Severity: Minor
                    Found in src/models/time.js and 1 other location - About 55 mins to fix
                    src/models/time.js on lines 122..124

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

                    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 5 locations. Consider refactoring.
                    Open

                      "year": { data: d3.time.format.utc("%Y"),            ui: d3.time.format.utc("%Y") },
                    Severity: Major
                    Found in src/models/time.js and 4 other locations - About 40 mins to fix
                    src/models/time.js on lines 18..18
                    src/models/time.js on lines 20..20
                    src/models/time.js on lines 21..21
                    src/models/time.js on lines 22..22

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

                    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 5 locations. Consider refactoring.
                    Open

                      "minute": { data: d3.time.format.utc("%Y%m%dT%H%M"),   ui: d3.time.format.utc("%b %d %Y, %H:%M") },
                    Severity: Major
                    Found in src/models/time.js and 4 other locations - About 40 mins to fix
                    src/models/time.js on lines 17..17
                    src/models/time.js on lines 18..18
                    src/models/time.js on lines 20..20
                    src/models/time.js on lines 22..22

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

                    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 5 locations. Consider refactoring.
                    Open

                      "month": { data: d3.time.format.utc("%Y-%m"),         ui: d3.time.format.utc("%b %Y") }, // month needs separator according to ISO to not confuse YYYYMM with YYMMDD
                    Severity: Major
                    Found in src/models/time.js and 4 other locations - About 40 mins to fix
                    src/models/time.js on lines 17..17
                    src/models/time.js on lines 20..20
                    src/models/time.js on lines 21..21
                    src/models/time.js on lines 22..22

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

                    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 5 locations. Consider refactoring.
                    Open

                      "hour": { data: d3.time.format.utc("%Y%m%dT%H"),     ui: d3.time.format.utc("%b %d %Y, %H") },
                    Severity: Major
                    Found in src/models/time.js and 4 other locations - About 40 mins to fix
                    src/models/time.js on lines 17..17
                    src/models/time.js on lines 18..18
                    src/models/time.js on lines 21..21
                    src/models/time.js on lines 22..22

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

                    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 5 locations. Consider refactoring.
                    Open

                      "second": { data: d3.time.format.utc("%Y%m%dT%H%M%S"), ui: d3.time.format.utc("%b %d %Y, %H:%M:%S") },
                    Severity: Major
                    Found in src/models/time.js and 4 other locations - About 40 mins to fix
                    src/models/time.js on lines 17..17
                    src/models/time.js on lines 18..18
                    src/models/time.js on lines 20..20
                    src/models/time.js on lines 21..21

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

                    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 (this.start - min != 0 || !this.start && !this.startOrigin) newTime["start"] = min;
                    Severity: Minor
                    Found in src/models/time.js and 1 other location - About 35 mins to fix
                    src/models/time.js on lines 196..196

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

                    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 (this.end - max != 0 || !this.end && !this.endOrigin) newTime["end"] = max;
                    Severity: Minor
                    Found in src/models/time.js and 1 other location - About 35 mins to fix
                    src/models/time.js on lines 195..195

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

                    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

                      preloadData() {
                        this.dataSource = this.getClosestModel(this.data || "data");
                        return this._super();
                      },
                    Severity: Minor
                    Found in src/models/time.js and 1 other location - About 30 mins to fix
                    src/models/entities.js on lines 41..44

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status