sugi/ya_kansuji

View on GitHub

Showing 9 of 9 total issues

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

def to_i(str)
str = str.to_s.tr(NUM_ALT_CHARS, NUM_NORMALIZED_CHARS)
str.gsub!(/[,,、[:space:]]/, '')
matched = REGEXP.match(str) or return 0
ret3 = 0
Severity: Minor
Found in lib/ya_kansuji.rb - About 2 hrs to fix

Method to_i has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def to_i(str)
str = str.to_s.tr(NUM_ALT_CHARS, NUM_NORMALIZED_CHARS)
str.gsub!(/[,,、[:space:]]/, '')
matched = REGEXP.match(str) or return 0
ret3 = 0
Severity: Major
Found in lib/ya_kansuji.rb - About 2 hrs to fix

    Method call has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def call(num, _options = {})
    return '零' if num.zero?
     
    ret = ''
    (UNIT_EXP4.reverse + ['']).each_with_index do |unit4, ridx4|
    Severity: Minor
    Found in lib/ya_kansuji/formatter/simple.rb - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    module Formatter
    # Formatter for Jpanese judicial style kansuji (arabic numerals version)
    module JudicH
    module_function
     
     
    Severity: Major
    Found in lib/ya_kansuji/formatter/judic_h.rb and 1 other location - About 1 hr to fix
    lib/ya_kansuji/formatter/judic_v.rb on lines 3..26

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    module Formatter
    # Formatter for Jpanese judicial style kansuji (kanji numerals version)
    module JudicV
    module_function
     
     
    Severity: Major
    Found in lib/ya_kansuji/formatter/judic_v.rb and 1 other location - About 1 hr to fix
    lib/ya_kansuji/formatter/judic_h.rb on lines 3..26

    Method call has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def call(num, _options = {})
    return '0' if num.zero?
     
    ret = ''
    (UNIT_EXP4.reverse + ['']).each_with_index do |unit4, ridx4|
    Severity: Minor
    Found in lib/ya_kansuji/formatter/lawyer.rb - About 1 hr to fix

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

    def call(num, _options = {})
    return '0' if num.zero?
     
    parts = []
    (UNIT_EXP4.reverse + ['']).each_with_index do |unit4, ridx4|
    Severity: Minor
    Found in lib/ya_kansuji/formatter/gov.rb - About 35 mins to fix

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

    def call(num, _options = {})
    return '〇' if num.zero?
     
    ret = ''
    head = true
    Severity: Minor
    Found in lib/ya_kansuji/formatter/judic_v.rb - About 35 mins to fix

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

    def call(num, _options = {})
    return '0' if num.zero?
     
    ret = ''
    head = true
    Severity: Minor
    Found in lib/ya_kansuji/formatter/judic_h.rb - About 35 mins to fix
    Severity
    Category
    Status
    Source
    Language