Showing 16 of 16 total issues

Method libreoffice has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def libreoffice( format: )
      suffixes = {
        'pdf' => {
          '.*' => 'pdf',
        },
Severity: Major
Found in lib/heathen/processor_methods/libreoffice.rb - About 2 hrs to fix

    Class Document has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Document
        attr_reader :base_dir
        attr_reader :doc_key
    
        CURRENT = 'current'
    Severity: Minor
    Found in lib/document.rb - About 2 hrs to fix

      Method libreoffice has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def libreoffice( format: )
            suffixes = {
              'pdf' => {
                '.*' => 'pdf',
              },
      Severity: Minor
      Found in lib/heathen/processor_methods/libreoffice.rb - About 1 hr 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 process has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def process email, mail_to, is_rts=false
            documents = []
      
            unless email.has_attachments?
              logger.info "From: #{email.from} Subject: (#{email.subject}) Files: no attachments"
      Severity: Minor
      Found in lib/autoheathen/email_processor.rb - About 1 hr to fix

        Method to_hash has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def to_hash
              v_list = {}
              versions.each do |v|
                v_list[v] = {}
                Dir.glob(directory + v + '*').each do |file|
        Severity: Minor
        Found in lib/document.rb - About 1 hr 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_onward has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def deliver_onward email, documents, mail_to
              logger.info "Sending response mail to #{mail_to}"
              email.cc [] # No CCing, just send to the recipient
              email.to mail_to
              email.subject "#{'Fwd: ' unless email.subject.to_s.start_with? 'Fwd:'}#{email.subject}"
        Severity: Minor
        Found in lib/autoheathen/email_processor.rb - About 1 hr 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 to_hash has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def to_hash
              v_list = {}
              versions.each do |v|
                v_list[v] = {}
                Dir.glob(directory + v + '*').each do |file|
        Severity: Minor
        Found in lib/document.rb - About 1 hr to fix

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

              def deliver_rts email, documents, mail_to
                logger.info "Sending response mail to #{mail_to}"
                mail = Mail.new
                mail.from @cfg[:from]
                mail.to mail_to
          Severity: Minor
          Found in lib/autoheathen/email_processor.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 process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def process email, mail_to, is_rts=false
                documents = []
          
                unless email.has_attachments?
                  logger.info "From: #{email.from} Subject: (#{email.subject}) Files: no attachments"
          Severity: Minor
          Found in lib/autoheathen/email_processor.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 perform has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def perform doc_key_str, version, action, new_filename, callback_url, status, description
          Severity: Major
          Found in lib/sidekiq_workers.rb - About 50 mins to fix

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

                def symbolize_keys(hash)
                  (hash||{}).inject({}){|result, (key, value)|
                    new_key = key.is_a?(String) ? key.to_sym : key
                    new_value = value.is_a?(Hash) ? symbolize_keys(value) : value
                    result[new_key] = new_value
            Severity: Minor
            Found in lib/autoheathen/config.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def execute(*argv)
                  options = argv.last.class == Hash ? argv.pop : {}
            
                  started = Time.now.to_f
            
            
            Severity: Minor
            Found in lib/heathen/executioner.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 perform has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def perform doc_key_str, version, filename, action, callback_url=nil
            Severity: Minor
            Found in lib/sidekiq_workers.rb - About 35 mins to fix

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

                  def _wkhtmltopdf_options(content)
                    html = Nokogiri.parse(content)
              
                    attrs = html.xpath("//meta[starts-with(@name, 'colore')]").inject({}) do |h, meta|
                      name  = meta.attributes['name'].value.sub(/^colore/, '-')
              Severity: Minor
              Found in lib/heathen/processor_methods/wkhtmltopdf.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 _execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def _execute(*argv, options)
              
                      builder = java.lang.ProcessBuilder.new
                      builder.command(argv)
              
              
              Severity: Minor
              Found in lib/heathen/executioner.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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def perform
                      purge_seconds = (C_.legacy_purge_days || 1).to_f * 86400.0
                      dir = LegacyConverter.new.legacy_dir
                      dir.each_entry do |file|
                        next if (dir+file).directory?
              Severity: Minor
              Found in lib/sidekiq_workers.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