vorteil/vorteil

View on GitHub
pkg/vproj/import-so.go

Summary

Maintainability
A
3 hrs
Test Coverage
C
76%

Method importSharedObjectsOperation.loadLDPathsFromLinkerConfig has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
Open

func (isoOp *importSharedObjectsOperation) loadLDPathsFromLinkerConfig(path string) error {
    if strings.Contains(path, "*") {
        return nil
    }
    data, err := ioutil.ReadFile(path)
Severity: Minor
Found in pkg/vproj/import-so.go - About 1 hr to fix

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

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
Severity: Major
Found in pkg/vproj/import-so.go - About 50 mins to fix

    Method importSharedObjectsOperation.loadLDPathsFromLinkerConfig has 7 return statements (exceeds 4 allowed).
    Open

    func (isoOp *importSharedObjectsOperation) loadLDPathsFromLinkerConfig(path string) error {
        if strings.Contains(path, "*") {
            return nil
        }
        data, err := ioutil.ReadFile(path)
    Severity: Major
    Found in pkg/vproj/import-so.go - About 45 mins to fix

      Method importSharedObjectsOperation.copyLib has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
      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
      Severity: Minor
      Found in pkg/vproj/import-so.go - About 25 mins to fix

      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

      package vproj
      Severity: Minor
      Found in pkg/vproj/import-so.go by gofmt

      exported func NewImportSharedObject returns unexported type *vproj.importSharedObjectsOperation, which can be annoying to use
      Open

      func NewImportSharedObject(projectPath string, excludeDefaultLibs bool, logger elog.View) (*importSharedObjectsOperation, error) {
      Severity: Minor
      Found in pkg/vproj/import-so.go by golint

      if block ends with a return statement, so drop this else and outdent its block
      Open

              } else {
      Severity: Minor
      Found in pkg/vproj/import-so.go by golint

      There are no issues that match your filters.

      Category
      Status