Showing 22 of 26 total issues
Method colorize
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def colorize(text, color = "default", bgcolor = "default")
return text unless tty?
colors = {
"default" => "38",
Method colorize
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def colorize(text, color = "default", bgcolor = "default")
return text unless tty?
colors = {
"default" => "38",
Method must_accept_test_as_target
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def must_accept_test_as_target
command = "rake -T"
Dir.chdir(Qansible::Check::Base.root) do
Open3.popen3(command) do |_stdin, stdout, stderr, process|
status = process.value.exitstatus
- 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 should_have_tasks_with_verbs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def should_have_tasks_with_verbs
verbs = %w[
accept add apply archive ask assert bind boot bring build check clean
clone collect commit configure copy correct create deal delete
destroy detect disable do download dump dump enable ensure exclude
- 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 parse
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(options)
args = Qansible::Option::Init.new
args.directory = Pathname.pwd
args.verbose = false
args.box_name = "trombik/ansible-freebsd-12.0-amd64"
Method should_have_tasks_with_verbs
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def should_have_tasks_with_verbs
verbs = %w[
accept add apply archive ask assert bind boot bring build check clean
clone collect commit configure copy correct create deal delete
destroy detect disable do download dump dump enable ensure exclude
Method run
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
raise RoleExist, "Directory `%s` already exists" % [dest_directory] if File.exist?(dest_directory)
Dir.mkdir(dest_directory)
Dir.chdir(dest_directory) do
Method should_have_templates_with_validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def should_have_templates_with_validate
@task_yaml_content.each_key do |file|
yaml = @task_yaml_content[file]
next unless yaml
- 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 should_have_required_sections_at_level_one
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def should_have_required_sections_at_level_one
warnings = []
File.open(@@root + @path, "r") do |f|
f.each_line do |line|
next unless line =~ /^##+\s+(.*)/
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
Dir.mktmpdir do |d|
tmpdir = Pathname.new(d)
warnings = 0
create_reference_tree(tmpdir)
Method must_have_mandatory_keys_in_galaxy_info
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def must_have_mandatory_keys_in_galaxy_info
load_yaml unless @yaml
mandatory_keys = %w[
author
company
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(opts = {})
raise ArgumentError, "BUG: child class passed `%s`, instead of Hash" % [opts.class] unless opts.is_a?(Hash)
valid_options = [
:path
- 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 should_have_tasks_with_name
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def should_have_tasks_with_name
exceptions = %w[
assert
block
debug
- 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run
Dir.mktmpdir do |d|
tmpdir = Pathname.new(d)
warnings = 0
create_reference_tree(tmpdir)
- 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 should_have_tasks_with_capitalized_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def should_have_tasks_with_capitalized_name
@task_yaml_content.each_key do |file|
yaml = @task_yaml_content[file]
next unless yaml
- 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run
raise RoleExist, "Directory `%s` already exists" % [dest_directory] if File.exist?(dest_directory)
Dir.mkdir(dest_directory)
Dir.chdir(dest_directory) do
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(_options)
@logger = Logger.new($stdout)
@logger.level = Logger::DEBUG
@logger.formatter = proc do |severity, _datetime, _progname, msg|
if silent?
- 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 must_have_mandatory_keys_in_galaxy_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def must_have_mandatory_keys_in_galaxy_info
load_yaml unless @yaml
mandatory_keys = %w[
author
company
- 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 check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check
raise_at_end = false
raise_at_end = true unless must_have_all_directories
raise_at_end = true unless must_have_keepme_in_all_directories
raise_at_end = true unless must_not_have_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 validate_role_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_role_name(name)
raise InvalidRoleName, "No role name given" unless name
raise InvalidRoleName, "Invalid role name `%s` given. Role name mus start with `ansible-role`" % [name] unless name =~ /^ansible-role-/
valid_regex = /^[a-zA-Z0-9\-_]+$/
- 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"