Showing 239 of 615 total issues
Function newSocketTypePropertiesFromMap
has a Cognitive Complexity of 167 (exceeds 20 allowed). Consider refactoring. Open
func newSocketTypePropertiesFromMap(m map[string]interface{}) *SocketTypeProperties {
s := &SocketTypeProperties{}
if val, ok := m["Accept"]; ok {
s.Accept = val.(bool)
- 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 newServiceTypePropertiesFromMap
has a Cognitive Complexity of 156 (exceeds 20 allowed). Consider refactoring. Open
func newServiceTypePropertiesFromMap(m map[string]interface{}) *ServiceTypeProperties {
s := &ServiceTypeProperties{}
if val, ok := m["AmbientCapabilities"]; ok {
s.AmbientCapabilities = val.(uint64)
- 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 newMountTypePropertiesFromMap
has a Cognitive Complexity of 129 (exceeds 20 allowed). Consider refactoring. Open
func newMountTypePropertiesFromMap(m map[string]interface{}) *MountTypeProperties {
s := &MountTypeProperties{}
if val, ok := m["AmbientCapabilities"]; ok {
s.AmbientCapabilities = val.(uint64)
- 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 newSwapTypePropertiesFromMap
has a Cognitive Complexity of 125 (exceeds 20 allowed). Consider refactoring. Open
func newSwapTypePropertiesFromMap(m map[string]interface{}) *SwapTypeProperties {
s := &SwapTypeProperties{}
if val, ok := m["AmbientCapabilities"]; ok {
s.AmbientCapabilities = val.(uint64)
- 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 TestCheck
has a Cognitive Complexity of 124 (exceeds 20 allowed). Consider refactoring. Open
func TestCheck(t *testing.T) {
t.Parallel()
t.Run("state=present", func(t *testing.T) {
g := group.NewGroup(new(group.System))
- 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 newPropertiesFromMap
has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring. Open
func newPropertiesFromMap(m map[string]interface{}) *Properties {
s := &Properties{}
if val, ok := m["ActiveEnterTimestamp"]; ok {
s.ActiveEnterTimestamp = val.(uint64)
- 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
Method Group.Apply
has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring. Open
func (g *Group) Apply(context.Context) (resource.TaskStatus, error) {
var (
groupByGid *user.Group
gidErr error
newNameErr error
- 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
File resource_test.go
has 688 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2016 Asteris, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Function dependencyWalk
has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring. Open
func dependencyWalk(rctx context.Context, g *Graph, cb WalkFunc) error {
// the basic idea of this implementation is that we want to defer schedule
// children of any given node until after that node's non-child dependencies
// are satisfied. We're going to have a couple major components of this.
// First, a scheduler/latch to make sure we don't schedule work more than
- 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
File container_test.go
has 617 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2016 Asteris, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Function ExportedFields
has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring. Open
func ExportedFields(input interface{}) (exported []*ExportedField, err error) {
nonEmbeddedFields := make(map[string]struct{})
embeddedFields := make(map[string][]*ExportedField)
if nil == input {
return exported, ErrNilStruct
- 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
Method Group.Check
has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring. Open
func (g *Group) Check(context.Context, resource.Renderer) (resource.TaskStatus, error) {
var (
groupByGid *user.Group
gidErr error
groupByNewName *user.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
Graph
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
type Graph struct {
inner *dag.AcyclicGraph
values cmap.ConcurrentMap
innerLock *sync.RWMutex
File fetch_test.go
has 579 lines of code (exceeds 500 allowed). Consider refactoring. Open
// Copyright © 2016 Asteris, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Method User.DiffMod
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func (u *User) DiffMod(status *resource.Status, currUser *user.User) (*ModUserOptions, error) {
options := new(ModUserOptions)
// Check for differences between currUser and the desired modifications
if u.NewUsername != "" {
- 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 TestCheck
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func TestCheck(t *testing.T) {
t.Parallel()
t.Run("state=present", func(t *testing.T) {
u := user.NewUser(new(user.System))
- 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 TestShouldEvaluate
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func TestShouldEvaluate(t *testing.T) {
t.Run("when-many-branches", func(t *testing.T) {
g := peerBranchSampleGraph(t)
resources := []string{"resource1", "resource2", "resource3"}
t.Run("when-true-true-true", func(t *testing.T) {
- 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
File conditional_test.go
has 537 lines of code (exceeds 500 allowed). Consider refactoring. Open
package conditional_test
import (
"errors"
"fmt"
Method User.Apply
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func (u *User) Apply(context.Context) (resource.TaskStatus, error) {
// lookup the user by name
// ErrUnsupported is returned if the system is not supported
// Lookup returns user.UnknownUserError if the user is not found
userByName, nameErr := u.system.Lookup(u.Username)
- 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
Method resourceVG.Check
has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring. Open
func (r *resourceVG) Check(context.Context, resource.Renderer) (resource.TaskStatus, error) {
status := &resource.Status{}
if err := r.lvm.Check(); err != nil {
return nil, errors.Wrap(err, "lvm.volumegroup")
- 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"