n7v/phonetic

View on GitHub

Showing 28 of 32 total issues

Method gen_encode has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.gen_encode(w, i, primary, secondary, code)
Severity: Minor
Found in lib/phonetic/double_metaphone.rb - About 35 mins to fix

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

        def self.encode_word(word, options = {})
          return '' if word.empty?
          w = word.upcase
          res = w[0]
          pg = CODE[w[0].to_sym]
    Severity: Minor
    Found in lib/phonetic/soundex.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 encode_word has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.encode_word(word, options = { trim: true })
          return if !word or word.empty?
          trim = options[:trim]
          w = word.upcase
          w.gsub!(/[^A-Z]/, '')
    Severity: Minor
    Found in lib/phonetic/nysiis.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 encode_w has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.encode_w(w, i, len, code)
          last = len - 1
          r = 1
          # can also be in middle of word
          if w[i, 2] == 'WR'
    Severity: Minor
    Found in lib/phonetic/double_metaphone.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 encode_cc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.encode_cc(w, i, code)
          r = 0
          # 'bellocchio' but not 'bacchus'
          if w[i + 2, 1] =~ /[IEH]/ && w[i + 2, 2] != 'HU'
            # 'accident', 'accede' 'succeed'
    Severity: Minor
    Found in lib/phonetic/double_metaphone.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 ch_germanic_or_greek? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.ch_germanic_or_greek?(w, i, len)
          # germanic, greek, or otherwise 'ch' for 'kh' sound
          w[0, 4] =~ /^(V[AO]N\s|SCH)/ ||
          # 'architect but not 'arch', 'orchestra', 'orchid'
          i > 1 && w[i - 2, 6] =~ /ORCHES|ARCHIT|ORCHID/ ||
    Severity: Minor
    Found in lib/phonetic/double_metaphone.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 encode_t has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.encode_t(w, n)
          metaph = ''
          if w[n + 1, 2] =~ /I[OA]/
            metaph = 'X'
          elsif w[n + 1] == 'H'
    Severity: Minor
    Found in lib/phonetic/metaphone.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 encode_word has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.encode_word(word, options = { size: 4 })
          code_size = options[:size] || 4
          w = word.strip.upcase
          code = Code.new
          i = 0
    Severity: Minor
    Found in lib/phonetic/double_metaphone.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