alilee/data_doc

View on GitHub

Showing 5 of 5 total issues

Class Document has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Document
              
    # 
    # :section: 1. Options
    #
Severity: Minor
Found in lib/data_doc/document.rb - About 2 hrs to fix

    Method parse_options has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.parse_options(doc, stdout, arguments)
          OptionParser.new do |opts|
            opts.banner = <<-BANNER.gsub(/^          /,'')
              #{DataDoc::DESCRIPTION}
    
    
    Severity: Major
    Found in lib/data_doc/cli.rb - About 2 hrs to fix

      Method render_body_rows has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_body_rows(h)
            h.tbody {
              @rows.each do |r|
                h.tr {
                  @column_order.each do |col|
      Severity: Minor
      Found in lib/data_doc/present.rb - About 1 hr 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 write_in_format has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_in_format(html)
            html_file = if @format == 'html'
              @output_stream || File.new(@output_filename, 'w+')
            else
              Tempfile.new(['prince','.html'], '.')
      Severity: Minor
      Found in lib/data_doc/document.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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def method_missing(name, *args, &block)
            table_name = name.to_s
            if @stores.has_key?(table_name)
              if args.empty?
                return @stores[table_name].arel
      Severity: Minor
      Found in lib/data_doc/document.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