InfiniteCoder/apgw

View on GitHub

Showing 6 of 29 total issues

Function assignUpload has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function assignUpload() {
    var subName = getUrlParameter("name");

    var assignmentTitle = document.getElementById("assignTitle").value;

Severity: Minor
Found in src/main/resources/static/js/teacher/subject.js - About 1 hr to fix

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

function displaySubFunc() {
    $.ajax(
        {
            url: "/api/submissions",
            type: "GET",
Severity: Minor
Found in src/main/resources/static/js/teacher/submission.js - About 1 hr to fix

Function subUploadFunc has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function subUploadFunc() {
    var file = document.getElementById("subFile").files[0];

    //create formdata object
    var formData = new FormData();
Severity: Minor
Found in src/main/resources/static/js/student/submission.js - About 1 hr to fix

Function studentUpload has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function studentUpload() {
    //console.log("student upload btn clicked");
    var file = document.getElementById("fileInput").files[0];

    //create formdata object
Severity: Minor
Found in src/main/resources/static/js/teacher/subject.js - About 1 hr to fix

Function displaySubFunc has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function displaySubFunc() {
    $.ajax(
        {
            url: "/api/submissions",
            type: "GET",
Severity: Minor
Found in src/main/resources/static/js/teacher/submission.js - 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 getUrlParameter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = decodeURIComponent(window.location.search.substring(1)),
        sURLVariables = sPageURL.split("&"),
        sParameterName,
        i;
Severity: Minor
Found in src/main/resources/static/js/common/navigation.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

Severity
Category
Status
Source
Language