jonatas/fast

View on GitHub
lib/fast/cli.rb

Summary

Maintainability
B
6 hrs
Test Coverage
B
85%

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

    def run!
      raise 'pry and parallel options are incompatible :(' if @parallel && @pry

      if @help || @files.empty? && @pattern.nil?
        puts option_parser.help
Severity: Minor
Found in lib/fast/cli.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 option_parser has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def option_parser # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
      @option_parser ||= OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
        opts.banner = 'Usage: fast expression <files> [options]'
        opts.on('-d', '--debug', 'Debug fast engine') do
          @debug = true
Severity: Major
Found in lib/fast/cli.rb - About 2 hrs to fix

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

      def report(result, show_link: false, show_permalink: false, show_sexp: false, file: nil, headless: false, bodyless: false, colorize: true) # rubocop:disable Metrics/ParameterLists
        if file
          line = result.loc.expression.line if result.is_a?(Parser::AST::Node)
          if show_link
            puts(result.link)
    Severity: Minor
    Found in lib/fast/cli.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 highlight has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def highlight(node, show_sexp: false, colorize: true, sql: false)
        output =
          if node.respond_to?(:loc) && !show_sexp
            wrap_source_range(node).source
          else
    Severity: Minor
    Found in lib/fast/cli.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

    There are no issues that match your filters.

    Category
    Status