arastta/arastta

View on GitHub
catalog/view/javascript/jquery/datetimepicker/moment.js

Summary

Maintainability
F
5 mos
Test Coverage

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

//! moment.js
//! version : 2.8.3
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
Severity: Major
Found in catalog/view/javascript/jquery/datetimepicker/moment.js - About 6 days to fix

    Function addTimeToArrayFromToken has 112 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function addTimeToArrayFromToken(token, input, config) {
            var a, datePartArray = config._a;
    
            switch (token) {
            // QUARTER
    Severity: Major
    Found in catalog/view/javascript/jquery/datetimepicker/moment.js - About 4 hrs to fix

      Function getParseRegexForToken has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function getParseRegexForToken(token, config) {
              var a, strict = config._strict;
              switch (token) {
              case 'Q':
                  return parseTokenOneDigit;
      Severity: Major
      Found in catalog/view/javascript/jquery/datetimepicker/moment.js - About 3 hrs to fix

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

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

          Function makeDateFromStringAndFormat has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function makeDateFromStringAndFormat(config) {
                  if (config._f === moment.ISO_8601) {
                      parseISO(config);
                      return;
                  }
          Severity: Minor
          Found in catalog/view/javascript/jquery/datetimepicker/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 catalog/view/javascript/jquery/datetimepicker/moment.js - About 1 hr to fix

              Function makeList has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function makeList(field) {
                      var count, setter;
              
                      if (field.indexOf('week') === 0) {
                          count = 7;
              Severity: Minor
              Found in catalog/view/javascript/jquery/datetimepicker/moment.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if (m._a && m._pf.overflow === -2) {
                            overflow =
                                m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
                                m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
                                m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
                Severity: Critical
                Found in catalog/view/javascript/jquery/datetimepicker/moment.js - About 1 hr to fix

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

                          zone : function (input, keepLocalTime) {
                              var offset = this._offset || 0,
                                  localAdjust;
                              if (input != null) {
                                  if (typeof input === 'string') {
                  Severity: Minor
                  Found in catalog/view/javascript/jquery/datetimepicker/moment.js - About 1 hr to fix

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

                        function makeDateFromStringAndArray(config) {
                            var tempConfig,
                                bestMoment,
                    
                                scoreToBeat,
                    Severity: Minor
                    Found in catalog/view/javascript/jquery/datetimepicker/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 catalog/view/javascript/jquery/datetimepicker/moment.js - About 1 hr to fix

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

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

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

                              function dateFromConfig(config) {
                                  var i, date, input = [], currentDate, yearToUse;
                          
                                  if (config._d) {
                                      return;
                          Severity: Minor
                          Found in catalog/view/javascript/jquery/datetimepicker/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 catalog/view/javascript/jquery/datetimepicker/moment.js - About 1 hr to fix

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

                                  function makeDate(y, m, d, h, M, s, ms) {
                              Severity: Major
                              Found in catalog/view/javascript/jquery/datetimepicker/moment.js - About 50 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 catalog/view/javascript/jquery/datetimepicker/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 catalog/view/javascript/jquery/datetimepicker/moment.js - About 35 mins to fix

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

                                    (function (undefined) {
                                        /************************************
                                            Constants
                                        ************************************/
                                    
                                    
                                    Severity: Major
                                    Found in catalog/view/javascript/jquery/datetimepicker/moment.js and 1 other location - About 4 mos to fix
                                    admin/view/javascript/jquery/datetimepicker/moment.js on lines 7..2856

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

                                    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