burningpony/phd_checker

View on GitHub

Showing 103 of 103 total issues

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

        if (
            n[i].text != null &&
            n[i - 1].text == null &&
            n[i].row > 0 &&
            o[n[i].row - 1].text == null &&
Severity: Major
Found in app/assets/javascripts/diff.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/diff.js on lines 172..181

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

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 (h.toString().indexOf('%') > -1) {
                h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';

            } else {
                h = h == 'auto' ? 'auto' : h + 'px';    
Severity: Major
Found in public/fancybox/jquery.fancybox-1.3.4.js and 1 other location - About 3 hrs to fix
public/fancybox/jquery.fancybox-1.3.4.js on lines 284..289

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

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

    for (var i = 0; i < o.length; i++) {
        if (os[o[i]] == null) os[o[i]] = { rows: new Array(), n: null };
        os[o[i]].rows.push(i);
    }
Severity: Major
Found in app/assets/javascripts/diff.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/diff.js on lines 150..153

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

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

    for (var i = 0; i < n.length; i++) {
        if (ns[n[i]] == null) ns[n[i]] = { rows: new Array(), o: null };
        ns[n[i]].rows.push(i);
    }
Severity: Major
Found in app/assets/javascripts/diff.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/diff.js on lines 155..158

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

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 (currentOpts.width.toString().indexOf('%') > -1) {
                to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
            } else {
                to.width = currentOpts.width + double_padding;
            }
Severity: Major
Found in public/fancybox/jquery.fancybox-1.3.4.js and 1 other location - About 2 hrs to fix
public/fancybox/jquery.fancybox-1.3.4.js on lines 695..699

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

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

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

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

                if (currentOpts.height.toString().indexOf('%') > -1) {
                    to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
                } else {
                    to.height = currentOpts.height + double_padding;
                }
    Severity: Major
    Found in public/fancybox/jquery.fancybox-1.3.4.js and 1 other location - About 2 hrs to fix
    public/fancybox/jquery.fancybox-1.3.4.js on lines 689..693

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

    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

    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 _process_title has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _process_title = function() {
                  titleStr = currentOpts.title || '';
                  titleHeight = 0;
      
                  title
      Severity: Major
      Found in public/fancybox/jquery.fancybox-1.3.4.js - About 2 hrs to fix

        Method analyze has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def analyze
            {
              id: id,
              group: group,
              data_id: participant_id,
        Severity: Major
        Found in app/models/user.rb - About 2 hrs to fix

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

              $.fancybox.close = function() {
                  if (busy || wrap.is(':hidden')) {
                      return;
                  }
          
          Severity: Major
          Found in public/fancybox/jquery.fancybox-1.3.4.js - About 2 hrs to fix

            Function diffString2 has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function diffString2(o, n) {
                o = o.replace(/\s+$/, "");
                n = n.replace(/\s+$/, "");
            
                var out = diff(
            Severity: Minor
            Found in app/assets/javascripts/diff.js - About 1 hr to fix

              Function diff has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              function diff(o, n) {
                  var ns = new Object();
                  var os = new Object();
              
                  for (var i = 0; i < n.length; i++) {
              Severity: Minor
              Found in app/assets/javascripts/diff.js - About 1 hr 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 init has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $.fancybox.init = function() {
                      if ($("#fancybox-wrap").length) {
                          return;
                      }
              
              Severity: Minor
              Found in public/fancybox/jquery.fancybox-1.3.4.js - About 1 hr to fix

                Function diffString has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function diffString(o, n) {
                    o = o.replace(/\s+$/, "");
                    n = n.replace(/\s+$/, "");
                
                    var out = diff(
                Severity: Minor
                Found in app/assets/javascripts/diff.js - About 1 hr to fix

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

                  function diff(o, n) {
                      var ns = new Object();
                      var os = new Object();
                  
                      for (var i = 0; i < n.length; i++) {
                  Severity: Minor
                  Found in app/assets/javascripts/diff.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language