ochko/prudge

View on GitHub

Showing 206 of 206 total issues

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

                } else if (type == 'text' && direction == 'desc') {
                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";
                } else if (type == 'numeric' && direction == 'asc') {
                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";
                } else if (type == 'numeric' && direction == 'desc') {
Severity: Major
Found in app/assets/javascripts/jquery.tablesorter.js and 3 other locations - About 1 hr to fix
app/assets/javascripts/jquery.tablesorter.js on lines 639..647
app/assets/javascripts/jquery.tablesorter.js on lines 643..647
app/assets/javascripts/jquery.tablesorter.js on lines 645..647

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                } else if (type == 'numeric' && direction == 'desc') {
                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";
                }
Severity: Major
Found in app/assets/javascripts/jquery.tablesorter.js and 3 other locations - About 1 hr to fix
app/assets/javascripts/jquery.tablesorter.js on lines 639..647
app/assets/javascripts/jquery.tablesorter.js on lines 641..647
app/assets/javascripts/jquery.tablesorter.js on lines 643..647

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      this.timeout = setTimeout(function() {
        if (self.hoverState == 'in') self.show()
      }, self.options.delay.show)
Severity: Major
Found in app/assets/javascripts/bootstrap.js and 1 other location - About 1 hr to fix
app/assets/javascripts/bootstrap.js on lines 1154..1156

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                if (type == 'text' && direction == 'asc') {
                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));";
                } else if (type == 'text' && direction == 'desc') {
                    return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";
                } else if (type == 'numeric' && direction == 'asc') {
Severity: Major
Found in app/assets/javascripts/jquery.tablesorter.js and 3 other locations - About 1 hr to fix
app/assets/javascripts/jquery.tablesorter.js on lines 641..647
app/assets/javascripts/jquery.tablesorter.js on lines 643..647
app/assets/javascripts/jquery.tablesorter.js on lines 645..647

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                } else if (type == 'numeric' && direction == 'asc') {
                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";
                } else if (type == 'numeric' && direction == 'desc') {
                    return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";
                }
Severity: Major
Found in app/assets/javascripts/jquery.tablesorter.js and 3 other locations - About 1 hr to fix
app/assets/javascripts/jquery.tablesorter.js on lines 639..647
app/assets/javascripts/jquery.tablesorter.js on lines 641..647
app/assets/javascripts/jquery.tablesorter.js on lines 645..647

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        "even": createPositionalPseudo(function( matchIndexes, length ) {
            for ( var i = 0; i < length; i += 2 ) {
                matchIndexes.push( i );
            }
            return matchIndexes;
Severity: Major
Found in app/assets/javascripts/jquery.js and 1 other location - About 1 hr to fix
app/assets/javascripts/jquery.js on lines 4537..4542

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def check(exe)
    solution.reset! unless solution.results.empty?

    @problem.tests.each do |test|
      break unless usage = execute(exe, test)
Severity: Minor
Found in app/models/sandbox.rb - About 55 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

Method after_save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def after_save(problem)
    if problem.changes['contest_id'] && problem.contest && problem.user.email_valid?
      Notifier.problem_selection(problem.user, problem.contest, problem)
    end
    # point depends on tried_count and solved_count
Severity: Minor
Found in app/observers/problem_observer.rb - About 55 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

Function access has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
Severity: Major
Found in app/assets/javascripts/jquery.js - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if ( deleteExpando ) {
                                delete elem[ internalKey ];
    
                            } else if ( elem.removeAttribute ) {
                                elem.removeAttribute( internalKey );
    Severity: Major
    Found in app/assets/javascripts/jquery.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                          if ( xml && xml.documentElement /* #4958 */ ) {
                                              responses.xml = xml;
                                          }
      Severity: Major
      Found in app/assets/javascripts/jquery.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                                if (a[j][0] != i) {
                                                    config.sortList.push(a[j]);
                                                }
        Severity: Major
        Found in app/assets/javascripts/jquery.tablesorter.js - About 45 mins to fix

          Function setMatcher has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
          Severity: Minor
          Found in app/assets/javascripts/jquery.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
                                        className = className.replace( " " + removes[ c ] + " " , " " );
                                    }
            Severity: Major
            Found in app/assets/javascripts/jquery.js - About 45 mins to fix

              Function inspectPrefiltersOrTransports has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
                      dataType /* internal */, inspected /* internal */ ) {
              Severity: Minor
              Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for ( c = 0, cl = classNames.length; c < cl; c++ ) {
                                            if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
                                                setClass += classNames[ c ] + " ";
                                            }
                                        }
                Severity: Major
                Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if ( elem === node ) {
                                                      break;
                                                  }
                  Severity: Major
                  Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                        if ( xhrOnUnloadAbort ) {
                                                            delete xhrCallbacks[ handle ];
                                                        }
                    Severity: Major
                    Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if ( elem.id !== match[2] ) {
                                                  return rootjQuery.find( selector );
                                              }
                      Severity: Major
                      Found in app/assets/javascripts/jquery.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if ( ret === false ) {
                                                    event.preventDefault();
                                                    event.stopPropagation();
                                                }
                        Severity: Major
                        Found in app/assets/javascripts/jquery.js - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language