kylewelsby/Banker

View on GitHub

Showing 2 of 2 total issues

Method get_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def get_data
      limit = -@page.at("table[summary='account summary'] tr:nth-child(1) td.normalText:nth-child(2)").content.gsub(/\D/,'').to_i
      amount = -@page.at("table[summary='account summary'] tr:nth-child(2) td.normalText:nth-child(2)").content.gsub(/\D/,'').to_i
      account_number = @page.at("table:first-child tr:nth-child(5) td b").
        content.to_i
Severity: Minor
Found in lib/banker/capital_one_uk.rb - About 1 hr to fix

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

        def params(args)
          missing_keys = []
          return unless defined? @keys
          @keys.each do |key|
            missing_keys << key unless args.has_key?(key.to_sym)
    Severity: Minor
    Found in lib/banker/base.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