gems-uff/sapos

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

Summary

Maintainability
F
2 wks
Test Coverage

Function Chronoline has a Cognitive Complexity of 244 (exceeds 5 allowed). Consider refactoring.
Open

function Chronoline(domElement, events, options) {
    this.VERSION = "0.1.1";

    var defaults = {
        defaultStartDate: null,  // the date furthest to the left on load. Defaults to today
Severity: Minor
Found in app/assets/javascripts/chronoline/chronoline.js - About 5 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function Chronoline has 598 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Chronoline(domElement, events, options) {
    this.VERSION = "0.1.1";

    var defaults = {
        defaultStartDate: null,  // the date furthest to the left on load. Defaults to today
Severity: Major
Found in app/assets/javascripts/chronoline/chronoline.js - About 2 days to fix

    File chronoline.js has 693 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // chronoline.js v0.1.1
    // by Kevin Leung for Zanbato, https://zanbato.com
    // MIT license at https://github.com/StoicLoofah/chronoline.js/blob/master/LICENSE.md
    
        if (!Date.now) {
    Severity: Major
    Found in app/assets/javascripts/chronoline/chronoline.js - About 1 day to fix

      Function goToPx has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          t.goToPx = function(finalLeft, isAnimated, isLabelsDrawn) {
              /*
                finalLeft is negative
      
                I tried several implementations here, including:
      Severity: Major
      Found in app/assets/javascripts/chronoline/chronoline.js - About 2 hrs to fix

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

            t.drawLabelsHelper = function(startMs, endMs){
                for(var curMs = startMs; curMs < endMs; curMs += DAY_IN_MILLISECONDS){
                    var curDate = new Date(curMs);
                    var day = curDate.getDate();
                    var x = t.msToPx(curMs);
        Severity: Minor
        Found in app/assets/javascripts/chronoline/chronoline.js - About 1 hr to fix

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

              t.drawLabels = function(leftPxPos){
                  var newStartPx = Math.max(0, leftPxPos - t.visibleWidth);
                  var newEndPx = Math.min(t.totalWidth, leftPxPos + 2 * t.visibleWidth);
          
                  var newStartDate = new Date(t.pxToMs(newStartPx));
          Severity: Minor
          Found in app/assets/javascripts/chronoline/chronoline.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                            if(t.sections[i].dates[0] < t.startDate)
                                t.startDate = t.sections[i].dates[0];
            Severity: Major
            Found in app/assets/javascripts/chronoline/chronoline.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if(t.sections[i].dates[1] > t.endDate)
                                  t.endDate = t.sections[i].dates[1];
              Severity: Major
              Found in app/assets/javascripts/chronoline/chronoline.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    for(var i = 0; i < t.sections.length; i++){
                                        if(t.sections[i].section == originalIndex){
                                            elem.data('sectionLabel', t.sectionLabelSet[i]);
                                            break;
                                        }
                Severity: Major
                Found in app/assets/javascripts/chronoline/chronoline.js - About 45 mins to fix

                  Function formatDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Date.prototype.formatDate = function(formatString){
                      /*
                       * done in the style of c's strftime
                       * http://www.cplusplus.com/reference/ctime/strftime/
                       * TODO slowly adding in new parts to this
                  Severity: Minor
                  Found in app/assets/javascripts/chronoline/chronoline.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

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

                          if(t.events.length > 0){
                              t.endDate = getEndDate(t.events[0].dates);
                              for(var i = 1; i < t.events.length; i++)
                                  if(getEndDate(t.events[i].dates) > t.endDate)
                                      t.endDate = getEndDate(t.events[i].dates);
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 261..274

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

                  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(t.events.length > 0){
                              t.startDate = t.events[0].dates[0];
                              for(var i = 1; i < t.events.length; i++)
                                  if(t.events[i].dates[0] < t.startDate)
                                      t.startDate = t.events[i].dates[0];
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 284..297

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

                  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

                              t.leftControl.onmousedown = function(e){
                                  t.toScrollDiscrete = true;
                                  t.scrollPaperStart = getLeft(t.paperElem);
                                  t.scrollTimeoutId = setTimeout(function(){
                                      t.toScrollDiscrete = false;  // switched is flipped
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 4 hrs to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 830..839

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

                  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

                              t.rightControl.onmousedown = function(e){
                                  t.toScrollDiscrete = true;
                                  t.scrollPaperStart = getLeft(t.paperElem);
                                  t.scrollTimeoutId = setTimeout(function(){
                                      t.toScrollDiscrete = false;  // switched is flipped
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 4 hrs to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 797..806

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

                  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

                                  elem.hover(function(){this.data('label').animate({opacity: 1}, 200);},
                                             function(){this.data('label').animate({opacity: 0}, 200);});
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 493..494

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

                  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

                                      elem.hover(function(){this.data('sectionLabel').animate({opacity: 1}, 200);},
                                                 function(){this.data('sectionLabel').animate({opacity: 0}, 200);});
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 397..398

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

                  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

                              t.endScrollRight = function(e){
                                  clearTimeout(t.scrollTimeoutId);
                                  if(t.toScrollDiscrete){
                                      t.toScrollDiscrete = false;
                                      t.scrollRightDiscrete();
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 788..795

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

                  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

                              t.endScrollLeft = function(e){
                                  clearTimeout(t.scrollTimeoutId);
                                  if(t.toScrollDiscrete){
                                      t.toScrollDiscrete = false;
                                      t.scrollLeftDiscrete();
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 821..828

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

                  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(formatString.indexOf('%a') != -1){
                          var day = Date.DAY_NAMES[this.getDay()].substring(0, 3);
                          ret = ret.replace('%a', day);
                      }
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 62..65

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

                  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(formatString.indexOf('%b') != -1){
                          var month = Date.MONTH_NAMES[this.getMonth()].substring(0, 3);
                          ret = ret.replace('%b', month);
                      }
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 69..72

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

                  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

                              for(var i = 0; i < movingLabels.length; i++){
                                  movingLabels[i][0].attr('x', movingLabels[i][2] + movingLabels[i][1]);
                              }
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 704..706

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

                  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

                                      for(var i = 0; i < movingLabels.length; i++){
                                          movingLabels[i][0].attr('x', movingLabels[i][2] + movingLabels[i][1]);
                                      }
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 714..716

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

                  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

                          t.scrollRightDiscrete = function(e){
                              t.goToDate(t.scrollRight(new Date(t.pxToMs(-getLeft(t.paperElem)))), -1);
                              return false;
                          };
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 762..765

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

                  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

                          t.scrollLeftDiscrete = function(e){
                              t.goToDate(t.scrollLeft(new Date(t.pxToMs(-getLeft(t.paperElem)))), -1);
                              return false;
                          };
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 767..770

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

                  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

                              jQuery(t.wrapper).addClass('dragging')
                                  .bind('mousemove', t.mouseMoved)
                                  .bind('mouseleave', t.stopDragging)
                                  .bind('mouseup', t.stopDragging);
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 856..859

                  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

                              jQuery(t.wrapper).removeClass('dragging')
                                  .unbind('mousemove', t.mouseMoved)
                                  .unbind('mouseleave', t.stopDragging)
                                  .unbind('mouseup', t.stopDragging);
                  Severity: Major
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 872..875

                  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

                                  subSubLabel.data('right-bound',
                                                   Math.min((endOfYear.getTime() - t.startTime) * t.pxRatio - 5,
                                                            t.totalWidth));
                  Severity: Minor
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 50 mins to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 580..582

                  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

                                      subLabel.data('right-bound',
                                                    Math.min((endOfMonth.getTime() - t.startTime) * t.pxRatio - 5,
                                                             t.totalWidth));
                  Severity: Minor
                  Found in app/assets/javascripts/chronoline/chronoline.js and 1 other location - About 50 mins to fix
                  app/assets/javascripts/chronoline/chronoline.js on lines 528..530

                  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

                  There are no issues that match your filters.

                  Category
                  Status