live627/livedate

View on GitHub

Showing 9 of 9 total issues

Function Livedate has 227 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function Livedate (input, uconf)
    {
        var
            conf = extend({
                yearRange: [-5, 10],
Severity: Major
Found in src/livedate.js - About 1 day to fix

    Function setValue has 91 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                setValue = function(year, month, day, fromKey)
                {
                    var date = integer(month) >= -1 ? new Date(integer(year), integer(month), integer(day == undefined || isNaN(day) ? 1 : day)) : year || value;
    
                    if (date < min)
    Severity: Major
    Found in src/livedate.js - About 3 hrs to fix

      Function factory has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function factory(version) {
          return {
              entry: './src/livedate.js',
              output: {
                  path: path.join(__dirname, 'build'),
      Severity: Minor
      Found in webpack.config.js - About 1 hr to fix

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

                            if (j < begin)
                            {
                                cls[cls.length] = 'disabled';
                                num = prevDays - begin + j + 1;
                                thisDate = new Date(year, month - 1, num);
        Severity: Major
        Found in src/livedate.js and 1 other location - About 1 hr to fix
        src/livedate.js on lines 135..164

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

                            else if (j >= begin + days)
                            {
                                cls[cls.length] = 'disabled';
                                num = j - days - begin + 1;
                                thisDate = new Date(year, month + 1, num);
        Severity: Major
        Found in src/livedate.js and 1 other location - About 1 hr to fix
        src/livedate.js on lines 129..164

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

                                if ((min && min < new Date(year, i + 1, 1)) && (max && max > new Date(year, i, 0))) {
                                    var opt = document.createElement("option");
        
                                    opt.value = i;
                                    opt.text = m;
        Severity: Minor
        Found in src/livedate.js and 1 other location - About 50 mins to fix
        src/livedate.js on lines 102..108

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

        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 ((min && min < new Date(i + 1, 0, 1)) && (max && max > new Date(i, 0, 0))) {
                                    var opt = document.createElement("option");
        
                                    opt.value = i;
                                    opt.text = i;
        Severity: Minor
        Found in src/livedate.js and 1 other location - About 50 mins to fix
        src/livedate.js on lines 91..97

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

        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

        Avoid too many return statements within this function.
        Open

                        return date;
        Severity: Major
        Found in src/livedate.js - About 30 mins to fix

          TODO found
          Open

          ## TODO
          Severity: Minor
          Found in README.md by fixme
          Severity
          Category
          Status
          Source
          Language