jiskattema/spot

View on GitHub
src/widgets/chartjs-duration-scale.js

Summary

Maintainability
F
6 days
Test Coverage

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

module.exports = function (Chart, moment) {
  var helpers = Chart.helpers;
  moment = moment || require('moment');

  var DurationScale = Chart.Scale.extend({
Severity: Minor
Found in src/widgets/chartjs-duration-scale.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function exports has 231 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (Chart, moment) {
  var helpers = Chart.helpers;
  moment = moment || require('moment');

  var DurationScale = Chart.Scale.extend({
Severity: Major
Found in src/widgets/chartjs-duration-scale.js - About 1 day to fix

    Function prettyPrintDuration has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    function prettyPrintDuration (tick) {
      var parts = [];
      var count;
      var remainder = moment.duration(tick);
    
    
    Severity: Minor
    Found in src/widgets/chartjs-duration-scale.js - About 4 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

    File chartjs-duration-scale.js has 293 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* global window: false */
    'use strict';
    var moment = require('moment-timezone');
    
    function prettyPrintDuration (tick) {
    Severity: Minor
    Found in src/widgets/chartjs-duration-scale.js - About 3 hrs to fix

      Function buildTicks has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          buildTicks: function () {
            var me = this;
      
            me.ctx.save();
            var tickFontSize = helpers.getValueOrDefault(me.options.ticks.fontSize, Chart.defaults.global.defaultFontSize);
      Severity: Major
      Found in src/widgets/chartjs-duration-scale.js - About 2 hrs to fix

        Function determineDataLimits has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            determineDataLimits: function () {
              var me = this;
              me.labelMoments = [];
        
              // Get min max from labels
        Severity: Minor
        Found in src/widgets/chartjs-duration-scale.js - About 1 hr to fix

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

              buildLabelDiffs: function () {
                var me = this;
                me.labelDiffs = [];
                var scaleLabelDiffs = [];
                // Parse common labels once
          Severity: Minor
          Found in src/widgets/chartjs-duration-scale.js - About 1 hr to fix

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

            function prettyPrintDuration (tick) {
              var parts = [];
              var count;
              var remainder = moment.duration(tick);
            
            
            Severity: Minor
            Found in src/widgets/chartjs-duration-scale.js - About 1 hr to fix

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

                    var innerWidth = me.isHorizontal() ? me.width - (me.paddingLeft + me.paddingRight) : me.height - (me.paddingTop + me.paddingBottom);
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 1 other location - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 366..366

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

              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

                    var innerDimension = me.isHorizontal() ? me.width - (me.paddingLeft + me.paddingRight) : me.height - (me.paddingTop + me.paddingBottom);
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 1 other location - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 226..226

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

              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 (moment.isDuration(labelMoment)) {
                          scaleLabelDiffs.push(moment.duration(labelMoment).subtract(me.firstTick).as(me.tickUnit));
                        }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 1 other location - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 200..202

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

              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 (moment.isDuration(labelMoment)) {
                            diffsForDataset.push(moment.duration(labelMoment).subtract(me.firstTick).as(me.tickUnit));
                          }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 1 other location - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 182..184

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

              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

                          if (me.isHorizontal()) {
                            labelMoment = me.parseDuration(value.x);
                          } else {
                            labelMoment = me.parseDuration(value.y);
                          }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 1 other location - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 194..198

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

              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

                          if (me.isHorizontal()) {
                            labelMoment = me.parseDuration(value.x);
                          } else {
                            labelMoment = me.parseDuration(value.y);
                          }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 1 other location - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 148..152

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

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

                if (count) { if (count === 1) { parts.push('1 year'); } else { parts.push(count.toString() + ' years'); } }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 7 other locations - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 15..15
              src/widgets/chartjs-duration-scale.js on lines 19..19
              src/widgets/chartjs-duration-scale.js on lines 23..23
              src/widgets/chartjs-duration-scale.js on lines 27..27
              src/widgets/chartjs-duration-scale.js on lines 31..31
              src/widgets/chartjs-duration-scale.js on lines 35..35
              src/widgets/chartjs-duration-scale.js on lines 39..39

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

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

                if (count) { if (count === 1) { parts.push('1 week'); } else { parts.push(count.toString() + ' weeks'); } }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 7 other locations - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 11..11
              src/widgets/chartjs-duration-scale.js on lines 15..15
              src/widgets/chartjs-duration-scale.js on lines 23..23
              src/widgets/chartjs-duration-scale.js on lines 27..27
              src/widgets/chartjs-duration-scale.js on lines 31..31
              src/widgets/chartjs-duration-scale.js on lines 35..35
              src/widgets/chartjs-duration-scale.js on lines 39..39

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

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

                if (count) { if (count === 1) { parts.push('1 hour'); } else { parts.push(count.toString() + ' hours'); } }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 7 other locations - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 11..11
              src/widgets/chartjs-duration-scale.js on lines 15..15
              src/widgets/chartjs-duration-scale.js on lines 19..19
              src/widgets/chartjs-duration-scale.js on lines 23..23
              src/widgets/chartjs-duration-scale.js on lines 31..31
              src/widgets/chartjs-duration-scale.js on lines 35..35
              src/widgets/chartjs-duration-scale.js on lines 39..39

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

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

                if (count) { if (count === 1) { parts.push('1 day'); } else { parts.push(count.toString() + ' days'); } }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 7 other locations - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 11..11
              src/widgets/chartjs-duration-scale.js on lines 15..15
              src/widgets/chartjs-duration-scale.js on lines 19..19
              src/widgets/chartjs-duration-scale.js on lines 27..27
              src/widgets/chartjs-duration-scale.js on lines 31..31
              src/widgets/chartjs-duration-scale.js on lines 35..35
              src/widgets/chartjs-duration-scale.js on lines 39..39

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

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

                if (count) { if (count === 1) { parts.push('1 minute'); } else { parts.push(count.toString() + ' minutes'); } }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 7 other locations - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 11..11
              src/widgets/chartjs-duration-scale.js on lines 15..15
              src/widgets/chartjs-duration-scale.js on lines 19..19
              src/widgets/chartjs-duration-scale.js on lines 23..23
              src/widgets/chartjs-duration-scale.js on lines 27..27
              src/widgets/chartjs-duration-scale.js on lines 35..35
              src/widgets/chartjs-duration-scale.js on lines 39..39

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

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

                if (count) { if (count === 1) { parts.push('1 millisecond'); } else { parts.push(count.toString() + ' milliseconds'); } }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 7 other locations - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 11..11
              src/widgets/chartjs-duration-scale.js on lines 15..15
              src/widgets/chartjs-duration-scale.js on lines 19..19
              src/widgets/chartjs-duration-scale.js on lines 23..23
              src/widgets/chartjs-duration-scale.js on lines 27..27
              src/widgets/chartjs-duration-scale.js on lines 31..31
              src/widgets/chartjs-duration-scale.js on lines 35..35

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

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

                if (count) { if (count === 1) { parts.push('1 second'); } else { parts.push(count.toString() + ' seconds'); } }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 7 other locations - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 11..11
              src/widgets/chartjs-duration-scale.js on lines 15..15
              src/widgets/chartjs-duration-scale.js on lines 19..19
              src/widgets/chartjs-duration-scale.js on lines 23..23
              src/widgets/chartjs-duration-scale.js on lines 27..27
              src/widgets/chartjs-duration-scale.js on lines 31..31
              src/widgets/chartjs-duration-scale.js on lines 39..39

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

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

                if (count) { if (count === 1) { parts.push('1 month'); } else { parts.push(count.toString() + ' months'); } }
              Severity: Major
              Found in src/widgets/chartjs-duration-scale.js and 7 other locations - About 1 hr to fix
              src/widgets/chartjs-duration-scale.js on lines 11..11
              src/widgets/chartjs-duration-scale.js on lines 19..19
              src/widgets/chartjs-duration-scale.js on lines 23..23
              src/widgets/chartjs-duration-scale.js on lines 27..27
              src/widgets/chartjs-duration-scale.js on lines 31..31
              src/widgets/chartjs-duration-scale.js on lines 35..35
              src/widgets/chartjs-duration-scale.js on lines 39..39

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

              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

                    me.scaleSizeInUnits = moment.duration(me.lastTick).subtract(me.firstTick).as(me.tickUnit);
              Severity: Minor
              Found in src/widgets/chartjs-duration-scale.js and 1 other location - About 35 mins to fix
              src/widgets/chartjs-duration-scale.js on lines 287..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 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

                    me.scaleSizeInUnits = moment.duration(me.lastTick).subtract(me.firstTick).as(me.tickUnit);
              Severity: Minor
              Found in src/widgets/chartjs-duration-scale.js and 1 other location - About 35 mins to fix
              src/widgets/chartjs-duration-scale.js on lines 238..238

              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

              There are no issues that match your filters.

              Category
              Status