Showing 50 of 50 total issues
Method hyoki
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def hyoki
# <br /> times fix
@out.print "<br />\r\n</div>\r\n<div class=\"notation_notes\">\r\n<hr />\r\n<br />\r\n●表記について<br />\r\n<ul>\r\n".to_sjis
@out.print "\t<li>このファイルは W3C 勧告 XHTML1.1 にそった形式で作成されています。</li>\r\n".to_sjis
if @chuuki_table[:chuki]
- 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 general_output
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def general_output
if @style_stack.last
raise Aozora2Html::Error, I18n.t(:dont_crlf_in_style, @style_stack.last_command)
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"
Further reading
Method build_header_info
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_header_info
header_info = { title: @header[0] }
case @header.length
when 2
process_person(@header[1], header_info)
Method general_output
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def general_output
if @style_stack.last
raise Aozora2Html::Error, I18n.t(:dont_crlf_in_style, @style_stack.last_command)
end
Method header_element_type
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def header_element_type(string)
original = true
string.each_char do |ch|
code = ch.unpack1('H*')
if ((code >= '00') && (code <= '7f')) || # 1byte
- 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 dispatch_aozora_command
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dispatch_aozora_command
# 「[」の次が「#」でなければ注記ではない
if @stream.peek_char(0) != IGETA_MARK
return COMMAND_BEGIN
end
Method parse_body
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_body
char = read_char
check = true
case char
when ACCENT_BEGIN
Method hyoki
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hyoki
# <br /> times fix
@out.print "<br />\r\n</div>\r\n<div class=\"notation_notes\">\r\n<hr />\r\n<br />\r\n●表記について<br />\r\n<ul>\r\n".to_sjis
@out.print "\t<li>このファイルは W3C 勧告 XHTML1.1 にそった形式で作成されています。</li>\r\n".to_sjis
if @chuuki_table[:chuki]
Method parse_tail
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_tail
char = read_char
check = true
case char
when ACCENT_BEGIN
Method initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(input, output, gaiji_dir: nil, css_files: nil, use_jisx0213: nil, use_unicode: nil)
@stream = if input.respond_to?(:read) ## readable IO?
Jstream.new(input)
else
Jstream.new(File.open(input, 'rb:Shift_JIS'))
Method exec_frontref_command
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def exec_frontref_command(command)
_whole, reference, spec1, spec2 = command.match(PAT_FRONTREF).to_a
spec = if spec1
spec1 + spec2
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"
Further reading
Method recovery_front_reference
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def recovery_front_reference(reference)
reference.each do |elt|
# if @ruby_buf.protected
if @ruby_buf.present?
@ruby_buf.push(elt)
- 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
Avoid deeply nested control flow statements. Open
case dir
when LEFT_MARK, OVER_MARK
filter = ->(x) { x.sub('under', 'over') }
end
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(parser, filename, css_class, alt, width, height)
Method apply_warichu
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def apply_warichu(command)
if command.match?(END_MARK)
if @stream.peek_char(0) != PAREN_END_MARK
push_char(PAREN_END_MARK)
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"
Further reading
Method process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process
catch(:terminate) do
parse
rescue Aozora2Html::Error => e
puts e.message(line_number)
- 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
Avoid deeply nested control flow statements. Open
if command.match?(TEN_MARK)
case dir
when LEFT_MARK, UNDER_MARK
filter = ->(x) { "#{x}_after" }
end
Consider simplifying this complex logical expression. Open
if ((code >= '00') && (code <= '7f')) || # 1byte
((code >= '8140') && (code <= '8258')) || # 1-1, 3-25
((code >= '839f') && (code <= '8491')) # 6-1, 7-81
# continue
else
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(parser, folder, code, name, unicode_num = nil, gaiji_dir:, use_jisx0213: nil, use_unicode: nil)
Method to_s
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_s
if (Aozora2Html::Tag::EmbedGaiji.use_jisx0213 || @use_jisx0213) && @code
jisx0213_to_unicode(@code.to_sym)
elsif (Aozora2Html::Tag::EmbedGaiji.use_unicode || @use_unicode) && @unicode
"&#x#{@unicode};"
- 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"