concourse / concourse

Redundant else-blocks can be eliminated RVV-A0009
Anti-pattern
Major
5 months ago2 years old
if block ends with a continue statement, so drop this else and outdent its block
 90				})
 91
 92				continue
 93			} else { 94				logger.Debug("rebalancing")
 95			}
 96
if block ends with a continue statement, so drop this else and outdent its block
 99			if !found {
100				if taskInput.Optional {
101					continue
102				} else {103					return nil, nil, nil, nil, fmt.Errorf("missing required input `%s`", taskInput.Name)
104				}
105			}
if block ends with call to os.Exit function, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
36		if flagsErr, ok := err.(*flags.Error); ok && flagsErr.Type == flags.ErrHelp {
37			fmt.Println(err)
38			os.Exit(0)
39		} else {40			fmt.Fprintf(os.Stderr, "error: %s\n", err)
41		}
42
if block ends with a continue statement, so drop this else and outdent its block
 84				// stop scheduling other builds because of a rerun build cannot
 85				// determine inputs
 86				continue
 87			} else { 88				// If it is a regular scheduler build, stop scheduling because it is
 89				// failing to determine inputs
 90				break
if block ends with a break statement, so drop this else and outdent its block
173		if worked {
174			// resolving recursively worked!
175			break
176		} else {177			span.SetStatus(codes.Error, "")
178			return false, db.NoSatisfiableBuilds, nil
179		}