watsonbox/pocketsphinx-ruby

View on GitHub

Showing 3 of 3 total issues

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

    def recognize_after_speech(max_samples, buffer)
      if in_speech?
        while in_speech?
          process_audio(buffer, max_samples) or break
        end
Severity: Minor
Found in lib/pocketsphinx/speech_recognizer.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 recognize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def recognize(max_samples = 2048, &b)
      unless ALGORITHMS.include?(algorithm)
        raise NotImplementedError, "Unknown speech recognition algorithm: #{algorithm}"
      end

Severity: Minor
Found in lib/pocketsphinx/speech_recognizer.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 []= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def []=(name, value)
        check_type(name, type = find_definition(name).type, value)

        case type
        when :integer
Severity: Minor
Found in lib/pocketsphinx/configuration/base.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