lib/rdoc/parser/changelog.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method parse_entries has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_entries
    @time_cache ||= {}

    if /\A((?:.*\n){,3})commit\s/ =~ @content
      class << self; prepend Git; end
Severity: Minor
Found in lib/rdoc/parser/changelog.rb - About 2 hrs 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_entries has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_entries
    @time_cache ||= {}

    if /\A((?:.*\n){,3})commit\s/ =~ @content
      class << self; prepend Git; end
Severity: Minor
Found in lib/rdoc/parser/changelog.rb - About 1 hr to fix

    Method initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(base, commit, author, email, date, contents)
            case contents
            when String
              contents = RDoc::Markdown.parse(contents).parts.each do |body|
                case body
    Severity: Minor
    Found in lib/rdoc/parser/changelog.rb - About 55 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 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(base, commit, author, email, date, contents)
    Severity: Minor
    Found in lib/rdoc/parser/changelog.rb - About 45 mins to fix

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

        def parse_date(date)
          case date
          when /\A\s*(\d+)-(\d+)-(\d+)(?:[ T](\d+):(\d+):(\d+) *([-+]\d\d):?(\d\d))?\b/
            Time.new($1, $2, $3, $4, $5, $6, ("#{$7}:#{$8}" if $7))
          when /\A\s*\w{3}, +(\d+) (\w{3}) (\d+) (\d+):(\d+):(\d+) *(?:([-+]\d\d):?(\d\d))\b/
      Severity: Minor
      Found in lib/rdoc/parser/changelog.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 continue_entry_body has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def continue_entry_body entry_body, continuation
          return unless last = entry_body.last
      
          if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then
            last.sub!(/\)\s*\z/, ',')
      Severity: Minor
      Found in lib/rdoc/parser/changelog.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

      There are no issues that match your filters.

      Category
      Status