hummingbird-me/hummingbird

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

Summary

Maintainability
F
4 days
Test Coverage

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

// moment.js
// version : 2.0.0
// author : Tim Wood
// license : MIT
// momentjs.com
Severity: Major
Found in app/assets/javascripts/old/moment.js - About 2 days to fix

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

        function addTimeToArrayFromToken(token, input, config) {
            var a, b,
                datePartArray = config._a;
    
            switch (token) {
    Severity: Major
    Found in app/assets/javascripts/old/moment.js - About 3 hrs to fix

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

          function getParseRegexForToken(token) {
              switch (token) {
              case 'DDDD':
                  return parseTokenThreeDigits;
              case 'YYYY':
      Severity: Minor
      Found in app/assets/javascripts/old/moment.js - About 1 hr to fix

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

            function Duration(duration) {
                var data = this._data = {},
                    years = duration.years || duration.year || duration.y || 0,
                    months = duration.months || duration.month || duration.M || 0,
                    weeks = duration.weeks || duration.week || duration.w || 0,
        Severity: Minor
        Found in app/assets/javascripts/old/moment.js - About 1 hr to fix

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

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

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

                    isAfter: function (input, units) {
                        units = typeof units !== 'undefined' ? units : 'millisecond';
                        return +this.clone().startOf(units) > +moment(input).startOf(units);
                    },
            Severity: Major
            Found in app/assets/javascripts/old/moment.js and 2 other locations - About 1 hr to fix
            app/assets/javascripts/old/moment.js on lines 1236..1239
            app/assets/javascripts/old/moment.js on lines 1241..1244

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

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

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

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

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

            Refactorings

            Further Reading

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

                    isBefore: function (input, units) {
                        units = typeof units !== 'undefined' ? units : 'millisecond';
                        return +this.clone().startOf(units) < +moment(input).startOf(units);
                    },
            Severity: Major
            Found in app/assets/javascripts/old/moment.js and 2 other locations - About 1 hr to fix
            app/assets/javascripts/old/moment.js on lines 1231..1234
            app/assets/javascripts/old/moment.js on lines 1241..1244

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

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

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

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

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

            Refactorings

            Further Reading

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

                    isSame: function (input, units) {
                        units = typeof units !== 'undefined' ? units : 'millisecond';
                        return +this.clone().startOf(units) === +moment(input).startOf(units);
                    },
            Severity: Major
            Found in app/assets/javascripts/old/moment.js and 2 other locations - About 1 hr to fix
            app/assets/javascripts/old/moment.js on lines 1231..1234
            app/assets/javascripts/old/moment.js on lines 1236..1239

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

            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 {
                        date.setFullYear(input[0], input[1], input[2]);
                        date.setHours(input[3], input[4], input[5], input[6]);
                    }
            Severity: Major
            Found in app/assets/javascripts/old/moment.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/old/moment.js on lines 735..738

            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 (config._useUTC) {
                        date.setUTCFullYear(input[0], input[1], input[2]);
                        date.setUTCHours(input[3], input[4], input[5], input[6]);
                    } else {
            Severity: Major
            Found in app/assets/javascripts/old/moment.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/old/moment.js on lines 738..741

            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 (typeof input === 'string') {
                            dur = moment.duration(+val, input);
                        } else {
                            dur = moment.duration(input, val);
                        }
            Severity: Minor
            Found in app/assets/javascripts/old/moment.js and 1 other location - About 55 mins to fix
            app/assets/javascripts/old/moment.js on lines 1120..1124

            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

                        if (typeof input === 'string') {
                            dur = moment.duration(+val, input);
                        } else {
                            dur = moment.duration(input, val);
                        }
            Severity: Minor
            Found in app/assets/javascripts/old/moment.js and 1 other location - About 55 mins to fix
            app/assets/javascripts/old/moment.js on lines 1108..1112

            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

            There are no issues that match your filters.

            Category
            Status