hammackj/risu

View on GitHub

Showing 111 of 178 total issues

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

            def render output
                @output.text Report.classification.upcase, :align => :center
                @output.text "\n"

                report_title Report.title
Severity: Minor
Found in lib/risu/templates/authentication_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 unsupported_os_windows has a Cognitive Complexity of 7 (exceeds 5 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 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?
                    parser = nil

                    if File.exist?(@document)
                        parser = LibXML::XML::Parser.file @document
Severity: Minor
Found in lib/risu/parsers/nessus/nessus_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

Avoid too many return statements within this method.
Open

                        return false
Severity: Major
Found in lib/risu/parsers/nessus/nessus_document.rb - About 30 mins to fix

    Method render has a Cognitive Complexity of 6 (exceeds 5 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 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 anon_smb_count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

                def anon_smb_count
                    count = 0
                    begin
                        anon_smb_query().each do |finding|
                            host = Host.find_by_id(finding.host_id)
    Severity: Minor
    Found in lib/risu/base/shares_template_helper.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 other_os_graph_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

                    def other_os_graph_text
                        text = "This graph shows the percentage of the different Non-Windows based operating systems " +
                        "found on the #{Report.title} network.\n\n"
    
                        linux = Host.os_linux.to_a.size
    Severity: Minor
    Found in lib/risu/models/host.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 render has a Cognitive Complexity of 6 (exceeds 5 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_wsus_findings.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 fix_ips has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

                    def fix_ips
                        @hosts = Host.all
    
                        @hosts.each do |host|
                            if host.ip == nil
    Severity: Minor
    Found in lib/risu/parsers/nexpose/nexpose_document.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 fix_ips has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

                    def fix_ips
                        @hosts = Host.all
    
                        @hosts.each do |host|
                            if host.ip == nil
    Severity: Minor
    Found in lib/risu/parsers/nessus/nessus_document.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 shares_section_has_findings? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

                def shares_section_has_findings?
                    poor_count = 0
    
                    anon_ftp_text = ""
                    anon_smb_text = ""
    Severity: Minor
    Found in lib/risu/base/shares_template_helper.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