RubyMoney/monetize

View on GitHub

Showing 3 of 3 total issues

Method extract_major_minor_with_single_delimiter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def extract_major_minor_with_single_delimiter(num, currency, delimiter)
if expect_whole_subunits?
possible_major, possible_minor = split_major_minor(num, delimiter)
if minor_has_correct_dp_for_currency_subunit?(possible_minor, currency)
split_major_minor(num, delimiter)
Severity: Minor
Found in lib/monetize/parser.rb - About 45 mins to fix

Method to_money has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def to_money(currency = nil)
money_hash = self.respond_to?(:with_indifferent_access) ? self.with_indifferent_access : self
 
hash_currency = if money_hash[:currency].is_a?(Hash)
money_hash[:currency][:iso_code]
Severity: Minor
Found in lib/monetize/core_extensions/hash.rb - About 35 mins to fix

Method extract_major_minor_with_tentative_delimiter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def extract_major_minor_with_tentative_delimiter(num, delimiter)
if num.scan(delimiter).length > 1
# Multiple matches; treat as thousands separator
[num.gsub(delimiter, ''), '00']
else
Severity: Minor
Found in lib/monetize/parser.rb - About 35 mins to fix
Severity
Category
Status
Source
Language