brgmnn/sandboxy

View on GitHub
lib/sandboxy/commands/run.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

  def run
    results = Hash.new { |hash, key| hash[key] = {} }

    progress paths do |path|
      id = path.split('/')[-2]
Severity: Minor
Found in lib/sandboxy/commands/run.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 run has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    results = Hash.new { |hash, key| hash[key] = {} }

    progress paths do |path|
      id = path.split('/')[-2]
Severity: Minor
Found in lib/sandboxy/commands/run.rb - About 1 hr to fix

    Block has too many lines. [39/25]
    Open

        progress paths do |path|
          id = path.split('/')[-2]
          file, slug, ext = Sandboxy::Path.new(path).info
    
          # Skip any files which do not have a supported file extension
    Severity: Minor
    Found in lib/sandboxy/commands/run.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Re-enable Metrics/MethodLength cop with # rubocop:enable after disabling it.
    Open

    # rubocop:disable Metrics/MethodLength
    Severity: Minor
    Found in lib/sandboxy/commands/run.rb by rubocop

    Re-enable Metrics/AbcSize cop with # rubocop:enable after disabling it.
    Open

    # rubocop:disable Metrics/AbcSize
    Severity: Minor
    Found in lib/sandboxy/commands/run.rb by rubocop

    There are no issues that match your filters.

    Category
    Status