Showing 78 of 97 total issues
Method SharedImmutableCacheRepository.CleanEntry
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
func (s *SharedImmutableCacheRepository) CleanEntry(ctx context.Context, key 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.walk
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (fs *VFS) walk(ctx context.Context, path string, info os.FileInfo, exclusions []*regexp.Regexp, fn filepath.WalkFunc) (err error) {
err = fs.checkWhetherUnderlyingResourceIsClosed()
if err != nil {
return
}
Function ValidateEmbedded
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func ValidateEmbedded(cfg Validator) error {
r := reflect.ValueOf(cfg).Elem()
for i := 0; i < r.NumField(); i++ {
f := r.Field(i)
if f.Kind() == reflect.Struct {
- 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.MoveWithContext
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func (fs *VFS) MoveWithContext(ctx context.Context, src string, dest 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
Function newZipReader
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func newZipReader(fs FS, source string, limits ILimits, currentDepth int64) (zipReader *zip.Reader, file File, err error) {
if fs == nil {
err = fmt.Errorf("%w: missing file system", 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 getHash
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
func getHash(ctx context.Context, fs filesystem.FS, src string, forceHashUpdate bool) (hash 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 copyFileBetweenFSWithExclusionPatternsWithExclusionRegexes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func copyFileBetweenFSWithExclusionPatternsWithExclusionRegexes(ctx context.Context, srcFs FS, src string, destFs FS, dest string, exclusionSrcFsRegexes []*regexp.Regexp, exclusionDestFsRegexes []*regexp.Regexp) (err error) {
if IsPathExcluded(src, exclusionSrcFsRegexes...) || IsPathExcluded(dest, exclusionDestFsRegexes...) {
return
}
err = parallelisation.DetermineContextError(ctx)
- 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 Parallelise
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func Parallelise(argList interface{}, action func(arg interface{}) (interface{}, error), resultType reflect.Type) (results interface{}, err error) {
keepReturn := resultType != nil
argListValue := reflect.ValueOf(argList)
length := argListValue.Len()
channel := make(chan result, length)
- 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
Avoid deeply nested control flow statements. Open
if len(sLinks) > 1 {
sLinks = sLinks[1:]
} else {
sLinks = nil
}
Avoid deeply nested control flow statements. Open
if afterTime.After(time.Now()) {
wait = time.Until(afterTime)
} else {
wait = time.Duration(0)
}
Method RemoteLockFile.TryLock
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func (l *RemoteLockFile) TryLock(ctx context.Context) (err error) {
if err := parallelisation.DetermineContextError(ctx); 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"
Further reading
Function killProcessAndChildren
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func killProcessAndChildren(ctx context.Context, p *process.Process) (err error) {
// See https://varunksaini.com/posts/kiling-processes-in-go/
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 SafeSchedule
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func SafeSchedule(ctx context.Context, period time.Duration, offset time.Duration, f func(context.Context, time.Time)) {
err := 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 SharedImmutableCacheRepository.Store
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func (s *SharedImmutableCacheRepository) 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
Avoid deeply nested control flow statements. Open
if sleep < 0 {
sleep = 0
}
Function processError
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func processError(err error) (mErr iMarshallingError) {
if err == nil {
return
}
mErr = processErrorStr(err.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
Method VFS.IsZipWithContext
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func (fs *VFS) IsZipWithContext(ctx context.Context, path string) (ok bool, err error) {
if path == "" {
err = fmt.Errorf("%w: missing path", 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 processErrorStrLine
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func processErrorStrLine(err string) (mErr *marshallingError) {
err = strings.TrimSpace(err)
if err == "" {
return 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 flattenDefaultsMap
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func flattenDefaultsMap(m map[string]interface{}) map[string]interface{} {
output := make(map[string]interface{})
for key, value := range m {
switch child := value.(type) {
case map[string]interface{}:
- 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 RemoteLockFile.MakeStale
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func (l *RemoteLockFile) MakeStale(ctx context.Context) error {
l.cancelStore.Cancel()
parallelisation.SleepWithContext(ctx, l.lockHeartBeatPeriod+time.Millisecond)
lockPath := l.lockPath()
filePath := l.heartBeatFile(lockPath)
- 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"