Showing 8 of 10 total issues
Method convert_codeblock
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def convert_codeblock(el, opts)
show_whitespace = el.attr['class'].to_s =~ /\bshow-whitespaces\b/
lang = extract_code_language(el.attr)
if @options[:syntax_highlighter] == :minted &&
- 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 apply_params
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_params(params)
@maker.title = params[:title]
add_creator(params[:author])
parse_creator(params[:creator])
##@maker.language = params[:language] || 'ja'
Method convert_img
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def convert_img(el, opts)
line = el.options[:location]
angle = @options[:page_direction] == "rtl" ? 90 : 0
if el.attr['src'] =~ /^(https?|ftps?):\/\//
warning("Cannot include non-local image#{line ? " (line #{line})" : ''}")
- 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 execute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
params = {}
if config
params = YAML.safe_load(config).symbolize_keys!
end
Method apply_params
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_params(params)
@book.identifier = params[:id] || "urn:uuid:#{SecureRandom.uuid}"
@book.title = params[:title]
@book.add_creator(params[:author])
parse_creator(params[:creator])
Method apply_params
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def apply_params(params)
@maker.title = params[:title]
add_creator(params[:author])
parse_creator(params[:creator])
##@maker.language = params[:language] || 'ja'
- 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 interpolate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def interpolate(str, values)
return "" if str.nil?
str.gsub(INTERPOLATION_PATTERN) do |match|
if match == '%%'
'%'
- 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 deep_merge!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deep_merge!(other_hash, &block)
merge!(other_hash) do |key, this_val, other_val|
if this_val.is_a?(Hash) && other_val.is_a?(Hash)
this_val.dup.deep_merge!(other_val, &block)
elsif block_given?
- 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"