cloudfoundry-community/bosh-cloudstack-cpi

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

Summary

Maintainability
F
6 days
Test Coverage

Method checker.builtin has a Cognitive Complexity of 193 (exceeds 20 allowed). Consider refactoring.
Open

func (check *checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ bool) {
    // append is the only built-in that permits the use of ... for the last argument
    bin := predeclaredFuncs[id]
    if call.Ellipsis.IsValid() && id != _Append {
        check.invalidOp(call.Ellipsis, "invalid use of ... with built-in %s", bin.name)
Severity: Minor
Found in go_agent/src/code.google.com/p/go.tools/go/types/builtins.go - About 3 days 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 checker.builtin has 417 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (check *checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ bool) {
    // append is the only built-in that permits the use of ... for the last argument
    bin := predeclaredFuncs[id]
    if call.Ellipsis.IsValid() && id != _Append {
        check.invalidOp(call.Ellipsis, "invalid use of ... with built-in %s", bin.name)
Severity: Major
Found in go_agent/src/code.google.com/p/go.tools/go/types/builtins.go - About 1 day to fix

    Method checker.builtin has 39 return statements (exceeds 4 allowed).
    Open

    func (check *checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ bool) {
        // append is the only built-in that permits the use of ... for the last argument
        bin := predeclaredFuncs[id]
        if call.Ellipsis.IsValid() && id != _Append {
            check.invalidOp(call.Ellipsis, "invalid use of ... with built-in %s", bin.name)
    Severity: Major
    Found in go_agent/src/code.google.com/p/go.tools/go/types/builtins.go - About 3 hrs to fix

      There are no issues that match your filters.

      Category
      Status