lib/cw/tx.rb

Summary

Maintainability
F
3 days
Test Coverage

Class Tx has 48 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Tx < Tester

    include ToneHelpers
    include FileDetails

Severity: Minor
Found in lib/cw/tx.rb - About 6 hrs to fix

    File tx.rb has 425 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module CW
      class Tx < Tester
    
        include ToneHelpers
        include FileDetails
    Severity: Minor
    Found in lib/cw/tx.rb - About 6 hrs to fix

      Method process_letter has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def process_letter
            @input_word ||= ''
            case @char
            when '#'
              return_val = receive_mode
      Severity: Major
      Found in lib/cw/tx.rb - About 2 hrs to fix

        Method capture_attribute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def capture_attribute(attr_type, use_recording = false)
              puts "\n\r"
              puts "Enter their #{attr_type.to_s} followed by SPACE" unless use_recording
              temp = use_recording ? @recording : []
              print.menu temp.join('').delete(' ') if(@recording && ! use_recording)
        Severity: Minor
        Found in lib/cw/tx.rb - About 2 hrs 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 write_attribute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_attribute attr, type
              clip = attr.join('').delete(' ')
              @their_callsign = clip if :callsign == type
              @their_name  = clip    if :name == type
              @their_rst   = clip    if :rst == type
        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 capture has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def capture
              puts "\n\r"
              puts "\r Menu: [C]allsign,    [N]ame, "
              puts "\r       [L]ocation,    [R]st,  "
              puts "\r       [T]emperature, [S]tore,"
        Severity: Minor
        Found in lib/cw/tx.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 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 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

            Avoid too many return statements within this method.
            Open

                      return store
            Severity: Major
            Found in lib/cw/tx.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return
              Severity: Major
              Found in lib/cw/tx.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          return info
                Severity: Major
                Found in lib/cw/tx.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return capture_attribute :temperature, upcase
                  Severity: Major
                  Found in lib/cw/tx.rb - About 30 mins to fix

                    Method receive_mode has a Cognitive Complexity of 6 (exceeds 5 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 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

                    There are no issues that match your filters.

                    Category
                    Status