Showing 42 of 46 total issues
Class Configuration
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class Configuration
attr_accessor :root_paths, :root,
:verbose,
:reporter, :redis_namespace, :redis_ttl,
:background_reporting_enabled,
Method start
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def self.start
return if running?
logger = Coverband.configuration.logger
@semaphore.synchronize do
- 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 report_coverage
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def report_coverage
@semaphore.synchronize do
raise "no Coverband store set" unless @store
files_with_line_usage = filtered_files(Delta.results)
- 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 array_add
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def array_add(latest, original)
if Coverband.configuration.use_oneshot_lines_coverage
latest.map!.with_index { |v, i| ((v + original[i] >= 1) ? 1 : 0) if v && original[i] }
elsif Coverband.configuration.simulate_oneshot_lines_coverage
latest.map.with_index { |v, i| ((v + original[i] >= 1) ? 1 : 0) if v && original[i] }
- 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
File hash_redis_store.rb
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "securerandom"
module Coverband
module Adapters
class HashRedisStore < Base
Class HashRedisStore
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class HashRedisStore < Base
class GetCoverageNullCacheStore
def self.clear!(*_local_types)
end
Class SourceFile
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class SourceFile
# TODO: Refactor Line into its own file
# Representation of a single line in a source file including
# this specific line's source code, line_number and code coverage,
# with the coverage being either nil (coverage not applicable, e.g. comment
Class HTMLFormatter
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class HTMLFormatter
attr_reader :notice, :base_path, :tracker, :page
def initialize(report, options = {})
@notice = options.fetch(:notice, nil)
Method initialize
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def initialize
@semaphore = Mutex.new
raise NotImplementedError, "Coverage needs Ruby > 2.3.0" if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.3.0")
require "coverage"
- 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 AbstractTracker
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractTracker
REPORT_ROUTE = "/"
TITLE = "abstract"
attr_accessor :target
Method call
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
@request = Rack::Request.new(env)
return [401, {"www-authenticate" => 'Basic realm=""'}, [""]] unless check_auth
- 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
File configuration.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Coverband
###
# Configuration parsing and options for the coverband gem.
###
class Configuration
Method generate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def generate
current_coverage.each_with_object({}) do |(file, line_counts), new_results|
###
# Eager filter:
# Normally I would break this out into additional methods
- 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 call
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
@request = Rack::Request.new(env)
return [401, {"www-authenticate" => 'Basic realm=""'}, [""]] unless check_auth
Method reset
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reset
@root = Dir.pwd
@root_paths = []
@ignore = IGNORE_DEFAULTS.dup
@search_paths = TRACKED_DEFAULT_PATHS.dup
Method get_current_scov_data_imp
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_current_scov_data_imp(store, roots, options = {})
scov_style_report = {}
store.get_coverage_report(options).each_pair do |name, data|
data.each_pair do |key, line_data|
next if Coverband.configuration.ignore.any? { |i| key.match(i) }
- 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 report_as_json
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def report_as_json
result = Coverband::Utils::Results.new(filtered_report_files)
source_files = result.source_files
data = {
Method build_response
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def build_response(req)
uri = URI.parse(path(req.path_parameters, req))
unless uri.host
if relative_path?(uri.path)
- 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 track_key
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def track_key(payload)
if (file = payload[:identifier])
if newly_seen_key?(file)
@logged_keys << file
@keys_to_record << file if track_file?(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 railtie!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def railtie!
if Coverband.configuration.track_routes
Coverband.configuration.route_tracker = Coverband::Collectors::RouteTracker.new
trackers << Coverband.configuration.route_tracker
end
- 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"