hammackj/risu

View on GitHub

Showing 111 of 178 total issues

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

            def graph
        g = Gruff::Pie.new(GRAPH_WIDTH)
        g.title = "Windows Operating Systems By Percentage"
        g.sort = false
        g.marker_count = 1
Severity: Minor
Found in lib/risu/graphs/windows_os_graph.rb - About 1 hr to fix

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

                    def unsupported_os_windows
                        win_95_text = ""
                        win_98_text = ""
                        win_me_text = ""
                        win_nt_text = ""
    Severity: Minor
    Found in lib/risu/models/host.rb - About 1 hr to fix

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

                  def migrate direction
                      begin
                          if @database["adapter"] == nil
                              return false, "[!] Invalid database adapter, please check your configuration file"
                          end
      Severity: Minor
      Found in lib/risu/cli/application.rb - About 1 hr to fix

        Method parse_file has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    def parse_file file
                        begin
                            puts "[*] Parsing #{file}..."
                            tstart = Time.new
        
        
        Severity: Minor
        Found in lib/risu/cli/application.rb - About 1 hr to fix

          Method render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      def render output
                          text Report.classification.upcase, :align => :center
                          text "\n"
          
                          report_title Report.title
          Severity: Minor
          Found in lib/risu/templates/failed_audits.rb - About 1 hr to fix

            Method graph has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                        def graph
                    g = Gruff::Pie.new(GRAPH_WIDTH)
                    g.title = "Windows Operating Systems By Percentage"
                    g.sort = false
                    g.marker_count = 1
            Severity: Minor
            Found in lib/risu/graphs/windows_os_graph.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 other_os_graph has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            def other_os_graph
                                g = Gruff::Pie.new(GRAPH_WIDTH)
                                g.title = "Other Operating Systems Percentage"
                                g.sort = false
                                g.marker_count = 1
            Severity: Minor
            Found in lib/risu/models/host.rb - About 1 hr to fix

              Method top_by_count_graph has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              def top_by_count_graph(limit=10)
                                  g = Gruff::Bar.new(GRAPH_WIDTH)
                                  g.title = sprintf "Top %d Critical Findings By Plugin", Item.risks_by_plugin(limit).to_a.count
                                  g.sort = false
                                  g.marker_count = 1
              Severity: Minor
              Found in lib/risu/models/plugin.rb - About 1 hr to fix

                Method create_plugin has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                    def create_plugin
                                        plugin = Plugin.find_by_id(@plugin_id)
                
                                        newest_plugin = newest_plugin()
                
                
                Severity: Minor
                Found in lib/risu/parsers/nessus/postprocess/post_process.rb - About 1 hr to fix

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

                              def render output
                                  text Report.classification.upcase, :align => :center
                                  text "\n"
                  
                                  report_title Report.title
                  Severity: Minor
                  Found in lib/risu/templates/ms_patch_summary.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 newest_plugin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                                      def newest_plugin
                                          newest = DateTime.new(0001, 01, 01)
                                          newest_plugin = nil
                  
                                          @plugin_ids.uniq.each do |id|
                  Severity: Minor
                  Found in lib/risu/parsers/nessus/postprocess/post_process.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 shares_section has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                              def shares_section
                                  poor_count = 0
                  
                                  anon_ftp_text = ""
                                  anon_smb_text = ""
                  Severity: Minor
                  Found in lib/risu/base/shares_template_helper.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 anon_smb_section has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                              def anon_smb_section
                                  if anon_smb_count() <= 0
                                      return
                                  end
                  
                  
                  Severity: Minor
                  Found in lib/risu/base/shares_template_helper.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                              def render output
                                  output.font_size 10
                                  output.font "Times-Roman"
                  
                                  output.image "#{File.expand_path(File.dirname(__FILE__))}/data/nessuslogo.jpg", :scale => 1.0, :position => :left, :vposition => :top
                  Severity: Minor
                  Found in lib/risu/templates/executive_summary_detailed.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                              def render output
                                  text Report.classification.upcase, :align => :center
                                  text "\n"
                  
                                  report_title Report.title
                  Severity: Minor
                  Found in lib/risu/templates/pci_compliance.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 on_end_element has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                                  def on_end_element(element)
                                      @tag = nil
                                      case element
                                          when "device"
                                              @in_device = false
                  Severity: Minor
                  Found in lib/risu/parsers/nexpose/simple_nexpose.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 valid? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                                  def valid?
                                      if File.exist?(@document)
                                          @parser = LibXML::XML::Parser.file @document
                                          doc = @parser.parse
                  
                  
                  Severity: Minor
                  Found in lib/risu/parsers/nexpose/nexpose_document.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                                      def run
                                          @plugins_to_severity.each do |k, v|
                                              items = Item.where(:plugin_id => k)
                  
                                              if items == nil
                  Severity: Minor
                  Found in lib/risu/parsers/nessus/postprocess/downgrade_plugins.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 stig_findings_text has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                              def stig_findings_text(category="I")
                                  if category != "I" || category != "II" || category != "III"
                                      return
                                  end
                  
                  
                  Severity: Minor
                  Found in lib/risu/templates/stig_findings_summary.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 known_malicious_process_appendix_section has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                              def known_malicious_process_appendix_section
                                  count = known_malicious_process_count()
                  
                                  if count <= 0
                                      return
                  Severity: Minor
                  Found in lib/risu/base/malware_template_helper.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

                  Severity
                  Category
                  Status
                  Source
                  Language