Showing 50 of 50 total issues
File aozora2html.rb
has 1112 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'aozora2html/version'
require_relative 'extensions'
require_relative 'aozora2html/error'
require_relative 'aozora2html/i18n'
require_relative 'aozora2html/midashi_counter'
Consider simplifying this complex logical expression. Open
if ((code >= '81ad') && (code <= '81b7')) ||
((code >= '81c0') && (code <= '81c7')) ||
((code >= '81cf') && (code <= '81d9')) ||
((code >= '81e9') && (code <= '81ef')) ||
((code >= '81f8') && (code <= '81fb')) ||
Method illegal_char_check
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
def illegal_char_check(char, line)
return unless char.is_a?(String)
code = char.unpack1('H*')
if (code == '21') ||
- 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 Aozora2Html
has 63 methods (exceeds 20 allowed). Consider refactoring. Open
class Aozora2Html
# 全角バックスラッシュが出せないから直打ち
KU = ['18e5'].pack('h*').force_encoding('shift_jis')
NOJI = ['18f5'].pack('h*').force_encoding('shift_jis')
DAKUTEN = ['18d8'].pack('h*').force_encoding('shift_jis')
Method rearrange_ruby
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
def self.rearrange_ruby(parser, targets, upper_ruby, under_ruby)
unless include_ruby?(targets)
return Aozora2Html::Tag::Ruby.new(parser, targets, upper_ruby, under_ruby)
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 exec_style
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def exec_style(targets, command)
try_kuten = kuten2png(command)
if try_kuten != command
try_kuten
elsif command.match?(TCY_COMMAND)
- 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
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def parse
loop do
first = read_char
found = Aozora2Html::ACCENT_TABLE[first]
- 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 exec_block_start_command
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def exec_block_start_command(command)
original_command = command.dup
command.sub!(/^#{OPEN_MARK}/o, '')
match_buf = +''
if command.match?(INDENT_TYPE[:jisage])
- 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 exec_inline_start_command
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec_inline_start_command(command)
case command
when CHUUKI_COMMAND
@style_stack.push([command, '</ruby>'])
push_char('<ruby><rb>')
Method search_front_reference
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def search_front_reference(string)
if string.length == 0
return false
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
Consider simplifying this complex logical expression. Open
if (code == '21') ||
(code == '23') ||
((code >= 'a1') && (code <= 'a5')) ||
((code >= '28') && (code <= '29')) ||
(code == '5b') ||
Method exec_inline_start_command
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def exec_inline_start_command(command)
case command
when CHUUKI_COMMAND
@style_stack.push([command, '</ruby>'])
push_char('<ruby><rb>')
- 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 rearrange_ruby
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.rearrange_ruby(parser, targets, upper_ruby, under_ruby)
unless include_ruby?(targets)
return Aozora2Html::Tag::Ruby.new(parser, targets, upper_ruby, under_ruby)
end
Method exec_block_start_command
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec_block_start_command(command)
original_command = command.dup
command.sub!(/^#{OPEN_MARK}/o, '')
match_buf = +''
if command.match?(INDENT_TYPE[:jisage])
Method exec_style
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec_style(targets, command)
try_kuten = kuten2png(command)
if try_kuten != command
try_kuten
elsif command.match?(TCY_COMMAND)
Method dispatch_aozora_command
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def dispatch_aozora_command
# 「[」の次が「#」でなければ注記ではない
if @stream.peek_char(0) != IGETA_MARK
return COMMAND_BEGIN
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 parse
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse
loop do
first = read_char
found = Aozora2Html::ACCENT_TABLE[first]
Method search_front_reference
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_front_reference(string)
if string.length == 0
return false
end
Method build_header_info
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def build_header_info
header_info = { title: @header[0] }
case @header.length
when 2
process_person(@header[1], header_info)
- 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 illegal_char_check
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def illegal_char_check(char, line)
return unless char.is_a?(String)
code = char.unpack1('H*')
if (code == '21') ||