apraditya/indonesian_stemmer

View on GitHub

Showing 7 of 7 total issues

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

      def stem_derivational(word)
        previous_size = word.size
        remove_first_order_prefix(word) if still_has_many_syllables?
        if previous_size != word.size
          previous_size = word.size
Severity: Minor
Found in lib/indonesian_stemmer.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 stem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def stem(word, derivational_stemming = true)
      @flags = 0

      if word =~ /\s/
        word.split(' ').map { |w| stem(w) }
Severity: Minor
Found in lib/indonesian_stemmer.rb - About 55 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 ambiguous_with_characters? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def ambiguous_with_characters?(word, characters, position)
        if position == :start
          if characters == 'per'
            chopped_word_match_words_collection?(word[3..-1],
                IrregularWords::BEGINS_WITH_R )
Severity: Minor
Found in lib/indonesian_stemmer/morphological_utility.rb - About 55 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 remove_characters_matching_collection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def remove_characters_matching_collection(word, collection, position)
        collection.each do |characters|
          if match_position_and_not_ambiguous_with_characters?(word, characters, position)
            next if characters == 'mem' && is_vowel?(word[characters.size])
            @flags ||= collection_for(characters, 'removed')
Severity: Minor
Found in lib/indonesian_stemmer/morphological_utility.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 remove_second_order_prefix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_second_order_prefix(word)
      @number_of_syllables ||= total_syllables(word)
      word_size = word.size

      if SPECIAL_SECOND_ORDER_PREFIX_WORDS.include?(word)
Severity: Minor
Found in lib/indonesian_stemmer/morphological_utility.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 remove_suffix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_suffix(word)
      return word if ambiguous_with_suffices_ending_words?(word)

      @number_of_syllables ||= total_syllables(word)

Severity: Minor
Found in lib/indonesian_stemmer/morphological_utility.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

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

      def collection_for(name, type = 'characters')
        constant_name = if type == 'characters'
          "#{name}_#{type}"
        else
          name =  case
Severity: Minor
Found in lib/indonesian_stemmer/morphological_utility.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

Severity
Category
Status
Source
Language