rapid7/nexpose-client

View on GitHub

Showing 173 of 173 total issues

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

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

                              id.eql?(other.id) &&
                              service.eql?(other.service) &&
                              enabled.eql?(other.enabled) &&
                              name.eql?(other.name) &&
                              form.eql?(other.form) &&
                      Severity: Minor
                      Found in lib/nexpose/web_credentials.rb and 1 other location - About 45 mins to fix
                      lib/nexpose/site_credentials.rb on lines 216..224

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

                      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

                            user_name.eql?(other.user_name) &&
                            notes_id_password.eql?(other.notes_id_password) &&
                            use_windows_auth.eql?(other.use_windows_auth) &&
                            sid.eql?(other.sid) &&
                            service_name.eql?(other.service_name) &&
                      Severity: Minor
                      Found in lib/nexpose/site_credentials.rb and 1 other location - About 45 mins to fix
                      lib/nexpose/web_credentials.rb on lines 236..244

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

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