KnapsackPro/knapsack_pro-ruby

View on GitHub

Showing 32 of 32 total issues

Class Env has 56 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Env
      LOG_LEVELS = {
        'fatal'  => ::Logger::FATAL,
        'error'  => ::Logger::ERROR,
        'warn'  => ::Logger::WARN,
Severity: Major
Found in lib/knapsack_pro/config/env.rb - About 1 day to fix

    Method make_request has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

          def make_request(&block)
            retries ||= 0
    
            @http_response = block.call
            @response_body = parse_response_body(http_response.body)
    Severity: Minor
    Found in lib/knapsack_pro/client/connection.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

    Class Connection has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Connection
          class ServerError < StandardError; end
    
          TIMEOUT = 15
          REQUEST_RETRY_TIMEBOX = 8
    Severity: Minor
    Found in lib/knapsack_pro/client/connection.rb - About 2 hrs to fix

      Method run_tests has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def self.run_tests(accumulator)
                runner = accumulator.fetch(:runner)
                can_initialize_queue = accumulator.fetch(:can_initialize_queue)
                args = accumulator.fetch(:args)
                exitstatus = accumulator.fetch(:exitstatus)
      Severity: Minor
      Found in lib/knapsack_pro/runners/queue/minitest_runner.rb - About 1 hr to fix

        Method make_request has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def make_request(&block)
                retries ||= 0
        
                @http_response = block.call
                @response_body = parse_response_body(http_response.body)
        Severity: Minor
        Found in lib/knapsack_pro/client/connection.rb - About 1 hr to fix

          Method run_tests has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def self.run_tests(accumulator)
                    runner = accumulator.fetch(:runner)
                    can_initialize_queue = accumulator.fetch(:can_initialize_queue)
                    args = accumulator.fetch(:args)
                    exitstatus = accumulator.fetch(:exitstatus)
          Severity: Minor
          Found in lib/knapsack_pro/runners/queue/cucumber_runner.rb - About 1 hr to fix

            Method generate_json_report has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def generate_json_report
                    require 'rspec/core'
            
                    cli_format =
                      if Gem::Version.new(::RSpec::Core::Version::STRING) < Gem::Version.new('3.6.0')
            Severity: Minor
            Found in lib/knapsack_pro/test_case_detectors/rspec_test_example_detector.rb - About 1 hr to fix

              Method test_file_paths has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def test_file_paths(can_initialize_queue, executed_test_files)
                    return [] if @fallback_activated
                    action = build_action(can_initialize_queue, attempt_connect_to_queue: can_initialize_queue)
                    connection = KnapsackPro::Client::Connection.new(action)
                    response = connection.call
              Severity: Minor
              Found in lib/knapsack_pro/queue_allocator.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 test_file_paths has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def test_file_paths
                    action = build_action(cache_read_attempt: true)
                    connection = KnapsackPro::Client::Connection.new(action)
                    response = connection.call
              
              
              Severity: Minor
              Found in lib/knapsack_pro/allocator.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 test_file_paths has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def test_file_paths(can_initialize_queue, executed_test_files)
                    return [] if @fallback_activated
                    action = build_action(can_initialize_queue, attempt_connect_to_queue: can_initialize_queue)
                    connection = KnapsackPro::Client::Connection.new(action)
                    response = connection.call
              Severity: Minor
              Found in lib/knapsack_pro/queue_allocator.rb - About 1 hr to fix

                Method ci_provider has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                        def ci_provider
                          return 'AWS CodeBuild' if ENV.key?('CODEBUILD_BUILD_ARN')
                          return 'Azure Pipelines' if ENV.key?('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI')
                          return 'Bamboo' if ENV.key?('bamboo_planKey')
                          return 'Bitbucket Pipelines' if ENV.key?('BITBUCKET_COMMIT')
                Severity: Minor
                Found in lib/knapsack_pro/config/ci/base.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 knapsack__run_specs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                        def knapsack__run_specs(queue_runner)
                          # Based on:
                          # https://github.com/rspec/rspec-core/blob/f8c8880dabd8f0544a6f91d8d4c857c1bd8df903/lib/rspec/core/world.rb#L53
                          ordering_strategy = configuration.ordering_registry.fetch(:global)
                          node_examples_passed = true
                Severity: Minor
                Found in lib/knapsack_pro/extensions/rspec_extension.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 test_file_paths has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def test_file_paths
                      action = build_action(cache_read_attempt: true)
                      connection = KnapsackPro::Client::Connection.new(action)
                      response = connection.call
                
                
                Severity: Minor
                Found in lib/knapsack_pro/allocator.rb - About 1 hr to fix

                  Method run_tests has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def self.run_tests(accumulator)
                            runner = accumulator.fetch(:runner)
                            can_initialize_queue = accumulator.fetch(:can_initialize_queue)
                            args = accumulator.fetch(:args)
                            exitstatus = accumulator.fetch(:exitstatus)
                  Severity: Minor
                  Found in lib/knapsack_pro/runners/queue/minitest_runner.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 prepare_cli_args has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          def prepare_cli_args(args, has_format_option, has_require_rails_helper_option, rails_helper_exists, test_dir)
                  Severity: Minor
                  Found in lib/knapsack_pro/pure/queue/rspec_pure.rb - About 35 mins to fix

                    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def initialize(adapter_class, rspec_pure, args, stream_error, stream_out)
                    Severity: Minor
                    Found in lib/knapsack_pro/runners/queue/rspec_runner.rb - About 35 mins to fix

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

                            def self.test_path(object)
                              if ::Cucumber::VERSION.to_i >= 2
                                test_case = object
                                test_case.location.file
                              else
                      Severity: Minor
                      Found in lib/knapsack_pro/adapters/cucumber_adapter.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 run_tests has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def self.run_tests(accumulator)
                                runner = accumulator.fetch(:runner)
                                can_initialize_queue = accumulator.fetch(:can_initialize_queue)
                                args = accumulator.fetch(:args)
                                exitstatus = accumulator.fetch(:exitstatus)
                      Severity: Minor
                      Found in lib/knapsack_pro/runners/queue/cucumber_runner.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 with_batch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def with_batch
                                can_initialize_queue = true
                      
                                loop do
                                  handle_signal!
                      Severity: Minor
                      Found in lib/knapsack_pro/runners/queue/rspec_runner.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 group_test_files_by_directory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def group_test_files_by_directory
                            sorted_test_files.each do |test_file|
                              found = false
                              DIR_TYPES.each do |type|
                                if test_file['path'].match(/#{type}/)
                      Severity: Minor
                      Found in lib/knapsack_pro/test_flat_distributor.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