go-pluto/pluto

View on GitHub

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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      func (s *service) constructState(logger log.Logger, sep string) error {
      
          // Find all files below this node's CRDT root layer.
          folders, err := filepath.Glob(filepath.Join(s.config.CRDTLayerRoot, "*"))
          if err != nil {
      Severity: Major
      Found in worker/service.go and 1 other location - About 1 day to fix
      storage/service.go on lines 150..232

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 611.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      func (s *service) constructState(logger log.Logger, sep string) error {
      
          // Find all files below this node's CRDT root layer.
          folders, err := filepath.Glob(filepath.Join(s.config.CRDTLayerRoot, "*"))
          if err != nil {
      Severity: Major
      Found in storage/service.go and 1 other location - About 1 day to fix
      worker/service.go on lines 146..228

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 611.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

          func (s *service) ProxyDelete(c *Connection, rawReq string) bool {
          
              // Prepare payload to send.
              payload := &imap.Command{
                  Text:     rawReq,
          Severity: Major
          Found in distributor/service.go and 5 other locations - About 6 hrs to fix
          distributor/service.go on lines 756..809
          distributor/service.go on lines 814..867
          distributor/service.go on lines 930..983
          distributor/service.go on lines 1168..1221
          distributor/service.go on lines 1226..1279

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 485.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

          func (s *service) ProxyExpunge(c *Connection, rawReq string) bool {
          
              // Prepare payload to send.
              payload := &imap.Command{
                  Text:     rawReq,
          Severity: Major
          Found in distributor/service.go and 5 other locations - About 6 hrs to fix
          distributor/service.go on lines 756..809
          distributor/service.go on lines 814..867
          distributor/service.go on lines 872..925
          distributor/service.go on lines 930..983
          distributor/service.go on lines 1226..1279

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 485.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

          func (s *service) ProxySelect(c *Connection, rawReq string) bool {
          
              // Prepare payload to send.
              payload := &imap.Command{
                  Text:     rawReq,
          Severity: Major
          Found in distributor/service.go and 5 other locations - About 6 hrs to fix
          distributor/service.go on lines 814..867
          distributor/service.go on lines 872..925
          distributor/service.go on lines 930..983
          distributor/service.go on lines 1168..1221
          distributor/service.go on lines 1226..1279

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 485.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

          func (s *service) ProxyStore(c *Connection, rawReq string) bool {
          
              // Prepare payload to send.
              payload := &imap.Command{
                  Text:     rawReq,
          Severity: Major
          Found in distributor/service.go and 5 other locations - About 6 hrs to fix
          distributor/service.go on lines 756..809
          distributor/service.go on lines 814..867
          distributor/service.go on lines 872..925
          distributor/service.go on lines 930..983
          distributor/service.go on lines 1168..1221

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 485.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

          func (s *service) ProxyList(c *Connection, rawReq string) bool {
          
              // Prepare payload to send.
              payload := &imap.Command{
                  Text:     rawReq,
          Severity: Major
          Found in distributor/service.go and 5 other locations - About 6 hrs to fix
          distributor/service.go on lines 756..809
          distributor/service.go on lines 814..867
          distributor/service.go on lines 872..925
          distributor/service.go on lines 1168..1221
          distributor/service.go on lines 1226..1279

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 485.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 6 locations. Consider refactoring.
          Open

          func (s *service) ProxyCreate(c *Connection, rawReq string) bool {
          
              // Prepare payload to send.
              payload := &imap.Command{
                  Text:     rawReq,
          Severity: Major
          Found in distributor/service.go and 5 other locations - About 6 hrs to fix
          distributor/service.go on lines 756..809
          distributor/service.go on lines 872..925
          distributor/service.go on lines 930..983
          distributor/service.go on lines 1168..1221
          distributor/service.go on lines 1226..1279

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 485.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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
                Severity
                Category
                Status
                Source
                Language