Showing 63 of 199 total issues

Function getInsertedDeleted has 5 return statements (exceeds 4 allowed).
Open

func getInsertedDeleted(submissions []model.KeyedSubmission) (insDel *InsDel, err error) {
    var oldCode io.Reader
    oldCode, err = readFromGCS(submissions[0].Code)
    if err != nil {
        return
Severity: Major
Found in logic/util.go - About 35 mins to fix

Function testRobot has a Cognitive Complexity of 22 (exceeds 20 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 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

Function GetProfileForUser has 5 return statements (exceeds 4 allowed).
Open

func GetProfileForUser(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
    _, ok := passenger.FromContext(ctx)
    if !ok {
        return http.StatusUnauthorized, nil
    }
Severity: Major
Found in controllers/profile.go - About 35 mins to fix
Severity
Category
Status
Source
Language