Showing 78 of 97 total issues
Method SharedMutableCacheRepository.Fetch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func (s *SharedMutableCacheRepository) Fetch(ctx context.Context, key, dest string) (err error) {
err = parallelisation.DetermineContextError(ctx)
if err != nil {
return
}
- 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 processErrorStr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func processErrorStr(s string) iMarshallingError {
if strings.Contains(s, string(MultipleErrorSeparator)) {
elems := strings.Split(s, string(MultipleErrorSeparator))
m := &multiplemarshallingError{}
for i := range elems {
- 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 CleanKillOfCommand
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func CleanKillOfCommand(ctx context.Context, cmd *exec.Cmd) (err error) {
if cmd == nil {
return
}
defer func() {
- 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 DecryptWithKeyPair
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func DecryptWithKeyPair(keys IKeyPair, base64EncodedEncryptedMessage string) (decryptedMessage string, err error) {
if keys == nil {
err = fmt.Errorf("%w: missing keys", commonerrors.ErrUndefined)
return
}
- 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 ExpandFromEnvironment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func ExpandFromEnvironment(s string, recursive bool) string {
if IsWindows() {
expanded := expandFromEnvironment(s)
if recursive {
newExpanded := expandFromEnvironment(expanded)
- 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 logStreamer.Write
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func (l *logStreamer) Write(p []byte) (n int, err error) {
lines := strings.Split(string(p), lineSep)
for i := range lines { // https://stackoverflow.com/questions/62446118/implicit-memory-aliasing-in-for-loop
line := lines[i]
if line != "" {
- 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 executeCommandAs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func executeCommandAs(ctx context.Context, as *command.CommandAsDifferentUser, args ...string) error {
if as == nil {
return fmt.Errorf("%w: missing command wrapper", commonerrors.ErrUndefined)
}
if len(args) == 0 {
- 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 AbstractPaginator.HasNext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func (a *AbstractPaginator) HasNext() bool {
if parallelisation.DetermineContextError(a.ctx) != nil {
return false
}
currentIt, err := a.FetchCurrentPageIterator()
- 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 SharedMutableCacheRepository.Store
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func (s *SharedMutableCacheRepository) Store(ctx context.Context, key, src string) (err error) {
err = parallelisation.DetermineContextError(ctx)
if err != nil {
return
}
- 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 VFS.WalkWithContextAndExclusionPatterns
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func (fs *VFS) WalkWithContextAndExclusionPatterns(ctx context.Context, root string, fn filepath.WalkFunc, exclusionPatterns ...string) (err error) {
err = fs.checkWhetherUnderlyingResourceIsClosed()
if err != nil {
return
}
- 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 VFS.isDirEmpty
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func (fs *VFS) isDirEmpty(name string) (empty bool, err error) {
err = fs.checkWhetherUnderlyingResourceIsClosed()
if err != nil {
return
}
- 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 LoadFromEnvironment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func LoadFromEnvironment(viperSession *viper.Viper, envVarPrefix string, configurationToSet IServiceConfiguration, defaultConfiguration IServiceConfiguration, configFile string) (err error) {
// Load Defaults
var defaults map[string]interface{}
err = mapstructure.Decode(defaultConfiguration, &defaults)
if err != nil {
- 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 NewExclusionRegexList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func NewExclusionRegexList(pathSeparator rune, exclusionPatterns ...string) ([]*regexp.Regexp, error) {
var regexes []*regexp.Regexp
var patternsExtendedList []string
for i := range exclusionPatterns {
pattern := exclusionPatterns[i]
- 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 parseListWithCleanup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func parseListWithCleanup(input string, sep string, keepBlankLines bool) (newS []string) {
if len(input) == 0 {
newS = []string{} // initialisation of empty arrays in function returns []string(nil) instead of []string{}
return
}
- 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 cmdWrapper.Stop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func (c *cmdWrapper) Stop() error {
c.mu.RLock()
defer c.mu.RUnlock()
if c.cmd == nil {
return fmt.Errorf("%w:undefined command", commonerrors.ErrUndefined)
- 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 VFS.RemoveWithPrivileges
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func (fs *VFS) RemoveWithPrivileges(ctx context.Context, dir string) (err error) {
err = fs.RemoveWithContext(ctx, dir)
if commonerrors.Any(err, nil, commonerrors.ErrTimeout, commonerrors.ErrCancelled) {
return
}
- 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 GenericRemove
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func GenericRemove(equal func(string, string) bool, slice []string, val ...string) []string {
if len(val) == 0 {
return slice
}
list := make([]string, 0, len(slice))
- 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 RunActionWithTimeoutAndCancelStore
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func RunActionWithTimeoutAndCancelStore(ctx context.Context, timeout time.Duration, store *CancelFunctionStore, blockingAction func(context.Context) error) error {
err := DetermineContextError(ctx)
if err != nil {
return err
}
- 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"