Showing 55 of 55 total issues

Method input has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def input
      dly = @n_delay_ms
      open_sound_device
      nval = @n_val
      buf = @buf_in
Severity: Minor
Found in lib/cw/read.rb - About 1 hr to fix

    Method receive_mode has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def receive_mode
          print_mode :rx
          loop do
            char = key_input.read
            check_clear char
    Severity: Minor
    Found in lib/cw/tx.rb - About 1 hr to fix

      Method decode_signal has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def decode_signal
            if(@state[FILTERED])
              @state[FILTERED] = false
              @need_space = true
              #dbg_print "wpm #{@wpm.to_s}\nhigh period: #{@high[PERIOD]}\nhigh avg: #{@high[AVG]}"
      Severity: Minor
      Found in lib/cw/read.rb - About 1 hr to fix

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

            def monitor_keys
              @char = '#'
              process_letter
        
              loop do
        Severity: Minor
        Found in lib/cw/tx.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 monitor_keys has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def monitor_keys
              loop do
                key_input.read
                break if quit_key_input?
                break if quit?
        Severity: Minor
        Found in lib/cw/tester.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 config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.config
              unless @config
                @config = ParseConfig.new(CONFIG_PATH)
                CONFIG_METHODS.each do |method|
                  unless @config[method.to_s]
        Severity: Minor
        Found in lib/cw/config.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 wait_for_threads has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def wait_for_threads
              Cfg.config.params["exit"] = false
              loop do
                alive = false
                sleep 0.1
        Severity: Minor
        Found in lib/cw/threads.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 containing has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def containing
              letters = Cfg.config["containing"]
              letters.flatten.collect do |letr|
                if letr.class == Range
                  letters = letr.collect { |let| let }
        Severity: Minor
        Found in lib/cw/words.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 check_last_element_success has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def check_last_element_success(match, first, last)
              found = false
              last.downto(first) do |element|
                if found
                  @success[element] = false unless @success[element]
        Severity: Minor
        Found in lib/cw/element.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 sync_with_print has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def sync_with_print
              loop do
                make_sentence_index_current if ! sentence_index_current?
                break if sentence_index_current?
                break if quit?
        Severity: Minor
        Found in lib/cw/tester.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def run words
              temp_words = words.all
              temp_words.each do |word|
                loop do
                  Cfg.config.params["exit"] = false
        Severity: Minor
        Found in lib/cw/repeat_word.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 play_words_exit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def play_words_exit
        #      puts "play_words_exit"
              init_play_words_timeout
              loop do
                break if quit?
        Severity: Minor
        Found in lib/cw/play.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 match_first_active_element has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def match_first_active_element match
              if ! stream_empty?
                found = false
                first = element(:first)
                first.upto element(:last) do |ele|
        Severity: Minor
        Found in lib/cw/element.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 print_words_exit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def print_words_exit
              return if Cfg.config["print_letters"]
              timing.init_print_words_timeout
              loop do
                process_word_maybe
        Severity: Minor
        Found in lib/cw/tester.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 fetch_char has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def fetch_char code
              length = code.length
              case length
              when 1..5
                return ' ' if code == [:space]
        Severity: Minor
        Found in lib/cw/encoding.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 read_rss has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def read_rss(src, article_count = 3)
        
              Cfg.config.params["words_counted"] = true
              @rss_articles = []
              count = 0
        Severity: Minor
        Found in lib/cw/rss.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 process_letter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def process_letter
              @input_word ||= ''
              case @char
              when '#'
                return_val = receive_mode
        Severity: Minor
        Found in lib/cw/tx.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 results has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def results popped, type = :pass_and_fail
              if popped
                value = popped[:value]
                success = popped[:success]
        
        
        Severity: Minor
        Found in lib/cw/print.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 sentences_complete? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def sentences_complete?
              if @args.has_key?(:sentences) &&  @args[:sentences].is_a?(1.class)
                if @sentence_count_source
                  @sentence_count_source = nil
                else
        Severity: Minor
        Found in lib/cw/book_details.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 next_sentence_or_quit? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def next_sentence_or_quit?
              sleep 0.01 if play.still_playing?
              sentence.next unless play.still_playing?
              if change_repeat_or_quit?
                play.stop
        Severity: Minor
        Found in lib/cw/book.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