Showing 5 of 7 total issues

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

    def self.parse(type, string)
      capitalized = (string.downcase != string && string.downcase.capitalize == string)
      string = string.to_s.downcase
      if (final = Final::All.find {|f| f.respond_to?("#{type}_standalone") && f.send("#{type}_standalone") == string})
        Syllable.new(Initial::Empty, final, nil, capitalized)
Severity: Minor
Found in lib/ting/conversions.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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(string)
        result = []
        looking_at = []
        string.chars.each do |ch|
          head, syll = parse_tail(looking_at)
Severity: Minor
Found in lib/ting/conversions/hanyu.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 parse_syllable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_syllable(tone_syll)
        tone_syll = tone_syll.to_s
        tone_syll = @options[:preprocess].call(tone_syll) if @options[:preprocess]
        tone, syll = @tone.pop_tone(tone_syll)
        if tone && syll
Severity: Minor
Found in lib/ting/conversions/hanyu.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 unparse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.unparse(type, tsyll)
      str = if tsyll.initial.send(type)
              apply_rules(type, tsyll.initial.send(type) + (tsyll.final.send(type) || ''))
            elsif tsyll.final.respond_to?(type.to_s+'_standalone') && standalone = tsyll.final.send(type.to_s+'_standalone')
              standalone
Severity: Minor
Found in lib/ting/conversions.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(str)
      Conversions.tokenize(str).map do |token, pos|
        tone, syll = @tone.pop_tone(token)
        tsyll = Conversions.parse(@conv, syll)
        ini, fin = tsyll.initial, tsyll.final
Severity: Minor
Found in lib/ting/reader.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