sprinkle-tool/sprinkle

View on GitHub

Showing 25 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
Severity: Minor
Found in lib/sprinkle/actors/ssh.rb - About 4 hrs to fix

    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 = []
    Severity: Minor
    Found in lib/sprinkle/package.rb - About 3 hrs to fix

      Class Installer has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Installer
            include Sprinkle::Attributes
            include Sprinkle::Sudo
      
            delegate :version, :to => :package
      Severity: Minor
      Found in lib/sprinkle/installers/installer.rb - About 2 hrs to fix

        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)
        Severity: Minor
        Found in lib/sprinkle/installers/source.rb - About 2 hrs to fix

          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?
          Severity: Minor
          Found in lib/sprinkle/installers/transfer.rb - About 1 hr to fix

          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")
          Severity: Minor
          Found in lib/sprinkle/actors/ssh.rb - About 1 hr to fix

          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)
          Severity: Minor
          Found in lib/sprinkle/installers/transfer.rb - About 1 hr to fix

          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(" && ")
          Severity: Minor
          Found in lib/sprinkle/actors/vlad.rb - About 1 hr to fix

          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")
          Severity: Minor
          Found in lib/sprinkle/actors/ssh.rb - About 1 hr to fix

            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"
            Severity: Minor
            Found in lib/sprinkle/verify.rb - About 1 hr to fix

            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
            Severity: Minor
            Found in lib/sprinkle/actors/capistrano.rb - About 1 hr to fix

            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
            Severity: Minor
            Found in lib/sprinkle/extensions/attributes.rb - About 55 mins to fix

            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}"
            Severity: Minor
            Found in lib/sprinkle/actors/ssh.rb - About 55 mins to fix

            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)
            Severity: Minor
            Found in lib/sprinkle/extensions/attributes.rb - About 45 mins to fix

            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 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def initialize(parent, regex, text, path, options={}, &block) #:nodoc:
            Severity: Minor
            Found in lib/sprinkle/installers/replace_text.rb - About 45 mins to fix

              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)
              Severity: Minor
              Found in lib/sprinkle/package.rb - About 45 mins to fix

              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 replace_text has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def replace_text(regex, text, path, options={}, &block)
              Severity: Minor
              Found in lib/sprinkle/installers/replace_text.rb - About 35 mins to fix

                Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def initialize(parent, source, destination, options = {}, &block) #:nodoc:
                Severity: Minor
                Found in lib/sprinkle/installers/transfer.rb - About 35 mins to fix

                  Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def initialize(parent, text, path, options={}, &block) #:nodoc:
                  Severity: Minor
                  Found in lib/sprinkle/installers/push_text.rb - About 35 mins to fix

                    Method initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def initialize(&block) #:nodoc:
                            @installer = nil
                            @config = ::Capistrano::Configuration.new
                            @config.logger.level = Sprinkle::OPTIONS[:verbose] ? ::Capistrano::Logger::INFO : ::Capistrano::Logger::IMPORTANT
                            @config.set(:password) { ::Capistrano::CLI.password_prompt }
                    Severity: Minor
                    Found in lib/sprinkle/actors/capistrano.rb - About 35 mins to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language