Showing 16 of 16 total issues

File commands.rb has 623 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'phper'
require "parsedate" if RUBY_VERSION < '1.9'
require "time"
require 'base64'

Severity: Major
Found in lib/phper/commands.rb - About 1 day to fix

    Class Commands has 43 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Phper::Commands < CommandLineUtils::Commands
      include Phper
      attr_reader :commands
      def initialize
        super
    Severity: Minor
    Found in lib/phper/commands.rb - About 5 hrs to fix

      Class Agent has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Phper::Agent
        include Phper
      
        def initialize
          @login = false
      Severity: Minor
      Found in lib/phper/agent.rb - About 3 hrs to fix

        Method logs_tail has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def logs_tail
            project = nil
            server = nil
            name = nil
            OptionParser.new { |opt|
        Severity: Minor
        Found in lib/phper/commands.rb - About 2 hrs 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 init_phper_dir has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.init_phper_dir root
            files = {}
            files[:deploy] = File.join(root,".phper","deploy")
            files[:initdb] = File.join(root,".phper","initdb")
            files[:httpd] = File.join(root,".phper","httpd.conf")
        Severity: Minor
        Found in lib/phper/commands.rb - About 1 hr to fix

          Method destroy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def destroy
              project = nil
              yes = false
              OptionParser.new { |opt|
                opt.on('-y','--yes', 'answer yes for all questions') { |v|
          Severity: Minor
          Found in lib/phper/commands.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 logs_tail has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def logs_tail
              project = nil
              server = nil
              name = nil
              OptionParser.new { |opt|
          Severity: Minor
          Found in lib/phper/commands.rb - About 1 hr to fix

            Method files_get_one has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def files_get_one
                project = nil
                params = {}
                OptionParser.new { |opt|
                  opt.on('-h HOST','--host=HOST', 'host') { |v|
            Severity: Minor
            Found in lib/phper/commands.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 open has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def open
                project = nil
                OptionParser.new { |opt|
                  project = extract_project(opt)
                  @banner = "[<host or name pattern>]"
            Severity: Minor
            Found in lib/phper/commands.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 file_get_modified has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def file_get_modified
                @params ||= {}
                OptionParser.new { |opt|
                  opt.on('-h HOST','--host=HOST', 'host') { |v|
                    @params[:host] = v
            Severity: Minor
            Found in lib/phper/commands.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 servers_add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def servers_add
                param = {}
                project = nil
                name = nil
                OptionParser.new { |opt|
            Severity: Minor
            Found in lib/phper/commands.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 files has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def files
                project = nil
                params = {}
                OptionParser.new { |opt|
                  opt.on('-h HOST','--host=HOST', 'host') { |v|
            Severity: Minor
            Found in lib/phper/commands.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 init_phper_dir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.init_phper_dir root
                files = {}
                files[:deploy] = File.join(root,".phper","deploy")
                files[:initdb] = File.join(root,".phper","initdb")
                files[:httpd] = File.join(root,".phper","httpd.conf")
            Severity: Minor
            Found in lib/phper/commands.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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def start
                @agent.log(STDERR) if @options[:debug]
                return true if @agent.login?
                login unless user
                if user
            Severity: Minor
            Found in lib/phper/commands.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 keys_add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def keys_add
                OptionParser.new { |opt|
                  opt.parse!(@command_options)
                  @summery = "add keys"
                  @banner = "<public key file>"
            Severity: Minor
            Found in lib/phper/commands.rb - About 25 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 versions_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def versions_set
                project = nil
                OptionParser.new { |opt|
                  @summery = "set versions"
                  @banner = "<ver>"
            Severity: Minor
            Found in lib/phper/commands.rb - About 25 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