Showing 63 of 199 total issues
Function maketar
has 6 return statements (exceeds 4 allowed). Open
Open
func maketar(pw []*io.PipeWriter, files []*multipart.FileHeader) error {
var w []io.Writer
for i := range pw {
w = append(w, pw[i])
defer pw[i].Close()
- Create a ticketCreate a ticket
Function PostCompany
has 6 return statements (exceeds 4 allowed). Open
Open
func PostCompany(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
if r.Method != "POST" {
return http.StatusMethodNotAllowed, nil
}
- Create a ticketCreate a ticket
Function GetCompanyByUser
has 6 return statements (exceeds 4 allowed). Open
Open
func GetCompanyByUser(ctx context.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if r.Method != "GET" {
return http.StatusMethodNotAllowed, nil
}
- Create a ticketCreate a ticket
Function GetSubmissionsForResult
has 6 return statements (exceeds 4 allowed). Open
Open
func GetSubmissionsForResult(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
if r.Method != "GET" {
return http.StatusMethodNotAllowed, nil
}
- Create a ticketCreate a ticket
Function CheckNick
has 6 return statements (exceeds 4 allowed). Open
Open
func CheckNick(nick string) error {
if nick == "" {
return errors.New("nick is zero")
}
- Create a ticketCreate a ticket
Function Tokens
has 6 return statements (exceeds 4 allowed). Open
Open
func Tokens(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
if r.Method != "POST" {
return http.StatusMethodNotAllowed, nil
}
- Create a ticketCreate a ticket
Method Tasker.Call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func (t Tasker) Call(ctx context.Context, result model.KeyedResult, task model.KeyedTask, user model.User, startTime time.Time) (model.Skills, error) {
- Create a ticketCreate a ticket
Function diffTasker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func diffTasker(ctx context.Context, result model.KeyedResult, task model.KeyedTask, user model.User, startTime time.Time) (skills model.Skills, err error) {
- Create a ticketCreate a ticket
Function processDiffResults
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func processDiffResults(ctx context.Context, sub model.KeyedSubmission, tr model.DiffTestResult, bucket, testFile string, test *datastore.Key) (ts model.TestStats, err error) {
- Create a ticketCreate a ticket
Function deal
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func deal(ctx context.Context, w http.ResponseWriter, r *http.Request, status int, err error) {
- Create a ticketCreate a ticket
Function junitTasker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func junitTasker(ctx context.Context, result model.KeyedResult, task model.KeyedTask, user model.User, startTime time.Time) (skills model.Skills, err error) {
- Create a ticketCreate a ticket
Function upload
has 5 return statements (exceeds 4 allowed). Open
Open
func upload(ctx context.Context, bucket, base string, files []*multipart.FileHeader) multiError {
errc := make(chan error)
var errs []error
for _, fh := range files {
- Create a ticketCreate a ticket
Function GetChallengesForCompany
has 5 return statements (exceeds 4 allowed). Open
Open
func GetChallengesForCompany(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
if r.Method != "GET" {
return http.StatusMethodNotAllowed, nil
}
- Create a ticketCreate a ticket
Function TestsByTaskKey
has 5 return statements (exceeds 4 allowed). Open
Open
func TestsByTaskKey(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
_, ok := passenger.FromContext(ctx)
if !ok {
return http.StatusUnauthorized, nil
}
- Create a ticketCreate a ticket
Function coderJunit
has 5 return statements (exceeds 4 allowed). Open
Open
func coderJunit(_ context.Context, t model.KeyedTest, sub model.KeyedSubmission, ball io.Reader) (err error) {
// TODO: use real context here if possible
ctx := appengine.BackgroundContext()
if _, ok := t.Params["code"]; !ok {
log.Debugf(ctx, "JUnit Coder Runner: missing param")
- Create a ticketCreate a ticket
Function Invitation
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func Invitation(ctx context.Context, w http.ResponseWriter, r *http.Request) (status int, err error) {
if r.Method != "POST" {
return http.StatusMethodNotAllowed, nil
}
- Read upRead up
- Create a ticketCreate a ticket
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 Templates
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
Open
func Templates(ctx context.Context, w http.ResponseWriter, r *http.Request) (int, error) {
if r.Method != "GET" {
return http.StatusMethodNotAllowed, nil
}
- Read upRead up
- Create a ticketCreate a ticket
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 delete
has 5 return statements (exceeds 4 allowed). Open
Open
func delete(w http.ResponseWriter, r *http.Request) {
address, err := mail.ParseAddress(r.FormValue("email"))
if err != nil {
http.Error(w, "Invalid email address: "+err.Error(), 422)
- Create a ticketCreate a ticket
Function testRobot
has 5 return statements (exceeds 4 allowed). Open
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
- Create a ticketCreate a ticket
Function decodeToken
has 5 return statements (exceeds 4 allowed). Open
Open
func decodeToken(ctx context.Context, token string) (*datastore.Key, []byte, error) {
b, err := hex.DecodeString(token)
if err != nil {
return nil, nil, err
}
- Create a ticketCreate a ticket