Showing 247 of 615 total issues
Method Printer.drawSubgraph
has 5 return statements (exceeds 4 allowed). Open
Open
func (p Printer) drawSubgraph(g *graph.Graph, id SubgraphID, subgraph Subgraph) (Renderable, error) {
subgraphPrinter, spOK := p.pp.(SubgraphPrinter)
nodePrinter, npOK := p.pp.(NodePrinter)
if !spOK && !npOK {
Method Keystore.StoreTrustedKey
has 5 return statements (exceeds 4 allowed). Open
Open
func (ks *Keystore) StoreTrustedKey(pubkeyBytes []byte) (string, error) {
if err := os.MkdirAll(ks.UserPath, 0755); err != nil {
return "", err
}
Method Printer.drawEdges
has 5 return statements (exceeds 4 allowed). Open
Open
func (p Printer) drawEdges(g *graph.Graph) (Renderable, error) {
edgePrinter, epOK := p.pp.(EdgePrinter)
edgeSectionPrinter, espOK := p.pp.(EdgeSectionPrinter)
if !epOK && !espOK {
Method Keystore.CheckSignature
has 5 return statements (exceeds 4 allowed). Open
Open
func (ks *Keystore) CheckSignature(signed, signature io.Reader) error {
if ks.keyring == nil {
keyring, err := loadKeyring(ks)
if err != nil {
return errors.Wrap(err, "error loading keyring")
Method pipelineGen.DependencyCheck
has 5 return statements (exceeds 4 allowed). Open
Open
func (g *pipelineGen) DependencyCheck(ctx context.Context, taskI interface{}) (interface{}, error) {
result, ok := taskI.(resultWrapper)
if !ok {
return nil, errors.New("input node is not a task wrapper")
}
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"