yuri-karpovich/console_runner

View on GitHub

Showing 7 of 7 total issues

Method run has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

  def run(action)
    maybe_help(tool_banner, action ? action.name.to_s : nil)
    raise ConsoleRunnerError, 'Cannot find any @runnable action' unless action
    raise_on_action_absence @sub_commands
    @initialize_method ||= MethodParser.new(@file_parser.initialize_method) if @file_parser.initialize_method
Severity: Minor
Found in lib/command_line_parser.rb - About 4 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 run has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run(action)
    maybe_help(tool_banner, action ? action.name.to_s : nil)
    raise ConsoleRunnerError, 'Cannot find any @runnable action' unless action
    raise_on_action_absence @sub_commands
    @initialize_method ||= MethodParser.new(@file_parser.initialize_method) if @file_parser.initialize_method
Severity: Minor
Found in lib/command_line_parser.rb - About 1 hr to fix

    Method prepare_opts_for_optimist has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def prepare_opts_for_optimist
        result = []
        param_tags.each do |tag|
          tag_name = tag.name
          tag_text = tag.text
    Severity: Minor
    Found in lib/method_parser.rb - About 1 hr to fix

      Method params_array has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def params_array
          options_groups = {}
          get_params     = {}
          @parameters.map(&:first).map.with_index { |p, i| [i, p] }.to_h.each do |index, name|
            if options_group?(name)
      Severity: Minor
      Found in lib/method_parser.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 default_params has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def default_params
          @parameters.to_a.map do |array|
            array.map do |a|
              if a
                ['"', "'"].include?(a[0]) && ['"', "'"].include?(a[-1]) ? a[1..-2] : a
      Severity: Minor
      Found in lib/method_parser.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 list_methods has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def list_methods(scope = :all, clazz = nil)
          all_methods       = @all_objects.select { |o| o.type == :method }
          all_class_methods = []
          all_class_methods = clazz.children.select { |m| m.class == YARD::CodeObjects::MethodObject } if clazz
      
      
      Severity: Minor
      Found in lib/file_parser.rb - About 45 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 prepare_opts_for_optimist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def prepare_opts_for_optimist
          result = []
          param_tags.each do |tag|
            tag_name = tag.name
            tag_text = tag.text
      Severity: Minor
      Found in lib/method_parser.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

      Severity
      Category
      Status
      Source
      Language