mccurdyc/splitfile

View on GitHub

Showing 35 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

            Line length
            Open

            [![CircleCI](https://circleci.com/gh/mccurdyc/splitfile.svg?style=svg)](https://circleci.com/gh/mccurdyc/splitfile) [![codecov](https://codecov.io/gh/mccurdyc/splitfile/branch/master/graph/badge.svg)](https://codecov.io/gh/mccurdyc/splitfile) [![Maintainability](https://api.codeclimate.com/v1/badges/7f656f940224c3fe4365/maintainability)](https://codeclimate.com/github/mccurdyc/splitfile/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/7f656f940224c3fe4365/test_coverage)](https://codeclimate.com/github/mccurdyc/splitfile/test_coverage) [![Go Report Card](https://goreportcard.com/badge/github.com/mccurdyc/splitfile)](https://goreportcard.com/report/github.com/mccurdyc/splitfile)
            Severity: Info
            Found in README.md by markdownlint

            MD013 - Line length

            Tags: line_length

            Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

            This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

            This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

            You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

            Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

            comment on exported method Node.AddEdge should be of the form "AddEdge ..."
            Open

            // AddEdges adds weighted edges to a source node that signify relationships with other nodes.
            Severity: Minor
            Found in internal/graph/node.go by golint

            Lists should be surrounded by blank lines
            Open

            + [GNU General Public License Version 3](./LICENSE)
            Severity: Info
            Found in README.md by markdownlint

            MD032 - Lists should be surrounded by blank lines

            Tags: bullet, ul, ol, blank_lines

            Aliases: blanks-around-lists

            This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:

            Some text
            * Some
            * List
            
            1. Some
            2. List
            Some text

            To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):

            Some text
            
            * Some
            * List
            
            1. Some
            2. List
            
            Some text

            Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.

            Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:

            * This is
            not okay
            
            * This is
              okay

            Inline HTML
            Open

            <p align="center">
            Severity: Info
            Found in README.md by markdownlint

            MD033 - Inline HTML

            Tags: html

            Aliases: no-inline-html

            This rule is triggered whenever raw HTML is used in a markdown document:

            Inline HTML header

            To fix this, use 'pure' markdown instead of including raw HTML:

            # Markdown header

            Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

            exported function Id should have comment or be unexported
            Open

            func Id(ider Ider) string {
            Severity: Minor
            Found in ider.go by golint

            Trailing spaces
            Open

            splitfile identifies partitions of packages via the following method. First, a weighted directed graph is constructed, where nodes are `type`, `var`, `const,` or `func` declarations and weighted directed edges define the relationships between declarations and their uses. 
            Severity: Info
            Found in README.md by markdownlint

            MD009 - Trailing spaces

            Tags: whitespace

            Aliases: no-trailing-spaces

            Parameters: br_spaces (number; default: 0)

            This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

            The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

            Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

            Line length
            Open

            splitfile identifies partitions by assigning _configurable_ weights to edges (i.e., type -> method edges should probably be of a higher weight than type -> usage edges, but this is ultimately up to the user). Next, these weights are used by the distance function. After calculating the distance of all paths, partitions are identified by comparing the distance to a _configurable_ epsilon value. Paths with a distance greater than epsilon will be partitioned, leaving path with a distance less than epsilon "clustered".
            Severity: Info
            Found in README.md by markdownlint

            MD013 - Line length

            Tags: line_length

            Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

            This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

            This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

            You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

            Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

            func Id should be ID
            Open

            func Id(ider Ider) string {
            Severity: Minor
            Found in ider.go by golint

            exported type Poser should have comment or be unexported
            Open

            type Poser interface {
            Severity: Minor
            Found in splitfile.go by golint

            Headers should be surrounded by blank lines
            Open

            ## License
            Severity: Info
            Found in README.md by markdownlint

            MD022 - Headers should be surrounded by blank lines

            Tags: headers, blank_lines

            Aliases: blanks-around-headers

            This rule is triggered when headers (any style) are either not preceded or not followed by a blank line:

            # Header 1
            Some text
            
            Some more text
            ## Header 2

            To fix this, ensure that all headers have a blank line both before and after (except where the header is at the beginning or end of the document):

            # Header 1
            
            Some text
            
            Some more text
            
            ## Header 2

            Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse headers that don't have a blank line before, and will parse them as regular text.

            Inline HTML
            Open

              <img width="500" height="500" src="https://github.com/mccurdyc/splitfile/blob/master/docs/imgs/splitfile.png?raw=true">
            Severity: Info
            Found in README.md by markdownlint

            MD033 - Inline HTML

            Tags: html

            Aliases: no-inline-html

            This rule is triggered whenever raw HTML is used in a markdown document:

            Inline HTML header

            To fix this, use 'pure' markdown instead of including raw HTML:

            # Markdown header

            Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.

            exported method Node.Valid should have comment or be unexported
            Open

            func (n *Node) Valid() (bool, error) {
            Severity: Minor
            Found in internal/graph/node.go by golint
            Severity
            Category
            Status
            Source
            Language