burningpony/phd_checker

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

Summary

Maintainability
F
6 days
Test Coverage

File simple_modal.js has 582 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * SimpleModal @VERSION - jQuery Plugin
 * http://simplemodal.com/
 * Copyright (c) 2013 Eric Martin
 * Licensed under MIT and GPL
Severity: Major
Found in app/assets/javascripts/simple_modal.js - About 1 day to fix

    Function fixIE has 140 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            fixIE: function() {
                var s = this,
                    p = s.o.position;
    
                // simulate fixed position - adapted from BlockUI
    Severity: Major
    Found in app/assets/javascripts/simple_modal.js - About 5 hrs to fix

      Function create has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              create: function(data) {
                  var s = this;
      
                  // get the window properties
                  s.getDimensions();
      Severity: Major
      Found in app/assets/javascripts/simple_modal.js - About 2 hrs to fix

        Function setContainerDimensions has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                setContainerDimensions: function() {
                    var s = this,
                        badIE = browser.ie6 || browser.ie7;
        
                    // get the dimensions for the container and data
        Severity: Major
        Found in app/assets/javascripts/simple_modal.js - About 2 hrs to fix

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

                  init: function(data, options) {
                      var s = this;
          
                      // don't allow multiple calls
                      if (s.d.data) {
          Severity: Minor
          Found in app/assets/javascripts/simple_modal.js - About 1 hr to fix

            Function bindEvents has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    bindEvents: function() {
                        var s = this;
            
                        // bind the close event to any element with the closeClass class
                        $("." + s.o.closeClass).bind("click.simplemodal", function(e) {
            Severity: Minor
            Found in app/assets/javascripts/simple_modal.js - About 1 hr to fix

              Function close has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      close: function() {
                          var s = this;
              
                          // prevent close when dialog does not exist
                          if (!s.d.data) {
              Severity: Minor
              Found in app/assets/javascripts/simple_modal.js - About 1 hr to fix

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

                                                te = top.indexOf("%") === -1
                                                    ? top +
                                                          " + (t = " +
                                                          st +
                                                          " ? " +
                Severity: Major
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/simple_modal.js on lines 550..570

                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

                                                    le = left.indexOf("%") === -1
                                                        ? left +
                                                              " + (t = " +
                                                              sl +
                                                              " ? " +
                Severity: Major
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/simple_modal.js on lines 524..544

                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

                            var ch = s.d.origHeight
                                ? s.d.origHeight
                                : browser.opera
                                  ? s.d.container.height()
                                  : s.getVal(
                Severity: Major
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/simple_modal.js on lines 688..697

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

                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

                                cw = s.d.origWidth
                                    ? s.d.origWidth
                                    : browser.opera
                                      ? s.d.container.width()
                                      : s.getVal(
                Severity: Major
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/simple_modal.js on lines 678..687

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

                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 (!cw) {
                                if (!dw) {
                                    cw = mow;
                                } else {
                                    if (dw > mw) {
                Severity: Major
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/simple_modal.js on lines 712..726

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

                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 (!ch) {
                                if (!dh) {
                                    ch = moh;
                                } else {
                                    if (dh > mh) {
                Severity: Major
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/simple_modal.js on lines 730..744

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

                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 ($.isFunction(s.o.onShow)) {
                                s.o.onShow.apply(s, [s.d]);
                            }
                Severity: Minor
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/simple_modal.js on lines 844..846

                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 ($.isFunction(s.o.onHide)) {
                                s.o.onHide.apply(s, [s.d]);
                            }
                Severity: Minor
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/simple_modal.js on lines 297..299

                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

                                                te =
                                                    "(" +
                                                    ch +
                                                    " || " +
                                                    bch +
                Severity: Minor
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/simple_modal.js on lines 585..596

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

                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

                                                le =
                                                    "(" +
                                                    cw +
                                                    " || " +
                                                    bcw +
                Severity: Minor
                Found in app/assets/javascripts/simple_modal.js and 1 other location - About 35 mins to fix
                app/assets/javascripts/simple_modal.js on lines 573..584

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

                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