Class Cli
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Cli < Thor
autoload :ManifestPresenter, "librarian/cli/manifest_presenter"
include Thor::Actions
Method config
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def config(key = nil, value = nil)
if key
raise Error, "cannot set both value and delete" if value && options["delete"]
if options["delete"]
scope = config_scope(true)
- 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 config_scope
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def config_scope(exclusive)
g, l = "global", "local"
if exclusive
options[g] ^ options[l] or raise Error, "must set either #{g} or #{l}"
else
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*)
super
the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
environment.ui = UI::Shell.new(the_shell)
environment.ui.be_quiet! if options["quiet"]
- 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"