kalashnikovisme/kabal

View on GitHub

Showing 6 of 6 total issues

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

  class Language
    include Kabal::GlobalRules::NaturalNumbers
    include Kabal::GlobalRules::FractionalNumbers
    include Kabal::GlobalRules::NumberProperities

Severity: Minor
Found in lib/kabal/languages/language.rb - About 2 hrs to fix

    Method name_with_declination has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.name_with_declination(number_name, count)
            if count.to_s.include? 'e'
              count = count.to_s.split('.')[0].to_i
            end
            # FIXME add gem russian
    Severity: Minor
    Found in lib/kabal/languages/russian/declinations.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 convert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def convert(number)
          if number == 0
            '0'
          else
            symbols = { 0 => ['I', 'V'], 1 => ['X', 'L'], 2 => ['C', 'D'], 3 => ['M'] }
    Severity: Minor
    Found in lib/kabal/languages/roman.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 single has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def single(number, this_is_end = true)
            if @feminine_name
              @feminine_name = false
              return names[:single_feminine][count(number) % 10] if count_can_be_feminine? number
            end
    Severity: Minor
    Found in lib/kabal/languages/russian/natural_numbers.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

    Avoid too many return statements within this method.
    Open

              return number_name + 'а' if end_with_two_or_three_of_four? count
    Severity: Major
    Found in lib/kabal/languages/russian/declinations.rb - About 30 mins to fix

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

            def natural_number_name(number)
              return single number if number >= 0 && number <= 19
              return two_words number if number >= 0 && number <= 99
              return three_words number if number >= 100 && number <= 999
              ten_powers number if number >= 100
      Severity: Minor
      Found in lib/kabal/languages/global/natural_numbers.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