JoshuaMart/ScopesExtractor

View on GitHub

Showing 11 of 11 total issues

Method parse_scopes has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def self.parse_scopes(scopes)
        categorized_scopes = { 'in' => {}, 'out' => {} }
        return categorized_scopes unless scopes.is_a?(Array)

        scopes.each do |scope|
Severity: Minor
Found in libs/platforms/intigriti/scopes.rb - About 2 hrs 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 authenticate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def self.authenticate(config)
      url = LOGIN_URL + '?user_hint=researcher&returnTo=/dashboard'
      resp = HttpClient.get(url)
      return unless resp&.status == 307

Severity: Minor
Found in libs/platforms/bugcrowd/auth.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 targets_from_groups has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def self.targets_from_groups(url)
        url = File.join(url, 'target_groups')
        response = HttpClient.get(url)
        return unless response&.status == 200

Severity: Minor
Found in libs/platforms/bugcrowd/scopes.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 targets_from_engagements has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def self.targets_from_engagements(url)
        targets = nil
        response = HttpClient.get(url)
        return unless response&.status == 200

Severity: Minor
Found in libs/platforms/bugcrowd/scopes.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 parse_scopes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def self.parse_scopes(targets)
        scopes = {}

        targets.each do |target|
          category = find_category(target)
Severity: Minor
Found in libs/platforms/bugcrowd/scopes.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 normalize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def self.normalize(endpoint)
        scope = if !endpoint.start_with?('*.') && endpoint.include?('*.')
                  match = endpoint.match(/(?<wildcard>\*\.[\w.-]+\.\w+)/)
                  return unless match

Severity: Minor
Found in libs/platforms/bugcrowd/scopes.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      bc_authenticated = Bugcrowd.authenticate(config[:bugcrowd])
      Utilities.log_warn('Bugcrowd - Authentication Failed') unless bc_authenticated
      Bugcrowd::Programs.sync(results['Bugcrowd']) if bc_authenticated

Severity: Minor
Found in libs/scopes_extractor.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 unless resp
Severity: Major
Found in libs/platforms/bugcrowd/auth.rb - About 30 mins to fix

    Method follow_redirects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.follow_redirects(response, *expected_statuses)
          while expected_statuses.include?(response&.status)
            location = response&.headers['location']
            return unless location
            return response if location == '/dashboard'
    Severity: Minor
    Found in libs/platforms/bugcrowd/auth.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 sync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.sync(program, headers)
            scopes = {}
    
            url = File.join(PROGRAMS_ENDPOINT, program[:id])
            response = HttpClient.get(url, { headers: headers })
    Severity: Minor
    Found in libs/platforms/intigriti/scopes.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 normalize_urls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.normalize_urls(scope)
            normalized_urls = []
            scope = sanitize_scope(scope)
    
            if (match_data = scope.match(/^\((.*)\)(.*)/))
    Severity: Minor
    Found in libs/platforms/yeswehack/scopes.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