kert-io/mail_runner

View on GitHub

Showing 5 of 5 total issues

Method parse_options has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.parse_options(argv)
      opts = {}
      @parser = OptionParser.new do |o|
        o.on '-m', '--mailbox MAILBOX', "Name of Mailbox to watch" do |arg|
          opts[:mailbox] = arg
Severity: Minor
Found in lib/mail_runner/cli.rb - About 1 hr to fix

    Method parse_header has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.parse_header(header_contents)
          hash = {}
          header = header_contents.to_s.split(/\r\n/)
          header.each do |h|
            parts = h.split(/:/, 2)
    Severity: Minor
    Found in lib/mail_runner/bot_helpers/helpers.rb - About 45 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 deliver_to_cloud_archive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.deliver_to_cloud_archive(msg, archive_opts)
          attempts = 0
          begin
            archive = establish_archive_link(archive_opts)
            filename = name_msg(msg)
    Severity: Minor
    Found in lib/mail_runner/archive_manager.rb - About 45 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 convert_raw_mail_to_json has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.convert_raw_mail_to_json(mail)
          mail_array = []
          header = parse_header(mail.header)
          from = parse_from(header[:From])
          attachments = parse_attachments(mail.attachments)
    Severity: Minor
    Found in lib/mail_runner/bot_helpers/helpers.rb - About 45 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def run
            BotHelpers::Helpers.print_monitoring_started_msg(self)
            $mad_statter.incr_stat("runner launched")
            while true 
    
    
    Severity: Minor
    Found in lib/mail_runner/head_manager_bot.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