expertiza/expertiza

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

Summary

Maintainability
A
2 hrs
Test Coverage

Function checkIfFileSelected has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function checkIfFileSelected(operation){
        var tbl = document.getElementById("file_table");
        var numChecks = 0;
    var flag = 0;
        for(i=0; i<document.forms[2].elements.length; i++){
Severity: Minor
Found in app/assets/javascripts/shared.js - About 45 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

Consider simplifying this complex logical expression.
Open

    if(val1 == val2 || val1 == val3 || val1 == val4 || val2 == val3 || val2 == val4 || val3 == val4) {
        alert("No two columns can have same value.")
    } else {
        column_form.submit();
    }
Severity: Major
Found in app/assets/javascripts/shared.js - About 40 mins to fix

    Function checkTopicForDuplicatesAndRequiredColumns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function checkTopicForDuplicatesAndRequiredColumns(optional_count) {
    
        var sel1 = document.getElementById("select1");
        var sel2 = document.getElementById("select2");
        var sel3 = document.getElementById("select3");
    Severity: Minor
    Found in app/assets/javascripts/shared.js - About 35 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

    There are no issues that match your filters.

    Category
    Status