go-pluto/pluto

View on GitHub

Showing 94 of 184 total issues

Method Receiver.ApplyStoredMsgs has a Cognitive Complexity of 217 (exceeds 20 allowed). Consider refactoring.
Open

func (recv *Receiver) ApplyStoredMsgs() {

    for {

        select {
Severity: Minor
Found in comm/receiver.go - About 4 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 Mailbox.Store has a Cognitive Complexity of 103 (exceeds 20 allowed). Consider refactoring.
Open

func (mailbox *Mailbox) Store(s *Session, req *Request, syncChan chan comm.Msg) (*Reply, error) {

    if s.State != StateMailbox {

        // If connection was not in correct state when this
Severity: Minor
Found in imap/source.go - About 1 day 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 service.handleConnection has a Cognitive Complexity of 103 (exceeds 20 allowed). Consider refactoring.
Open

func (s *service) handleConnection(conn net.Conn, greeting string) {

    // Assert we are talking via a TLS connection.
    tlsConn, ok := conn.(*tls.Conn)
    if ok != true {
Severity: Minor
Found in distributor/service.go - About 1 day 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

File service.go has 875 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package distributor

import (
    "bufio"
    "fmt"
Severity: Major
Found in distributor/service.go - About 1 day to fix

    Method Sender.SendMsgs has a Cognitive Complexity of 84 (exceeds 20 allowed). Consider refactoring.
    Open

    func (sender *Sender) SendMsgs(waitSeconds time.Duration) {
    
        // Specify duration to wait between triggers.
        triggerD := waitSeconds * time.Second
    
    
    Severity: Minor
    Found in comm/sender.go - About 1 day 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 main has 267 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func main() {
    
        var err error
    
        // Set CPUs usable by pluto to all available.
    Severity: Major
    Found in main.go - About 1 day to fix

      Method service.handleConnection has 246 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (s *service) handleConnection(conn net.Conn, greeting string) {
      
          // Assert we are talking via a TLS connection.
          tlsConn, ok := conn.(*tls.Conn)
          if ok != true {
      Severity: Major
      Found in distributor/service.go - About 1 day to fix

        Function main has a Cognitive Complexity of 71 (exceeds 20 allowed). Consider refactoring.
        Open

        func main() {
        
            var err error
        
            // Set CPUs usable by pluto to all available.
        Severity: Minor
        Found in main.go - About 1 day 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 Receiver.ApplyStoredMsgs has 225 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (recv *Receiver) ApplyStoredMsgs() {
        
            for {
        
                select {
        Severity: Major
        Found in comm/receiver.go - About 1 day to fix

          Method Mailbox.Store has 196 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (mailbox *Mailbox) Store(s *Session, req *Request, syncChan chan comm.Msg) (*Reply, error) {
          
              if s.State != StateMailbox {
          
                  // If connection was not in correct state when this
          Severity: Major
          Found in imap/source.go - About 6 hrs to fix

            File source.go has 675 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            package imap
            
            import (
                "fmt"
                "os"
            Severity: Minor
            Found in imap/source.go - About 6 hrs to fix

              Method Mailbox.ApplyStore has 151 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (mailbox *Mailbox) ApplyStore(storeUpd *comm.Msg_STORE) {
              
                  createdMailbox := false
              
                  rmElements := map[string]string{
              Severity: Major
              Found in imap/downstream.go - About 5 hrs to fix

                Method Mailbox.ApplyStore has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
                Open

                func (mailbox *Mailbox) ApplyStore(storeUpd *comm.Msg_STORE) {
                
                    createdMailbox := false
                
                    rmElements := map[string]string{
                Severity: Minor
                Found in imap/downstream.go - About 4 hrs 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 Sender.SendMsgs has 142 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (sender *Sender) SendMsgs(waitSeconds time.Duration) {
                
                    // Specify duration to wait between triggers.
                    triggerD := waitSeconds * time.Second
                
                
                Severity: Major
                Found in comm/sender.go - About 4 hrs to fix

                  Function main has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func main() {
                  
                      // Parse supplied command-line flags.
                      plutoConfigFlag := flag.String("pluto-config", "config.toml", "If you use a custom config path specify it via this flag")
                      rootCertPathFlag := flag.String("root-cert-path", "", "If you want to use an existing root certificate, specify the path")
                  Severity: Minor
                  Found in crypto/generate_pki.go - About 4 hrs 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 service.ProxyAppend has 125 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (s *service) ProxyAppend(c *Connection, rawReq string) bool {
                  
                      // Prepare payload to send.
                      payload := &imap.Command{
                          Text:     rawReq,
                  Severity: Major
                  Found in distributor/service.go - About 4 hrs to fix

                    Function TestApplyStoredMsgs has 125 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func TestApplyStoredMsgs(t *testing.T) {
                    
                        // Create logger.
                        logger := log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout))
                        logger = log.With(logger,
                    Severity: Major
                    Found in comm/receiver_test.go - About 4 hrs to fix

                      Method Mailbox.ApplyAppend has 123 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (mailbox *Mailbox) ApplyAppend(appendUpd *comm.Msg_APPEND) {
                      
                          // For APPEND, STORE, and EXPUNGE we interpret the
                          // the folder name as value and the mail file name
                          // as tag in downstream message.
                      Severity: Major
                      Found in imap/downstream.go - About 3 hrs to fix

                        Function ParseSeqNumbers has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func ParseSeqNumbers(recv string, lenMailboxContents int) ([]int, error) {
                        
                            // If supplied number of mail messages in selected
                            // folder indicated an empty mailbox, immediately return.
                            if lenMailboxContents == 0 {
                        Severity: Minor
                        Found in imap/request.go - About 3 hrs 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 main has 121 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func main() {
                        
                            // Parse supplied command-line flags.
                            plutoConfigFlag := flag.String("pluto-config", "config.toml", "If you use a custom config path specify it via this flag")
                            rootCertPathFlag := flag.String("root-cert-path", "", "If you want to use an existing root certificate, specify the path")
                        Severity: Major
                        Found in crypto/generate_pki.go - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language