KarrLab/test_history_server

View on GitHub
public/static/js/flot-0.8.3/examples/axes-time-zones/date.js

Summary

Maintainability
F
5 days
Test Coverage

Function timezone has 371 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  timezoneJS.timezone = new function () {
    var _this = this
      , regionMap = {'Etc':'etcetera','EST':'northamerica','MST':'northamerica','HST':'northamerica','EST5EDT':'northamerica','CST6CDT':'northamerica','MST7MDT':'northamerica','PST8PDT':'northamerica','America':'northamerica','Pacific':'australasia','Atlantic':'europe','Africa':'africa','Indian':'africa','Antarctica':'antarctica','Asia':'asia','Australia':'australasia','Europe':'europe','WET':'europe','CET':'europe','MET':'europe','EET':'europe'}
      , regionExceptions = {'Pacific/Honolulu':'northamerica','Atlantic/Bermuda':'northamerica','Atlantic/Cape_Verde':'africa','Atlantic/St_Helena':'africa','Indian/Kerguelen':'antarctica','Indian/Chagos':'asia','Indian/Maldives':'asia','Indian/Christmas':'australasia','Indian/Cocos':'australasia','America/Danmarkshavn':'europe','America/Scoresbysund':'europe','America/Godthab':'europe','America/Thule':'europe','Asia/Yekaterinburg':'europe','Asia/Omsk':'europe','Asia/Novosibirsk':'europe','Asia/Krasnoyarsk':'europe','Asia/Irkutsk':'europe','Asia/Yakutsk':'europe','Asia/Vladivostok':'europe','Asia/Sakhalin':'europe','Asia/Magadan':'europe','Asia/Kamchatka':'europe','Asia/Anadyr':'europe','Africa/Ceuta':'europe','America/Argentina/Buenos_Aires':'southamerica','America/Argentina/Cordoba':'southamerica','America/Argentina/Tucuman':'southamerica','America/Argentina/La_Rioja':'southamerica','America/Argentina/San_Juan':'southamerica','America/Argentina/Jujuy':'southamerica','America/Argentina/Catamarca':'southamerica','America/Argentina/Mendoza':'southamerica','America/Argentina/Rio_Gallegos':'southamerica','America/Argentina/Ushuaia':'southamerica','America/Aruba':'southamerica','America/La_Paz':'southamerica','America/Noronha':'southamerica','America/Belem':'southamerica','America/Fortaleza':'southamerica','America/Recife':'southamerica','America/Araguaina':'southamerica','America/Maceio':'southamerica','America/Bahia':'southamerica','America/Sao_Paulo':'southamerica','America/Campo_Grande':'southamerica','America/Cuiaba':'southamerica','America/Porto_Velho':'southamerica','America/Boa_Vista':'southamerica','America/Manaus':'southamerica','America/Eirunepe':'southamerica','America/Rio_Branco':'southamerica','America/Santiago':'southamerica','Pacific/Easter':'southamerica','America/Bogota':'southamerica','America/Curacao':'southamerica','America/Guayaquil':'southamerica','Pacific/Galapagos':'southamerica','Atlantic/Stanley':'southamerica','America/Cayenne':'southamerica','America/Guyana':'southamerica','America/Asuncion':'southamerica','America/Lima':'southamerica','Atlantic/South_Georgia':'southamerica','America/Paramaribo':'southamerica','America/Port_of_Spain':'southamerica','America/Montevideo':'southamerica','America/Caracas':'southamerica'};
    function invalidTZError(t) { throw new Error('Timezone "' + t + '" is either incorrect, or not loaded in the timezone registry.'); }
Severity: Major
Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js - About 1 day to fix

    File date.js has 666 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // -----
    // The `timezoneJS.Date` object gives you full-blown timezone support, independent from the timezone set on the end-user's machine running the browser. It uses the Olson zoneinfo files for its timezone data.
    //
    // The constructor function and setter methods use proxy JavaScript Date objects behind the scenes, so you can use strings like '10/22/2006' with the constructor. You also get the same sensible wraparound behavior with numeric parameters (like setting a value of 14 for the month wraps around to the next March).
    //
    Severity: Major
    Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js - About 1 day to fix

      Function getRule has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function getRule(dt, zone, isUTC) {
            var date = typeof dt === 'number' ? new Date(dt) : dt;
            var ruleset = zone[1];
            var basicOffset = zone[0];
      
      
      Severity: Major
      Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js - About 4 hrs to fix

        Function parseZones has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.parseZones = function (str) {
              var lines = str.split('\n')
                , arr = []
                , chunk = ''
                , l
        Severity: Minor
        Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js - About 1 hr to fix

          Function Date has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            timezoneJS.Date = function () {
              var args = Array.prototype.slice.apply(arguments)
              , dt = null
              , tz = null
              , arr = [];
          Severity: Minor
          Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js - About 1 hr to fix

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

                  var convertRuleToExactDateAndTime = function (yearAndRule, prevRule) {
                    var year = yearAndRule[0]
                      , rule = yearAndRule[1];
                      // Assume that the rule applies to the year of the given date.
            
            
            Severity: Minor
            Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js - About 1 hr to fix

              Function toString has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  toString: function (format, tz) {
                    // Default format is the same as toISOString
                    if (!format) format = 'yyyy-MM-dd HH:mm:ss';
                    var result = format;
                    var tzInfo = tz ? timezoneJS.timezone.getTzInfo(this.getTime(), tz) : this.getTimezoneInfo();
              Severity: Minor
              Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js - About 1 hr to fix

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

                        if (a.constructor !== Date) {
                          year = a[0];
                          rule = a[1];
                          a = (!prev && EXACT_DATE_TIME[year] && EXACT_DATE_TIME[year][rule])
                            ? EXACT_DATE_TIME[year][rule]
                Severity: Major
                Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js and 1 other location - About 3 hrs to fix
                public/static/js/flot-0.8.3/examples/axes-time-zones/date.js on lines 658..665

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

                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 (b.constructor !== Date) {
                          year = b[0];
                          rule = b[1];
                          b = (!prev && EXACT_DATE_TIME[year] && EXACT_DATE_TIME[year][rule]) ? EXACT_DATE_TIME[year][rule]
                            : convertRuleToExactDateAndTime(b, prev);
                Severity: Major
                Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js and 1 other location - About 3 hrs to fix
                public/static/js/flot-0.8.3/examples/axes-time-zones/date.js on lines 649..657

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

                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

                      var meth = unit === 'year' ? 'FullYear' : unit.substr(0, 1).toUpperCase() + unit.substr(1);
                Severity: Minor
                Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js and 1 other location - About 30 mins to fix
                public/static/js/flot-0.8.3/examples/axes-time-zones/date.js on lines 306..306

                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

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

                      var meth = unit === 'year' ? 'FullYear' : unit.substr(0, 1).toUpperCase() + unit.substr(1);
                Severity: Minor
                Found in public/static/js/flot-0.8.3/examples/axes-time-zones/date.js and 1 other location - About 30 mins to fix
                public/static/js/flot-0.8.3/examples/axes-time-zones/date.js on lines 300..300

                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