Jan17392/asianodds

View on GitHub

Showing 5 of 5 total issues

Class Login has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Login

    attr_reader :code, :ao_token, :ao_key, :base_url, :successful_login, :message

    # The API has a very standard request format for get requests - Use this one to stay DRY
Severity: Minor
Found in lib/asianodds/login.rb - About 2 hrs to fix

    Method get_feeds has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_feeds(attributes)
          attributes[:sports_type].nil? ? sports_type = 1 : sports_type = attributes[:sports_type]
          attributes[:market_type].nil? ? market_type = 1 : market_type = attributes[:market_type]
          attributes[:bookies].nil? ? bookies = 'ALL' : bookies = attributes[:bookies]
          attributes[:leagues].nil? ? leagues = 'ALL' : leagues = attributes[:leagues]
    Severity: Minor
    Found in lib/asianodds/login.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_matches has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_matches(attributes)
          attributes[:sports_type].nil? ? sports_type = 1 : sports_type = attributes[:sports_type]
          attributes[:market_type].nil? ? market_type = 1 : market_type = attributes[:market_type]
          attributes[:bookies].nil? ? bookies = 'ALL' : bookies = attributes[:bookies]
          attributes[:leagues].nil? ? leagues = 'ALL' : leagues = attributes[:leagues]
    Severity: Minor
    Found in lib/asianodds/login.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_leagues has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_leagues(attributes)
          attributes[:sports_type].nil? ? sports_type = 1 : sports_type = attributes[:sports_type]
          attributes[:market_type].nil? ? market_type = 1 : market_type = attributes[:market_type]
          attributes[:bookies].nil? ? bookies = 'ALL' : bookies = attributes[:bookies]
          attributes[:since].nil? ? since = '0' : since = attributes[:since]
    Severity: Minor
    Found in lib/asianodds/login.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 get_history_statement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_history_statement(attributes)
          attributes[:from_date].nil? ? from_date = (Date.today - 7).strftime('%m/%d/%Y') : from_date = attributes[:from_date]
          attributes[:to_date].nil? ? to_date = Date.today.strftime('%m/%d/%Y') : to_date = attributes[:to_date]
          attributes[:bookies].nil? ? bookies = 'ALL' : bookies = attributes[:bookies]
          if loggedin?
    Severity: Minor
    Found in lib/asianodds/login.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

    Severity
    Category
    Status
    Source
    Language