Showing 7 of 9 total issues
Method config
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def config
return @config unless @config.nil?
@config = {}
git('config --null --get-regexp "^mestral"').split("\0").
- 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 add_tape
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_tape(url)
name = $1 if url =~ /(?:git|https?):\/\/github\.com\/(\w+\/\w+)(?:\.git)?$/
name ||= options[:name]
name ||= File.basename(url, '.git')
tape = Mestral::Tape.new name
- 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 list
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def list
if options[:enabled]
hooks = repository.hooks
else
hooks = Mestral::Tape.all.map(&:hooklets).flatten.compact
- 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 initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(repo, name)
super
@hooklets = []
(repo.config['hooks'] || []).each do |hook, hooklets|
- 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 config
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def config
return @config unless @config.nil?
@config = {}
git('config --null --get-regexp "^mestral"').split("\0").
Method find_hook
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def find_hook(hook_name)
hook = repository.hook hook_name
if hook.is_a? Mestral::Hook::Native
puts "The '#{hook_name}' hook is a native hook and cannot execute hooklets."
- 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 find
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find(repo, name)
raise Mestral::InvalidHook, name unless HOOK_NAMES.include? name
hook_path = File.join repo.hooks_dir, name
return nil unless File.executable? hook_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"