cloudfoundry-community/bosh-cloudstack-cpi

View on GitHub
go_agent/src/code.google.com/p/go.tools/go/types/lookup.go

Summary

Maintainability
D
1 day
Test Coverage

Function lookupFieldOrMethod has a Cognitive Complexity of 74 (exceeds 20 allowed). Consider refactoring.
Open

func lookupFieldOrMethod(T Type, pkg *Package, name string) (obj Object, index []int, indirect bool) {
    // WARNING: The code in this function is extremely subtle - do not modify casually!
    //          This function and NewMethodSet should be kept in sync.

    if name == "_" {
Severity: Minor
Found in go_agent/src/code.google.com/p/go.tools/go/types/lookup.go - About 1 day 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

Function lookupFieldOrMethod has 82 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func lookupFieldOrMethod(T Type, pkg *Package, name string) (obj Object, index []int, indirect bool) {
    // WARNING: The code in this function is extremely subtle - do not modify casually!
    //          This function and NewMethodSet should be kept in sync.

    if name == "_" {
Severity: Major
Found in go_agent/src/code.google.com/p/go.tools/go/types/lookup.go - About 2 hrs to fix

    Function MissingMethod has 8 return statements (exceeds 4 allowed).
    Open

    func MissingMethod(V Type, T *Interface, static bool) (method *Func, wrongType bool) {
        // fast path for common case
        if T.NumMethods() == 0 {
            return
        }
    Severity: Major
    Found in go_agent/src/code.google.com/p/go.tools/go/types/lookup.go - About 50 mins to fix

      Function lookupFieldOrMethod has 7 return statements (exceeds 4 allowed).
      Open

      func lookupFieldOrMethod(T Type, pkg *Package, name string) (obj Object, index []int, indirect bool) {
          // WARNING: The code in this function is extremely subtle - do not modify casually!
          //          This function and NewMethodSet should be kept in sync.
      
          if name == "_" {
      Severity: Major
      Found in go_agent/src/code.google.com/p/go.tools/go/types/lookup.go - About 45 mins to fix

        Function MissingMethod has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
        Open

        func MissingMethod(V Type, T *Interface, static bool) (method *Func, wrongType bool) {
            // fast path for common case
            if T.NumMethods() == 0 {
                return
            }
        Severity: Minor
        Found in go_agent/src/code.google.com/p/go.tools/go/types/lookup.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

        There are no issues that match your filters.

        Category
        Status