Showing 31 of 31 total issues
Class SSH
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class SSH < Actor
attr_accessor :options #:nodoc:
class SSHCommandFailure < StandardError #:nodoc:
attr_accessor :details
Class Package
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Package #:nodoc:
attr_accessor :name, :provides, :verifications
attr_internal :args, :opts
cattr_reader :installer_methods
@@installer_methods = []
Class Installer
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Installer
include Sprinkle::Attributes
include Sprinkle::Sudo
delegate :version, :to => :package
Class Source
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Source < Installer
attr_accessor :source #:nodoc:
api do
def source(source, options = {}, &block)
Method setup_rendering
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def setup_rendering
ActiveSupport::Deprecation.warn("transfer :render is depreciated, please use the `file` installer now.")
ActiveSupport::Deprecation.warn("transfer :render will be removed from Sprinkle v0.8")
if @options[:render]
raise "Incompatible combination of options :render and :tarball" if tarball?
- 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 channel_runner
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def channel_runner(session, command) #:nodoc:
session.open_channel do |channel|
channel.on_data do |ch, data|
@log_recorder.log :out, data
logger.debug yellow("[#{session.host}] stdout said-->\n#{data}\n")
- 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 process_with_transfer
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process_with_transfer(name, commands, roles, opts ={}) #:nodoc:
raise "cant do non recursive file transfers, sorry" if opts[:recursive] == false
commands = commands.map{|x| x == :TRANSFER ? x : "sudo #{x}" } if sudo?
i = commands.index(:TRANSFER)
before = commands.first(i).join(" && ")
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(parent, source, destination, options = {}, &block) #:nodoc:
options.reverse_merge! :recursive => true
@source = source # Original source
@sourcepath = source # What the actor will transfer (may be the same as @source)
- 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 channel_runner
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def channel_runner(session, command) #:nodoc:
session.open_channel do |channel|
channel.on_data do |ch, data|
@log_recorder.log :out, data
logger.debug yellow("[#{session.host}] stdout said-->\n#{data}\n")
Method process
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def process(roles, pre = false) #:nodoc:
description = @description.empty? ? " (#{@package.name})" : @description
if logger.debug?
logger.debug "#{@package.name}#{description} verification sequence: #{@commands.join('; ')} for roles: #{roles}\n"
- 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 process
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def process(name, commands, roles, opts = {}) #:nodoc:
inst=@installer
@log_recorder = log_recorder = Sprinkle::Utility::LogRecorder.new
commands = commands.map {|x| rewrite_command(x)}
define_task(name, roles) 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 multi_attributes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def multi_attributes(*list)
list.each do |a|
define_method a do |*val|
val = val.try(:first)
return @options[a] unless val
- 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 prepare_commands
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def prepare_commands(commands) #:nodoc:
return commands unless sudo?
commands.map do |command|
next command if command.is_a?(Symbol) || command.is_a?(Sprinkle::Commands::Command)
command.match(/^#{sudo_command}/) ? command : "#{sudo_command} #{command}"
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
module Installers
# = Npm package Installed
#
# Installs an npm module
#
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 40.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(parent, regex, text, path, options={}, &block) #:nodoc:
Method tree_for_packages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def tree_for_packages(packages, opts={}, &block)
depth = opts[:depth]
tree = []
packages.each do |dep, config|
package = PACKAGES.find_all(dep, config)
- 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 attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attributes(*list)
list.each do |a|
define_method a do |*val|
val=nil if val.empty?
val ? @options[a] = val.first : @options[a] || read_from_package(a)
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
module Installers
# = Pear package installed
#
# Installs the specified pear package
#
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 40.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(parent, text, path, options={}, &block) #:nodoc:
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(parent, source, destination, options = {}, &block) #:nodoc: