pkg/vproj/import-so.go
Method importSharedObjectsOperation.loadLDPathsFromLinkerConfig
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
Open
func (isoOp *importSharedObjectsOperation) loadLDPathsFromLinkerConfig(path string) error {
if strings.Contains(path, "*") {
return nil
}
data, err := ioutil.ReadFile(path)
- 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 importSharedObjectsOperation.copyLib
has 8 return statements (exceeds 4 allowed). Open
Open
func (isoOp *importSharedObjectsOperation) copyLib(libPath, destPath string) (bool, error) {
destPath = isoOp.adjustPath(destPath)
isoOp.logger.Infof("copying '%s' > '%s", libPath, destPath)
// evaluate libPath so see if its a symlink
Method importSharedObjectsOperation.loadLDPathsFromLinkerConfig
has 7 return statements (exceeds 4 allowed). Open
Open
func (isoOp *importSharedObjectsOperation) loadLDPathsFromLinkerConfig(path string) error {
if strings.Contains(path, "*") {
return nil
}
data, err := ioutil.ReadFile(path)
Method importSharedObjectsOperation.copyLib
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
func (isoOp *importSharedObjectsOperation) copyLib(libPath, destPath string) (bool, error) {
destPath = isoOp.adjustPath(destPath)
isoOp.logger.Infof("copying '%s' > '%s", libPath, destPath)
// evaluate libPath so see if its a symlink
- 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
Your code does not pass gofmt in 8 places. Go fmt your code! Open
Open
package vproj
- Exclude checks
exported func NewImportSharedObject returns unexported type *vproj.importSharedObjectsOperation, which can be annoying to use Open
Open
func NewImportSharedObject(projectPath string, excludeDefaultLibs bool, logger elog.View) (*importSharedObjectsOperation, error) {
- Exclude checks
if block ends with a return statement, so drop this else and outdent its block Open
Open
} else {
- Exclude checks