lib/sandboxy/commands/run.rb
Method run
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
def run
results = Hash.new { |hash, key| hash[key] = {} }
progress paths do |path|
id = path.split('/')[-2]
- Read upRead up
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
Open
def run
results = Hash.new { |hash, key| hash[key] = {} }
progress paths do |path|
id = path.split('/')[-2]
Block has too many lines. [39/25] Open
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
- Read upRead up
- Exclude checks
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
Open
# rubocop:disable Metrics/MethodLength
- Exclude checks
Re-enable Metrics/AbcSize cop with # rubocop:enable
after disabling it. Open
Open
# rubocop:disable Metrics/AbcSize
- Exclude checks