mccurdyc/splitfile

View on GitHub

Showing 8 of 35 total issues

Function TestFromStringLiterals has 157 lines of code (exceeds 25 allowed). Consider refactoring.
Open

func TestFromStringLiterals(t *testing.T) {
    for _, test := range [...]struct {
        name    string
        pkgpath string
        files   map[string]string
Severity: Major
Found in splitfile_analysis_test.go - About 6 hrs to fix

    Function TestAddNode has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    func TestAddNode(t *testing.T) {
        tests := []struct {
            name    string
            graph   Graph
            node    *Node
    Severity: Minor
    Found in internal/graph/graph_test.go - About 2 hrs to fix

      Function TestAddEdge has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      func TestAddEdge(t *testing.T) {
          tests := []struct {
              name   string
              node   *Node
              dest   *Node
      Severity: Minor
      Found in internal/graph/node_test.go - About 1 hr to fix

        Function TestContainsNode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        func TestContainsNode(t *testing.T) {
            tests := []struct {
                name  string
                graph Graph
                id    string
        Severity: Minor
        Found in internal/graph/graph_test.go - About 1 hr to fix

          Function TestId has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          func TestId(t *testing.T) {
              var tests = []struct {
                  name   string
                  want   string
                  pkgFn  func() *types.Package
          Severity: Minor
          Found in ider_test.go - About 1 hr to fix

            Function TestAddNode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            func TestAddNode(t *testing.T) {
                tests := []struct {
                    name    string
                    graph   Graph
                    node    *Node
            Severity: Minor
            Found in internal/graph/graph_test.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

            Function traverse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            func traverse(defs map[*ast.Ident]types.Object) graph.Graph {
                g := graph.New()
            
                for _, def := range defs {
            
            
            Severity: Minor
            Found in splitfile.go - About 35 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

            Function addRelated has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            func addRelated(g graph.Graph, node *graph.Node) error {
                t, ok := node.Object.(Typer)
                if !ok {
                    return errors.New("node does not have a Type() method")
                }
            Severity: Minor
            Found in splitfile.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

            Severity
            Category
            Status
            Source
            Language