daemon/container_operations_windows.go
Method Daemon.setupSecretDir
has 8 return statements (exceeds 4 allowed). Open
Open
func (daemon *Daemon) setupSecretDir(ctr *container.Container) (setupErr error) {
if len(ctr.SecretReferences) == 0 {
return nil
}
Method Daemon.initializeNetworkingPaths
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
Open
func (daemon *Daemon) initializeNetworkingPaths(ctr *container.Container, nc *container.Container) error {
if nc.HostConfig.Isolation.IsHyperV() {
return fmt.Errorf("sharing of hyperv containers network is not supported")
}
- 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 Daemon.setupConfigDir
has 7 return statements (exceeds 4 allowed). Open
Open
func (daemon *Daemon) setupConfigDir(ctr *container.Container) (setupErr error) {
if len(ctr.ConfigReferences) == 0 {
return nil
}