Showing 33 of 33 total issues
Class Env
has 58 methods (exceeds 20 allowed). Consider refactoring. Open
class Env
LOG_LEVELS = {
'fatal' => ::Logger::FATAL,
'error' => ::Logger::ERROR,
'warn' => ::Logger::WARN,
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)
- Read upRead up
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 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Connection
class ServerError < StandardError; end
TIMEOUT = 15
REQUEST_RETRY_TIMEBOX = 8
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)
Method generate_json_report
has 38 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')
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)
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)
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
- Read upRead up
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
- Read upRead up
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
Method call
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.call(test_files)
total_execution_time = test_files.sum { |test_file| test_file.fetch('time_execution') }
time_threshold = (total_execution_time / KnapsackPro::Config::Env.ci_node_total) * TIME_THRESHOLD_PER_CI_NODE
test_files.select do |test_file|
- Read upRead up
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 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')
- Read upRead up
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
- Read upRead up
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
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)
- Read upRead up
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)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(adapter_class, rspec_pure, args, stream_error, stream_out)
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)
- Read upRead up
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!
- Read upRead up
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_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
- Read upRead up
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"