piotrmurach/strings-inflection

View on GitHub

Showing 5 of 7 total issues

File nouns.rb has 645 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Strings
  module Inflection
    module Nouns
      # Remove suffix from a word
      #
Severity: Major
Found in lib/strings/inflection/nouns.rb - About 1 day to fix

    Method parse_noun has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def parse_noun
            if @scanner.scan(/\{\{N([^\}]*?):([^\}]+?)\}\}/)
              option = @scanner[1].to_s.tr(" ", "").downcase
              if option =~ /[^sp]/i
                raise "Unknown option '#{option}' in {{N:...}} tag"
    Severity: Minor
    Found in lib/strings/inflection/parser.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 parse_verb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def parse_verb
            if @scanner.scan(/\{\{V([^\}]*?):([^\}]+?)\}\}/)
              option = @scanner[1].to_s.tr(" ", "").downcase
              if !option.empty?
                raise "Unknown option '#{option}' in {{V:...}} tag"
    Severity: Minor
    Found in lib/strings/inflection/parser.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

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

          def parse_count_flags(option)
            case option
            when -> (opt) { opt =~ /w/ && opt =~ /o/ }
              Strings::Numeral.ordinalize(@count)
            when /w(\d*)/
    Severity: Minor
    Found in lib/strings/inflection/parser.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

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

          def fuzzy_count(count)
            if count >= 10 then "many"
            elsif count >= 6 then "several"
            elsif count >= 3 then "a few"
            elsif count == 2 then "a couple of"
    Severity: Minor
    Found in lib/strings/inflection/parser.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