Showing 8 of 10 total issues
Class Add
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Add < TTY::Cmd
include PathHelpers
attr_reader :app_name
Method execute
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def execute(input: $stdin, output: $stdout)
validate_pwd
validate_cmd_name(cmd_name)
test_dir = (options["test"] == "rspec") || ::Dir.exist?("spec") ? "spec" : "test"
- 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 execute
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def execute(input: $stdin, output: $stdout)
output.puts "OPTS: #{options}" if options["debug"]
coc_opt = options["coc"] ? "--coc" : "--no-coc"
ext_opt = options["ext"] ? "--ext" : "--no-ext"
- 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 execute
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(input: $stdin, output: $stdout)
validate_pwd
validate_cmd_name(cmd_name)
test_dir = (options["test"] == "rspec") || ::Dir.exist?("spec") ? "spec" : "test"
File add.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "ostruct"
require_relative "../cmd"
require_relative "../templater"
Method execute
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(input: $stdin, output: $stdout)
output.puts "OPTS: #{options}" if options["debug"]
coc_opt = options["coc"] ? "--coc" : "--no-coc"
ext_opt = options["ext"] ? "--ext" : "--no-ext"
Method format_gem_dependencies
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def format_gem_dependencies(dependencies = gemspec_dependencies)
gems = []
indent = " " * pre_var_indent
dependencies.each do |gem|
if gem.comment
- 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 cmd_desc_args
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cmd_desc_args
return "" unless @options[:args].any?
" " + @options[:args].map do |arg|
if arg.start_with?("*")
- 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"