hammackj/risu

View on GitHub

Showing 178 of 178 total issues

Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                    def initialize
                        @info =
                        {
                            :description => "Cisco IOS Patch Rollup",
                            :plugin_id => -99965,
Severity: Minor
Found in lib/risu/parsers/nessus/postprocess/cisco_ios.rb - About 1 hr to fix

    Method db_connect has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                def db_connect
                    begin
                        if @database["adapter"] == nil
                            puts "[!] #{@database['adapter']}" if @options[:debug]
    
    
    Severity: Minor
    Found in lib/risu/cli/application.rb - About 1 hr to fix

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

                  def render output
                      output.text Report.classification.upcase, :align => :center
                      output.text "\n"
      
                      output.font_size(22) { output.text Report.title, :align => :center }
      Severity: Minor
      Found in lib/risu/templates/ms_update_summary.rb - About 1 hr to fix

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

                    def load_templates path, recursive=true
                        begin
                            search_path = "#{path}/**/*.rb" if recursive == true
                            search_path = "#{path}/*.rb" if recursive == false
        
        
        Severity: Minor
        Found in lib/risu/base/template_manager.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 load_postprocesses has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                    def load_postprocesses(path, recursive=true)
                        begin
        
                            search_path = "#{path}/**/*.rb" if recursive == true
                            search_path = "#{path}/*.rb" if recursive == false
        Severity: Minor
        Found in lib/risu/base/post_process_manager.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 text has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def text
                nt = Host.os_windows_nt.to_a.count
                w2k = Host.os_windows_2k.to_a.count
                xp = Host.os_windows_xp.to_a.count
                w2k3 = Host.os_windows_2k3.to_a.count
        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 windows_os_graph has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

                        def windows_os_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/models/host.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 windows_os_graph has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        def windows_os_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/models/host.rb - About 1 hr to fix

          Method initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                              def initialize
                                  @info =
                                  {
                                      :description => "Apple iTunes Patch Rollup",
                                      :plugin_id => -99960,
          Severity: Minor
          Found in lib/risu/parsers/nessus/postprocess/apple_itunes.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 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

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

                                  def common_patches_table(output)
                                      headers = ["Description", "Count"]
                                      header_widths = {0 => (output.bounds.width - 50), 1 => 50}
                  
                                      data = common_patches_sorted
                  Severity: Major
                  Found in lib/risu/models/item.rb and 1 other location - About 1 hr to fix
                  lib/risu/models/item.rb on lines 741..749

                  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 52.

                  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 2 locations. Consider refactoring.
                  Open

                                  def top_10_table(output)
                                      headers = ["Description", "Count"]
                                      header_widths = {0 => (output.bounds.width - 50), 1 => 50}
                  
                                      data = top_10_sorted
                  Severity: Major
                  Found in lib/risu/models/item.rb and 1 other location - About 1 hr to fix
                  lib/risu/models/item.rb on lines 753..761

                  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 52.

                  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 2 locations. Consider refactoring.
                  Open

                                  def common_patches_sorted
                                      raw = common_patches_order_by_cvss_raw
                                      data = Array.new
                  
                                      raw.each do |vuln|
                  Severity: Major
                  Found in lib/risu/models/item.rb and 1 other location - About 1 hr to fix
                  lib/risu/models/item.rb on lines 689..709

                  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 52.

                  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 2 locations. Consider refactoring.
                  Open

                                  def top_10_sorted
                                      raw = notable_order_by_cvss_raw
                                      data = Array.new
                  
                                      raw.each do |vuln|
                  Severity: Major
                  Found in lib/risu/models/item.rb and 1 other location - About 1 hr to fix
                  lib/risu/models/item.rb on lines 712..732

                  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 52.

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