Showing 247 of 615 total issues
Function getParams
has 5 return statements (exceeds 4 allowed). Open
Open
func getParams(g *graph.Graph, id string, node *parse.Node) (out []string, err error) {
var nodeStrings []string
nodeStrings, err = node.GetStrings()
if err != nil {
return nil, err
Function ParseSize
has 5 return statements (exceeds 4 allowed). Open
Open
func ParseSize(sizeToParse string) (*LvmSize, error) {
var err error
size := &LvmSize{}
if m := pctRE.FindStringSubmatch(sizeToParse); m != nil {
size.Relative = true
Function getParentSubgraph
has 5 return statements (exceeds 4 allowed). Open
Open
func getParentSubgraph(subgraphs SubgraphMap, thisSubgraph SubgraphID, id string) SubgraphID {
parent := graph.ParentID(id)
if thisSubgraph == SubgraphBottomID {
return SubgraphBottomID
}
Function RenderPredicate
has 5 return statements (exceeds 4 allowed). Open
Open
func RenderPredicate(meta *node.Node, renderFunc func(string, string) (string, error)) (string, error) {
rendered, ok := meta.LookupMetadata(MetaRenderedPredicate)
if ok {
return rendered.(string), nil
}
Function execPipeline
has 5 return statements (exceeds 4 allowed). Open
Open
func execPipeline(ctx context.Context, in *graph.Graph, pipelineF MkPipelineF, renderingPlant *render.Factory, notify *graph.Notifier) (*graph.Graph, error) {
var hasErrors error
out, err := in.Transform(ctx,
notify.Transform(func(meta *node.Node, out *graph.Graph) error {
Method User.DiffAdd
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
func (u *User) DiffAdd(status *resource.Status) (*AddUserOptions, error) {
options := new(AddUserOptions)
// if a group exists with the same name as the user being added, a groupname
// must also be indicated so the user may be added to that group
- Read upRead up
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 ResolveDependencies
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
func ResolveDependencies(ctx context.Context, g *graph.Graph) (*graph.Graph, error) {
logger := logging.GetLogger(ctx).WithField("function", "ResolveDependencies")
logger.Debug("resolving dependencies")
groupLock := new(sync.Mutex)
- Read upRead up
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"