sprinkle-tool/sprinkle

View on GitHub

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
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 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 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 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              module Installers
                # = Npm package Installed
                #
                # Installs an npm module
                #
            Severity: Minor
            Found in lib/sprinkle/installers/npm.rb and 1 other location - About 45 mins to fix
            lib/sprinkle/installers/pear.rb on lines 2..35

            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

            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 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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                module Installers
                  # = Pear package installed
                  #
                  # Installs the specified pear package
                  #
              Severity: Minor
              Found in lib/sprinkle/installers/pear.rb and 1 other location - About 45 mins to fix
              lib/sprinkle/installers/npm.rb on lines 2..38

              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

              Further Reading

              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 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
                  Severity
                  Category
                  Status
                  Source
                  Language