aozorahack/aozora2html

View on GitHub

Showing 50 of 50 total issues

Method include_ruby? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def self.include_ruby?(array)
        array.index do |elt|
          case elt
          when Aozora2Html::Tag::Ruby
            true
Severity: Minor
Found in lib/aozora2html/tag/ruby.rb - About 35 mins to fix

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 implicit_close has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def implicit_close(type)
    return unless @indent_stack.last

    if check_close_match(type)
      # ok, nested multiline tags, go ahead
Severity: Minor
Found in lib/aozora2html.rb - About 25 mins to fix

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_chitsuki has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_chitsuki(string, multiline: false)
    if string.match?(CLOSE_MARK + INDENT_TYPE[:chitsuki] + END_MARK) ||
       string.match?(CLOSE_MARK + JIAGE_COMMAND + END_MARK)
      explicit_close(:chitsuki)
      @indent_stack.pop
Severity: Minor
Found in lib/aozora2html.rb - About 25 mins to fix

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 t has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.t(msg, *args)
      if Aozora2Html::I18n.use_utf8
        args_sjis = args.map { |arg| arg.is_a?(String) ? arg.to_sjis : arg }
        (MSG[msg].to_sjis % args_sjis).force_encoding('cp932').to_utf8
      else
Severity: Minor
Found in lib/aozora2html/i18n.rb - About 25 mins to fix

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 judge_chuuki has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def judge_chuuki
    # 注記が入るかどうかチェック
    i = 0
    loop do
      case @stream.peek_char(i)
Severity: Minor
Found in lib/aozora2html.rb - About 25 mins to fix

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 6 (exceeds 5 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'))
Severity: Minor
Found in lib/aozora2html.rb - About 25 mins to fix

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_gaiji has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def dispatch_gaiji
    # 「※」の次が「[」でなければ外字ではない
    if @stream.peek_char(0) != COMMAND_BEGIN
      return GAIJI_MARK
    end
Severity: Minor
Found in lib/aozora2html.rb - About 25 mins to fix

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_body has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_body
    char = read_char
    check = true
    case char
    when ACCENT_BEGIN
Severity: Minor
Found in lib/aozora2html.rb - About 25 mins to fix

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_jisage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_jisage(command)
    if command.match?(MADE_MARK) || command.match?(END_MARK)
      # 字下げ終わり
      explicit_close(:jisage)
      @indent_stack.pop
Severity: Minor
Found in lib/aozora2html.rb - About 25 mins to fix

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_end_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def exec_block_end_command(command)
    original_command = command.dup
    command.sub!(/^#{CLOSE_MARK}/o, '')
    matched = false
    mode = detect_command_mode(command)
Severity: Minor
Found in lib/aozora2html.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language