EasyRecon/Hunt3r

View on GitHub
backend/lib/platforms/hackerone.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

  def self.parse_scopes(scopes, slug, platform)
    program = Program.find_by(slug: slug)
    scopes.each do |scope|
      next unless scope['attributes']['eligible_for_submission']

Severity: Minor
Found in backend/lib/platforms/hackerone.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 get_report_reward has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_report_reward(platform, report_id)
    response = api_request(platform, "https://api.hackerone.com/v1/hackers/reports/#{report_id}")
    return unless response.code == 200

    report_activities = JSON.parse(response.body)['data']['relationships']['activities']['data']
Severity: Minor
Found in backend/lib/platforms/hackerone.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 parse_programs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.parse_programs(programs, platform)
    programs.each do |program|
      next unless program['attributes']['submission_state'] == 'open'

      slug = program['attributes']['handle']
Severity: Minor
Found in backend/lib/platforms/hackerone.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

There are no issues that match your filters.

Category
Status