sfstanley/citydogshare

View on GitHub
app/assets/javascripts/moment.js

Summary

Maintainability
F
1 wk
Test Coverage

File moment.js has 2280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//! moment.js
//! version : 2.10.2
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
Severity: Major
Found in app/assets/javascripts/moment.js - About 6 days to fix

    Consider simplifying this complex logical expression.
    Open

            if (a && m._pf.overflow === -2) {
                overflow =
                    a[MONTH]       < 0 || a[MONTH]       > 11  ? MONTH :
                    a[DATE]        < 1 || a[DATE]        > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
                    a[HOUR]        < 0 || a[HOUR]        > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
    Severity: Critical
    Found in app/assets/javascripts/moment.js - About 2 hrs to fix

      Function create__createDuration has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function create__createDuration (input, key) {
              var duration = input,
                  // matching against regexp is expensive, do it on demand
                  match = null,
                  sign,
      Severity: Major
      Found in app/assets/javascripts/moment.js - About 2 hrs to fix

        Function configFromStringAndFormat has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function configFromStringAndFormat(config) {
                // TODO: Move this to another part of the creation flow to prevent circular deps
                if (config._f === utils_hooks__hooks.ISO_8601) {
                    configFromISO(config);
                    return;
        Severity: Minor
        Found in app/assets/javascripts/moment.js - About 1 hr to fix

          Function copyConfig has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function copyConfig(to, from) {
                  var i, prop, val;
          
                  if (typeof from._isAMomentObject !== 'undefined') {
                      to._isAMomentObject = from._isAMomentObject;
          Severity: Minor
          Found in app/assets/javascripts/moment.js - About 1 hr to fix

            Function configFromArray has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function configFromArray (config) {
                    var i, date, input = [], currentDate, yearToUse;
            
                    if (config._d) {
                        return;
            Severity: Minor
            Found in app/assets/javascripts/moment.js - About 1 hr to fix

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

                  function configFromStringAndArray(config) {
                      var tempConfig,
                          bestMoment,
              
                          scoreToBeat,
              Severity: Minor
              Found in app/assets/javascripts/moment.js - About 1 hr to fix

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

                    function getSetOffset (input, keepLocalTime) {
                        var offset = this._offset || 0,
                            localAdjust;
                        if (input != null) {
                            if (typeof input === 'string') {
                Severity: Minor
                Found in app/assets/javascripts/moment.js - About 1 hr to fix

                  Function startOf has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function startOf (units) {
                          units = normalizeUnits(units);
                          // the following switch intentionally omits break keywords
                          // to utilize falling through the cases.
                          switch (units) {
                  Severity: Minor
                  Found in app/assets/javascripts/moment.js - About 1 hr to fix

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

                        function dayOfYearFromWeekInfo(config) {
                            var w, weekYear, week, weekday, dow, doy, temp;
                    
                            w = config._w;
                            if (w.GG != null || w.W != null || w.E != null) {
                    Severity: Minor
                    Found in app/assets/javascripts/moment.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (m._isValid == null) {
                                  m._isValid = !isNaN(m._d.getTime()) &&
                                      m._pf.overflow < 0 &&
                                      !m._pf.empty &&
                                      !m._pf.invalidMonth &&
                      Severity: Major
                      Found in app/assets/javascripts/moment.js - About 1 hr to fix

                        Function createDate has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            function createDate (y, m, d, h, M, s, ms) {
                        Severity: Major
                        Found in app/assets/javascripts/moment.js - About 50 mins to fix

                          Function createLocalOrUTC has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              function createLocalOrUTC (input, format, locale, strict, isUTC) {
                          Severity: Minor
                          Found in app/assets/javascripts/moment.js - About 35 mins to fix

                            Function list has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                function list (format, index, field, count, setter) {
                            Severity: Minor
                            Found in app/assets/javascripts/moment.js - About 35 mins to fix

                              Function dayOfYearFromWeeks has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
                              Severity: Minor
                              Found in app/assets/javascripts/moment.js - About 35 mins to fix

                                Function substituteTimeAgo has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
                                Severity: Minor
                                Found in app/assets/javascripts/moment.js - About 35 mins to fix

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

                                          if (b - anchor < 0) {
                                              anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
                                              // linear across the month
                                              adjust = (b - anchor) / (anchor - anchor2);
                                          } else {
                                  Severity: Minor
                                  Found in app/assets/javascripts/moment.js and 1 other location - About 55 mins to fix
                                  app/assets/javascripts/moment.js on lines 1900..1904

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

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

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

                                          } else {
                                              anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
                                              // linear across the month
                                              adjust = (b - anchor) / (anchor2 - anchor);
                                          }
                                  Severity: Minor
                                  Found in app/assets/javascripts/moment.js and 1 other location - About 55 mins to fix
                                  app/assets/javascripts/moment.js on lines 1896..1900

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

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

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

                                                  this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
                                  Severity: Minor
                                  Found in app/assets/javascripts/moment.js and 1 other location - About 35 mins to fix
                                  app/assets/javascripts/moment.js on lines 647..647

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

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

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

                                                  this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
                                  Severity: Minor
                                  Found in app/assets/javascripts/moment.js and 1 other location - About 35 mins to fix
                                  app/assets/javascripts/moment.js on lines 648..648

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

                                  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

                                      addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
                                          week[token.substr(0, 2)] = toInt(input);
                                      });
                                  Severity: Minor
                                  Found in app/assets/javascripts/moment.js and 1 other location - About 30 mins to fix
                                  app/assets/javascripts/moment.js on lines 910..912

                                  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

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

                                      var prototypeMax = deprecate(
                                          'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
                                          function () {
                                              var other = local__createLocal.apply(null, arguments);
                                              return other > this ? this : other;
                                  Severity: Minor
                                  Found in app/assets/javascripts/moment.js and 1 other location - About 30 mins to fix
                                  app/assets/javascripts/moment.js on lines 1370..1376

                                  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

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

                                      var prototypeMin = deprecate(
                                           'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
                                           function () {
                                               var other = local__createLocal.apply(null, arguments);
                                               return other < this ? this : other;
                                  Severity: Minor
                                  Found in app/assets/javascripts/moment.js and 1 other location - About 30 mins to fix
                                  app/assets/javascripts/moment.js on lines 1378..1384

                                  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

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

                                      addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
                                          week[token.substr(0, 1)] = toInt(input);
                                      });
                                  Severity: Minor
                                  Found in app/assets/javascripts/moment.js and 1 other location - About 30 mins to fix
                                  app/assets/javascripts/moment.js on lines 2084..2086

                                  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