frisb/timeously

View on GitHub

Showing 38 of 38 total issues

File timeously.js has 667 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! timeously v0.2.2 (Sat, 7 Apr 2018 02:09:32)

Timeous interval creation for precise milestone events
@module timeously
@author Ashley Brener <ashley@frisb.com>
Severity: Major
Found in lib/timeously.js - About 1 day to fix

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

              if (startTime) {
                if (!started) {
                  this.started = true;
                  nextEvent[intervalType] += currTime > startTime ? limit - currTime + startTime : startTime - currTime;
                } else {
    Severity: Major
    Found in lib/timeously.js and 1 other location - About 1 day to fix
    src/index.js on lines 154..182

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

    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 (startTime) {
          if (!started) {
            this.started = true;
            nextEvent[intervalType] += currTime > startTime ? limit - currTime + startTime : startTime - currTime;
          }
    Severity: Major
    Found in src/index.js and 1 other location - About 1 day to fix
    lib/timeously.js on lines 259..284

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

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

        var TimeBucket = function () {
            function TimeBucket(date) {
                (0, _classCallCheck3.default)(this, TimeBucket);
        
                if (!date) {
    Severity: Major
    Found in lib/timeously.js - About 6 hrs to fix

      Function Timeously has 162 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var Timeously = function () {
            function Timeously(options, callback) {
              (0, _classCallCheck3.default)(this, Timeously);
              var name = options.name,
                  interval = options.interval,
      Severity: Major
      Found in lib/timeously.js - About 6 hrs to fix

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

          calculateNextTimeout() {
            let {name, title, interval, intervalType, started, now, startTime, stopTime} = this;
        
            let limit = getLimit(intervalType, now);
        
        
        Severity: Minor
        Found in src/index.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

        TimeBucket has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export default class TimeBucket {
            constructor(date) {
                if (!date) {
                    date = new Date();
                }
        Severity: Minor
        Found in src/timebucket.js - About 3 hrs to fix

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

              for (let i = 6; i >= 0; i--) {
                let interv = intervals[i];
                if (interv === intervalType) break;
          
                switch (interv) {
          Severity: Major
          Found in src/index.js and 1 other location - About 3 hrs to fix
          lib/timeously.js on lines 237..252

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

          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

                    for (var i = 6; i >= 0; i--) {
                      var interv = intervals[i];
                      if (interv === intervalType) break;
              
                      switch (interv) {
          Severity: Major
          Found in lib/timeously.js and 1 other location - About 3 hrs to fix
          src/index.js on lines 131..147

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

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

          module.exports = function (grunt) {
            grunt.initConfig({
              pkg: grunt.file.readJSON('package.json'),
              headline: '<%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("ddd, d mmm yyyy hh:MM:ss") %>)',
              license: grunt.file.read('LICENSE'),
          Severity: Major
          Found in Gruntfile.js - About 3 hrs to fix

            Function calculateNextTimeout has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    value: function calculateNextTimeout() {
                      var name = this.name,
                          title = this.title,
                          interval = this.interval,
                          intervalType = this.intervalType,
            Severity: Major
            Found in lib/timeously.js - About 2 hrs to fix

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

                calculateNextTimeout() {
                  let {name, title, interval, intervalType, started, now, startTime, stopTime} = this;
              
                  let limit = getLimit(intervalType, now);
              
              
              Severity: Minor
              Found in src/index.js - About 1 hr to fix

                Function TimeSpan has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var TimeSpan = function () {
                      function TimeSpan(millisec) {
                        (0, _classCallCheck3.default)(this, TimeSpan);
                    
                    
                Severity: Minor
                Found in lib/timeously.js - About 1 hr to fix

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

                          value: function execute() {
                            var self = this;
                      
                            if (!self.timerID) return;
                      
                  Severity: Major
                  Found in lib/timeously.js and 1 other location - About 1 hr to fix
                  src/index.js on lines 81..94

                  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

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

                              value: function tz(timezone) {
                                  if (!timezone) timezone = 'GMT';
                      
                                  this.tzOffsetMinutes = moment.tz(timezone).utcOffset();
                                  this.minute += this.tzOffsetMinutes - localOffsetMinutes;
                  Severity: Major
                  Found in lib/timeously.js and 1 other location - About 1 hr to fix
                  src/timebucket.js on lines 43..50

                  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

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

                      tz(timezone) {
                          if (!timezone)
                              timezone = 'GMT';
                  
                          this.tzOffsetMinutes = moment.tz(timezone).utcOffset();
                  Severity: Major
                  Found in src/timebucket.js and 1 other location - About 1 hr to fix
                  lib/timeously.js on lines 764..770

                  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

                    execute() {
                      let self = this;
                  
                      if (!self.timerID) return;
                  
                  
                  Severity: Major
                  Found in src/index.js and 1 other location - About 1 hr to fix
                  lib/timeously.js on lines 171..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 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

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

                  function validTime(currTime, startTime, stopTime) {
                    if (!startTime || !stopTime)
                      return true;
                  
                    if (startTime < stopTime)
                  Severity: Major
                  Found in src/index.js and 1 other location - About 1 hr to fix
                  lib/timeously.js on lines 137..143

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

                  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

                      function validTime(currTime, startTime, stopTime) {
                        if (!startTime || !stopTime) return true;
                      
                        if (startTime < stopTime) return currTime >= startTime && currTime <= stopTime;
                      
                  Severity: Major
                  Found in lib/timeously.js and 1 other location - About 1 hr to fix
                  src/index.js on lines 27..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 64.

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

                      var $export = function (type, name, source) {
                        var IS_FORCED = type & $export.F;
                        var IS_GLOBAL = type & $export.G;
                        var IS_STATIC = type & $export.S;
                        var IS_PROTO = type & $export.P;
                  Severity: Minor
                  Found in lib/timeously.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language