Showing 8 of 8 total issues
Method run
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
# Clear out previous run
@result = nil
field_stream = FieldStream.new
Method option_parser
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def option_parser
OptionParser.new do |opts|
opts.program_name = program_name
opts.version = Bashcov::VERSION
opts.banner = help
Method complete_coverage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def complete_coverage
lines = File.read(@filename).encode("utf-8", invalid: :replace).lines
lines.each_with_index do |line, lineno|
# multi-line arrays
Method mark_multiline
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mark_multiline(lines, lineno, regexp, forward: true)
seek_forward = lines[lineno..].join
return unless (multiline_match = seek_forward.match(regexp))
length = multiline_match.to_s.count($/)
- 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 update_wd_stacks!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_wd_stacks!(pwd, oldpwd)
@pwd_stack[0] ||= pwd
@oldpwd_stack[0] ||= oldpwd unless oldpwd.to_s.empty?
# We haven't changed working directories; short-circuit.
- 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 option_parser
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def option_parser
OptionParser.new do |opts|
opts.program_name = program_name
opts.version = Bashcov::VERSION
opts.banner = help
- 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 parse_hit!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_hit!(lineno, *paths)
# If +LINENO+ isn't a series of digits, something has gone wrong. Add
# +@files+ to the exception in order to propagate the existing coverage
# data back to the {Bashcov::Runner} instance.
if /\A\d+\z/.match?(lineno)
- 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 shellscript_shebang_line?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def shellscript_shebang_line?(shebang)
scanner = StringScanner.new(shebang)
begin
return false if scanner.scan(/#!\s*/).nil?
- 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"