Showing 63 of 199 total issues

Function Mock has 284 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func Mock(w http.ResponseWriter, req *http.Request) {
    ctx := appengine.NewContext(req)

    coduno, err := model.Company{
        Address: mail.Address{
Severity: Major
Found in controllers/mock.go - About 1 day to fix

Function MockFrequentisChallenge has 158 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func MockFrequentisChallenge(ctx context.Context, company *datastore.Key, w http.ResponseWriter, req *http.Request) {
    taskOne, err := model.Task{
        Assignment: model.Assignment{
            Name: "Diamond Bot",
            Description: "Diamond Bot is a simple remote-controlled robot. It is placed in a big hall that contains precious diamonds and dangerous bombs. " +
Severity: Major
Found in controllers/mock.go - About 5 hrs to fix

Function Invitation has 110 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func Invitation(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    if r.Method != "POST" {
        return http.StatusMethodNotAllowed, nil
    }

Severity: Major
Found in controllers/invitation.go - About 3 hrs to fix

Function TaskByKey has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
Open

func TaskByKey(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    p, ok := passenger.FromContext(ctx)
    if !ok {
        return http.StatusUnauthorized, nil
    }
Severity: Minor
Found in controllers/task.go - About 2 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 JUnit has 80 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func JUnit(ctx context.Context, tests, code io.Reader) (*model.JunitTestResult, error) {
    image := newImage("javaut")

    if err := prepareImage(image); err != nil {
        return nil, err
Severity: Major
Found in runner/javaut.go - About 2 hrs to fix

Function PostSubmission has 74 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func PostSubmission(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    if r.Method != "POST" {
        return http.StatusMethodNotAllowed, nil
    }

Severity: Minor
Found in controllers/submission.go - About 1 hr to fix

Function SpringInt has 72 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func SpringInt(ctx context.Context, sub model.KeyedSubmission, ball io.Reader) (*model.JunitTestResult, error) {
    image := newImage("spring-integration")

    if err := prepareImage(image); err != nil {
        return nil, err
Severity: Minor
Found in runner/springint.go - About 1 hr to fix

Function mockData has 67 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func mockData(ctx context.Context) {
    var err error
    CompanyKey, err = model.Company{
        Address: mail.Address{
            Name:    "Coduno",
Severity: Minor
Found in controllers/controllers_test.go - About 1 hr to fix

Function Invitation has 18 return statements (exceeds 4 allowed).
Open

func Invitation(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    if r.Method != "POST" {
        return http.StatusMethodNotAllowed, nil
    }

Severity: Major
Found in controllers/invitation.go - About 1 hr to fix

Function IODiffRun has 64 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func IODiffRun(ctx context.Context, t model.KeyedTest, sub model.KeyedSubmission, ball io.Reader) (ts model.TestStats, err error) {
    image := newImage(sub.Language)

    if err = prepareImage(image); err != nil {
        return
Severity: Minor
Found in runner/diff.go - About 1 hr to fix

Function CreateResult has 61 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func CreateResult(ctx context.Context, w http.ResponseWriter, r *http.Request) (int, error) {
    if r.Method != "POST" {
        return http.StatusMethodNotAllowed, nil
    }

Severity: Minor
Found in controllers/result.go - About 1 hr to fix

Function PostSubmission has 15 return statements (exceeds 4 allowed).
Open

func PostSubmission(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    if r.Method != "POST" {
        return http.StatusMethodNotAllowed, nil
    }

Severity: Major
Found in controllers/submission.go - About 1 hr to fix

Function createUser has 59 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func createUser(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    var body = struct {
        Address, Nick, Password, Company string
    }{}

Severity: Minor
Found in controllers/user.go - About 1 hr to fix

Function getUsers has 55 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func getUsers(p *passenger.Passenger, ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    var u model.User
    if err = datastore.Get(ctx, p.User, &u); err != nil {
        return http.StatusInternalServerError, nil
    }
Severity: Minor
Found in controllers/user.go - About 1 hr to fix

Function createUser has 12 return statements (exceeds 4 allowed).
Open

func createUser(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    var body = struct {
        Address, Nick, Password, Company string
    }{}

Severity: Major
Found in controllers/user.go - About 1 hr to fix

Function CreateResult has 12 return statements (exceeds 4 allowed).
Open

func CreateResult(ctx context.Context, w http.ResponseWriter, r *http.Request) (int, error) {
    if r.Method != "POST" {
        return http.StatusMethodNotAllowed, nil
    }

Severity: Major
Found in controllers/result.go - About 1 hr to fix

Function testRobot has 54 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func testRobot(m *model.Map, in io.Reader) (tr model.RobotTestResults, err error) {
    tr.Moves = append(tr.Moves, model.RobotLogEntry{Position: m.Start, Event: model.Move})
    direction := model.Right
    r := bufio.NewReader(in)
    var picks []int
Severity: Minor
Found in test/robot.go - About 1 hr to fix

Function TaskByKey has 53 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func TaskByKey(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    p, ok := passenger.FromContext(ctx)
    if !ok {
        return http.StatusUnauthorized, nil
    }
Severity: Minor
Found in controllers/task.go - About 1 hr to fix

Function JUnit has 11 return statements (exceeds 4 allowed).
Open

func JUnit(ctx context.Context, tests, code io.Reader) (*model.JunitTestResult, error) {
    image := newImage("javaut")

    if err := prepareImage(image); err != nil {
        return nil, err
Severity: Major
Found in runner/javaut.go - About 1 hr to fix

Function SpringInt has 10 return statements (exceeds 4 allowed).
Open

func SpringInt(ctx context.Context, sub model.KeyedSubmission, ball io.Reader) (*model.JunitTestResult, error) {
    image := newImage("spring-integration")

    if err := prepareImage(image); err != nil {
        return nil, err
Severity: Major
Found in runner/springint.go - About 1 hr to fix
Severity
Category
Status
Source
Language