dininski/CodeExecutionServer

View on GitHub

Showing 7 of 16 total issues

Function solve has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

function solve() {
    // Read input data
    $X = (float) fgets(STDIN);
    $Y = (float) fgets(STDIN);

Severity: Minor
Found in Sample/userCode.php - About 4 hrs 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 execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    execute: function (done) {
        var self = this;
        this.stdOut = new SimpleStream();
        this.stdErr = new SimpleStream();
        this._logger.info('Started new execution');
Severity: Minor
Found in src/Modules/CodeExecution/Executors/BaseExecutor.js - About 1 hr to fix

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

    init: function (executorId, executionId, timeLimit, stdin, userCode, executionFolder) {
Severity: Minor
Found in src/Models/CodeExecutionRequest.js - About 45 mins to fix

Consider simplifying this complex logical expression.
Open

if (xPoint == 0) and (yPoint == 0):
    print(0)
elif xPoint == 0:
    print(5)
elif yPoint == 0:
Severity: Major
Found in Sample/userCode.py - About 40 mins to fix

Avoid too many return statements within this method.
Open

        return 2;
Severity: Major
Found in Sample/userCode.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return 3;
Severity: Major
Found in Sample/userCode.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return 4;
Severity: Major
Found in Sample/userCode.php - About 30 mins to fix
Severity
Category
Status
Source
Language