Showing 18 of 24 total issues

Method parse_env has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_env output
      env = []
      holder=nil
      terminator=nil
      output.each do |line|
Severity: Minor
Found in lib/tf/environment.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 load has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def load file_name
    lines = []
    file_lines = File.readlines(file_name)
    shell = "bash"
    shell = file_lines.shift.sub(/^#!/,'') if file_lines[0] =~ /^#!/
Severity: Minor
Found in lib/plugins/tf/comment_test_input.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_test has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def process_test test
    name, commands, execution_shell = test[:name], test[:commands], test[:shell]
    shell = Session::Sh.new(:prog => execution_shell)
    _env = env(shell)
    @plugins.output_plugins(:start_test, test, _env)
Severity: Minor
Found in lib/tf.rb - About 1 hr to fix

    Method parse_env has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def parse_env output
          env = []
          holder=nil
          terminator=nil
          output.each do |line|
    Severity: Minor
    Found in lib/tf/environment.rb - About 1 hr to fix

      Method match_arg_klass has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def match_arg_klass arg, klass, type
          klass = TF.const_get(klass)
          return nil unless klass.respond_to? :argument_matches?
          matches = klass.argument_matches? arg
          return nil if matches.nil?
      Severity: Minor
      Found in lib/tf/plugins.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 process_test has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def process_test test
          name, commands, execution_shell = test[:name], test[:commands], test[:shell]
          shell = Session::Sh.new(:prog => execution_shell)
          _env = env(shell)
          @plugins.output_plugins(:start_test, test, _env)
      Severity: Minor
      Found in lib/tf.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 execute_one has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def execute_one test, matcher, _stdout, _stderr, _stdboth, _status, env
      Severity: Major
      Found in lib/plugins/tf/env_arr_test.rb - About 50 mins to fix

        Method execute_all has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def execute_all test, matcher, _stdout, _stderr, _stdboth, _status, env
        Severity: Major
        Found in lib/plugins/tf/env_arr_test.rb - About 50 mins to fix

          Method execute_size has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def execute_size test, matcher, _stdout, _stderr, _stdboth, _status, env
          Severity: Major
          Found in lib/plugins/tf/env_arr_test.rb - About 50 mins to fix

            Method execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def execute test, _stdout, _stderr, _stdboth, _status, env
            Severity: Minor
            Found in lib/plugins/tf/env_match_test.rb - About 45 mins to fix

              Method execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def execute test, _stdout, _stderr, _stdboth, _status, env
              Severity: Minor
              Found in lib/plugins/tf/env_arr_test.rb - About 45 mins to fix

                Method execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def execute test, _stdout, _stderr, _stdboth, _status, env
                Severity: Minor
                Found in lib/plugins/tf/status_test.rb - About 45 mins to fix

                  Method execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def execute test, _stdout, _stderr, _stdboth, _status, env
                  Severity: Minor
                  Found in lib/plugins/tf/env_type_test.rb - About 45 mins to fix

                    Method execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def execute test, _stdout, _stderr, _stdboth, _status, env
                    Severity: Minor
                    Found in lib/plugins/tf/output_match_test.rb - About 45 mins to fix

                      Method process_command_tests has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def process_command_tests _stdout, _stderr, _stdboth, _status, env, tests
                      Severity: Minor
                      Found in lib/tf.rb - About 45 mins to fix

                        Avoid too many return statements within this method.
                        Open

                            return nil
                        Severity: Major
                        Found in lib/tf/plugins.rb - About 30 mins to fix

                          Method execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def execute test, _stdout, _stderr, _stdboth, _status, env
                              test =~ TF::EnvMatchTest::MATCHER
                              variable, sign, value = $1.strip, $2, $3
                              var_val = env[ variable ]
                              if  !(var_val.nil?) && !(var_val.is_a?(String))
                          Severity: Minor
                          Found in lib/plugins/tf/env_match_test.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 process_command_tests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def process_command_tests _stdout, _stderr, _stdboth, _status, env, tests
                              tests.each do |test|
                                plugin = @plugins.test_plugins.find{|_plugin| _plugin.matches? test }
                                if plugin.nil?
                                  status, msg = false, "Could not find plugin for test '#{test}'."
                          Severity: Minor
                          Found in lib/tf.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