EasyRecon/Hunt3r

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

Summary

Maintainability
B
4 hrs
Test Coverage

Method parse_reports_infos has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def self.parse_reports_infos(platform, reports, collab, report_id)
    report_infos = { reward: 0, collab: collab }

    reports.each do |item|
      next unless item
Severity: Minor
Found in backend/lib/platforms/yeswehack.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 parse_scopes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.parse_scopes(scopes, slug, platform)
    program = Program.find_by(slug: slug)
    scopes.each do |scope|
      type = scope['scope_type']
      next unless %w[web-application api].include?(type)
Severity: Minor
Found in backend/lib/platforms/yeswehack.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 get_jwt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_jwt(platform)
    return unless platform.jwt.nil? || (Time.now - platform.updated_at) > 3500

    totp_token = get_totp_token(platform)
    return unless totp_token
Severity: Minor
Found in backend/lib/platforms/yeswehack.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 get_reports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_reports(platform, collab, page_id = 1)
    api_url = if collab
                "https://api.yeswehack.com/collaborator/reports?page=#{page_id}"
              else
                "https://api.yeswehack.com/user/reports?page=#{page_id}"
Severity: Minor
Found in backend/lib/platforms/yeswehack.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