tpitale/mail_room

View on GitHub

Showing 6 of 8 total issues

Class Connection has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Connection < MailRoom::Connection
      NEXT_PAGE_KEY = '@odata.nextLink'
      DEFAULT_POLL_INTERVAL_S = 60

      TooManyRequestsError = Class.new(RuntimeError)
Severity: Minor
Found in lib/mail_room/microsoft_graph/connection.rb - About 4 hrs to fix

    Class Connection has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Connection < MailRoom::Connection
          def initialize(mailbox)
            super
    
            # log in and set the mailbox
    Severity: Minor
    Found in lib/mail_room/imap/connection.rb - About 2 hrs to fix

      Method validate_microsoft_graph! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate_microsoft_graph!
            raise ConfigurationError, "Missing inbox_options in Mailbox: #{inspect}" unless self.inbox_options.is_a?(Hash)
      
            MICROSOFT_GRAPH_CONFIGURATION.each do |k|
              if self[k].nil?
      Severity: Minor
      Found in lib/mail_room/mailbox.rb - 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

      Method initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(options={})
            self.mailboxes = []
            self.quiet = options.fetch(:quiet, false)
      
            if options.has_key?(:config_path)
      Severity: Minor
      Found in lib/mail_room/configuration.rb - 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

      Method get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def get(url)
              response = token.get(url, { raise_errors: false })
      
              # https://docs.microsoft.com/en-us/graph/errors
              case response.status
      Severity: Minor
      Found in lib/mail_room/microsoft_graph/connection.rb - 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

      Method replace_verify_mode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def replace_verify_mode(options)
            return options unless options.is_a?(Hash)
            return options unless options.has_key?(:verify_mode)
      
            options[:verify_mode] = lookup_verify_mode(options[:verify_mode])
      Severity: Minor
      Found in lib/mail_room/mailbox.rb - 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

      Severity
      Category
      Status
      Source
      Language