InfiniteCoder/apgw

View on GitHub

Showing 14 of 29 total issues

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

    $.getJSON("/api/dept", function (data) {
        var deptlistarray = [];
        for (var k = 0; k < data.length; k++) {
            deptlistarray.push(data[k].dept);
        }
Severity: Major
Found in src/main/resources/static/js/teacher.js and 1 other location - About 7 hrs to fix
src/main/resources/static/js/teacher.js on lines 50..68

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

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

function updateYear(data) {
    var yearlistarray = [];
    for (var k = 0; k < data.length; k++) {
        yearlistarray.push(data[k].year);
    }
Severity: Major
Found in src/main/resources/static/js/teacher.js and 1 other location - About 7 hrs to fix
src/main/resources/static/js/teacher.js on lines 27..46

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

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

function updateSubject(jqXHR) {
    var responseMsg = jqXHR.status;
    if (responseMsg === 201) {
        $("#modalMessage").text("Subject added");
        $("#successModal").modal("show");
Severity: Major
Found in src/main/resources/static/js/teacher.js and 1 other location - About 5 hrs to fix
src/main/resources/static/js/teacher/subject.js on lines 24..40

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

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

            success: function (data, textStatus, jqXHR) {
                var responseMsg = jqXHR.status;
                if (responseMsg === 201) {
                    $("#assignModalMsg").text("Assignments Uploaded Successfully");
                    $("#assignModal").modal("show");
Severity: Major
Found in src/main/resources/static/js/teacher/subject.js and 1 other location - About 5 hrs to fix
src/main/resources/static/js/teacher.js on lines 118..134

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

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

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

                for (var i = 0; i < data.length; i++) {
                    result += "<li class=\"list-group-item\" onclick=\"addSubmission(this)\" data-assign-id=" + data[i].id + ">" + data[i].title + "</li>";
                }
Severity: Major
Found in src/main/resources/static/js/student/assign.js and 1 other location - About 1 hr to fix
src/main/resources/static/js/teacher.js on lines 101..104

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

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

function showAssign(e) {
    var subId = e.getAttribute("data-sub-id");
    var subName = e.innerHTML;
    window.location = "/Student/Assignment.html" + "?id=" + subId + "&name=" + subName;
}
Severity: Major
Found in src/main/resources/static/js/student.js and 1 other location - About 1 hr to fix
src/main/resources/static/js/student/assign.js on lines 25..31

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

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

function addSubmission(e) {
    var assignId = e.getAttribute("data-assign-id");
    var assignName = e.innerHTML;

    window.location = "Submission.html" + "?id=" + assignId + "&name=" + assignName;
Severity: Major
Found in src/main/resources/static/js/student/assign.js and 1 other location - About 1 hr to fix
src/main/resources/static/js/student.js on lines 17..21

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

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

Parameter name 'Id' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

    Subject findByDetails_IdAndTeacher(Long Id, Teacher teacher);

Checks that method parameter names conform to a specified pattern.By using accessModifiers property it is possibleto specify different formats for methods at different visibility levels.

To validate catch parameters please useCatchParameterName.

To validate lambda parameters please useLambdaParameterName.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Severity
Category
Status
Source
Language