dennis-tra/pcp

View on GitHub
pkg/node/node.go

Summary

Maintainability
A
2 hrs
Test Coverage

Method Node.Send has 7 return statements (exceeds 4 allowed).
Open

func (n *Node) Send(s network.Stream, msg p2p.HeaderMessage) error {
    defer func() {
        if err := s.CloseWrite(); err != nil {
            log.Warningln("Error closing writer part of stream after sending", err)
        }
Severity: Major
Found in pkg/node/node.go - About 45 mins to fix

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

    func New(c *cli.Context, wrds []string, opts ...libp2p.Option) (*Node, error) {
        log.Debugln("Initialising local node...")
    
        if c.Bool("homebrew") {
            wrds = words.HomebrewList()
    Severity: Major
    Found in pkg/node/node.go - About 45 mins to fix

      Method Node.authenticateMessage has 7 return statements (exceeds 4 allowed).
      Open

      func (n *Node) authenticateMessage(msg p2p.HeaderMessage) (bool, error) {
          // This will be set to true during unit test runs as the
          // generated peers from mocknet won't have proper keys.
          if skipMessageAuth {
              return true, nil
      Severity: Major
      Found in pkg/node/node.go - About 45 mins to fix

        Method Node.Read has 6 return statements (exceeds 4 allowed).
        Open

        func (n *Node) Read(s network.Stream, buf p2p.HeaderMessage) error {
            defer s.CloseRead()
        
            data, err := ioutil.ReadAll(s)
            if err != nil {
        Severity: Major
        Found in pkg/node/node.go - About 40 mins to fix

          There are no issues that match your filters.

          Category
          Status