JeffDeCola/my-go-examples

View on GitHub

Showing 13 of 13 total issues

Function file_pbmessage_proto_init has 71 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func file_pbmessage_proto_init() {
    if File_pbmessage_proto != nil {
        return
    }
    if !protoimpl.UnsafeEnabled {

    Function main has 55 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func main() {
    
        // GENISIS BLOCKCHAIN
        // LOAD BLOCK 0 WITH 0000 TRANSACTION
        s := "GENISIS BLOCKCHAIN / LOAD BLOCK 0 WITH 0000 TRANSACTION"
    Severity: Minor
    Found in architectures/blockchain/bitcoin-ledger/control.go - About 1 hr to fix

      Method txRequestMessageSignedStruct.addTransactionToPendingBlock has 51 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (trms txRequestMessageSignedStruct) addTransactionToPendingBlock(unspentOutputSlice []unspentOutputStruct, change int64) {
      
          // Check if first transaction in pendingBlock
          first := false
          if pendingBlock.Transactions[0].Inputs == nil {
      Severity: Minor
      Found in architectures/blockchain/bitcoin-ledger/bitcoin-ledger.go - About 1 hr to fix

        Function getBalance has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
        Open

        func getBalance(address string) (int64, []unspentOutputStruct) {
        
            unspentOutputMap := make(map[int64]int64)
        
            var unspentOutput unspentOutputStruct
        Severity: Minor
        Found in architectures/blockchain/bitcoin-ledger/bitcoin-ledger.go - About 55 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

        Lists should be surrounded by blank lines
        Open

        * I also wrote an entire cryptocurrency called

        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

        exported function StartRPCServer should have comment or be unexported
        Open

        func StartRPCServer() {

        Trailing spaces
        Open

          
        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.

        Trailing spaces
        Open

        * **BlockID 2**  

        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.

        Lists should be surrounded by blank lines
        Open

        * My cheat sheet on

        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

        Trailing spaces
        Open

        * **BlockID 3**  

        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.

        2: cannot find package "github.com/sirupsen/logrus" in any of:
        Open

            log "github.com/sirupsen/logrus"

        Lists should be surrounded by blank lines
        Open

        * A

        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

        exported function PrintHi should have comment or be unexported
        Open

        func PrintHi() {
        Severity
        Category
        Status
        Source
        Language