rapid7/nexpose-client

View on GitHub

Showing 112 of 173 total issues

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

    def to_xml
      xml = %(<ReportConfig format="#{@format}" id="#{@id}" name="#{replace_entities(@name)}" template-id="#{@template_id}")
      xml << %( owner="#{@owner}") if @owner
      xml << %( timezone="#{@time_zone}") if @time_zone
      xml << %( language="#{@language}") if @language
Severity: Minor
Found in lib/nexpose/report.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 set_ssh_key_service has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def set_ssh_key_service(username, pemkey, password = nil, elevation_type = nil, elevation_user = nil, elevation_password = nil)
Severity: Minor
Found in lib/nexpose/credential_helper.rb - About 45 mins to fix

    Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(name, template_id, format, id = -1, owner = nil, time_zone = nil)
    Severity: Minor
    Found in lib/nexpose/report.rb - About 45 mins to fix

      Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(name, date, description, version, independent, size)
      Severity: Minor
      Found in lib/nexpose/maint.rb - About 45 mins to fix

        Method from_uri has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def self.from_uri(uri, user, pass, silo_id = nil, token = nil, trust_cert = nil)
        Severity: Minor
        Found in lib/nexpose/connection.rb - About 45 mins to fix

          Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def initialize(name, address, user, password, exchange_username, exchange_password)
          Severity: Minor
          Found in lib/nexpose/discovery.rb - About 45 mins to fix

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

                def initialize(name, sender, server, recipients, enabled = 1, max_alerts = -1, verbose = 0)
                  unless recipients.is_a?(Array) && !recipients.empty?
                    raise 'An SMTP alert must contain an array of recipient emails with at least 1 recipient'
                  end
            
            
            Severity: Minor
            Found in lib/nexpose/alert.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def initialize(scan_id, site_id, engine_id, status, start_time, end_time)
            Severity: Minor
            Found in lib/nexpose/scan.rb - About 45 mins to fix

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

                  def add_control_scanning_to_xml(xml, enabled)
                    if elem = REXML::XPath.first(xml, '//enableControlsScan')
                      elem.attributes['enabled'] = enabled ? '1' : '0'
                    else
                      elem = REXML::Element.new('ControlsScan', xml.root)
              Severity: Minor
              Found in lib/nexpose/global_settings.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def initialize(id, name, type, scope, built_in, description)
              Severity: Minor
              Found in lib/nexpose/report_template.rb - About 45 mins to fix

                Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def initialize(id, name, address, port, status, scope = 'silo')
                Severity: Minor
                Found in lib/nexpose/engine.rb - About 45 mins to fix

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

                      def to_xml
                        xml = '<Email'
                        xml << %( toAllAuthorized='#{@to_all_authorized ? 1 : 0}')
                        xml << %( sendToOwnerAs='#{@send_to_owner_as}') if @send_to_owner_as
                        xml << %( sendToAclAs='#{@send_to_acl_as}') if @send_to_acl_as
                  Severity: Minor
                  Found in lib/nexpose/common.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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def self.load(nsc, id)
                        uri  = "/api/2.1/site_configurations/#{id}"
                        resp = AJAX.get(nsc, uri, AJAX::CONTENT_TYPE::JSON)
                        hash = JSON.parse(resp, symbolize_names: true)
                        site = self.json_initializer(hash).deserialize(hash)
                  Severity: Minor
                  Found in lib/nexpose/site.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

                  Avoid deeply nested control flow statements.
                  Open

                                  if part.header.to_s =~ %r(text/xml)
                                    return part.content.unpack('m*')[0].to_s
                                  elsif part.header.to_s =~ %r(text/html)
                                    return part.content.unpack('m*')[0].to_s
                                  end
                  Severity: Major
                  Found in lib/nexpose/report.rb - About 45 mins to fix

                    Method _get_json_table has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def _get_json_table(console, address, parameters = {}, page_size = 500, records = nil, post = true)
                    Severity: Minor
                    Found in lib/nexpose/data_table.rb - About 45 mins to fix

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

                          def request(request:, timeout: nil)
                            http = https(timeout: timeout)
                            add_nexpose_session(request: request)
                            response = http.request(request)
                            case response
                      Severity: Minor
                      Found in lib/eso/service.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def initialize(start, enabled = true, duration, type, interval)
                      Severity: Minor
                      Found in lib/nexpose/blackout.rb - About 35 mins to fix

                        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def initialize(name, type = 'document', id = -1, scope = 'silo', built_in = false)
                        Severity: Minor
                        Found in lib/nexpose/report_template.rb - About 35 mins to fix

                          Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def initialize(name, protocol, address, user, password = nil)
                          Severity: Minor
                          Found in lib/nexpose/discovery.rb - About 35 mins to fix

                            Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def initialize(name, community, server, enabled = 1, max_alerts = -1)
                            Severity: Minor
                            Found in lib/nexpose/alert.rb - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language