serverkit/serverkit

View on GitHub

Showing 8 of 8 total issues

Class Base has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Base
      class << self
        attr_writer :abstract_class

        def abstract_class?
Severity: Minor
Found in lib/serverkit/resources/base.rb - About 3 hrs to fix

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

        class BaseLoader
          YAML_EXTNAMES = [".yaml", ".yml"].freeze
    
          # @param [String] path
          def initialize(path)
    Severity: Minor
    Found in lib/serverkit/loaders/base_loader.rb - About 2 hrs to fix

      Method apply has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

            def apply
              if has_correct_user?
                update_user_encrypted_password unless has_correct_password?
                update_user_gid unless has_correct_gid?
                update_user_home_directory unless has_correct_home_directory?
      Severity: Minor
      Found in lib/serverkit/resources/user.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 apply has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def apply
              update_entry unless has_correct_entry?
              update_group unless has_correct_group?
              update_mode unless has_correct_mode?
              update_owner unless has_correct_owner?
      Severity: Minor
      Found in lib/serverkit/resources/entry.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 check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def check
              if !has_correct_user?
                false
              elsif !has_correct_gid?
                false
      Severity: Minor
      Found in lib/serverkit/resources/user.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

      Method move_remote_file_keeping_destination_metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def move_remote_file_keeping_destination_metadata(source, destination)
              group = run_command_from_identifier(:get_file_owner_group, destination).stdout.rstrip
              mode = run_command_from_identifier(:get_file_mode, destination).stdout.rstrip
              owner = run_command_from_identifier(:get_file_owner_user, destination).stdout.rstrip
              run_command_from_identifier(:change_file_group, source, group) unless group.empty?
      Severity: Minor
      Found in lib/serverkit/resources/base.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 run_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def run_command(command)
              logger.debug("Running #{command} on #{host}")
              specinfra_backend.run_command(command).tap do |result|
                logger.debug(result.stdout) unless result.stdout.empty?
                logger.debug(result.stderr) unless result.stderr.empty?
      Severity: Minor
      Found in lib/serverkit/backends/base_backend.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 update_remote_file_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def update_remote_file_content(content: nil, path: nil)
              group = run_command_from_identifier(:get_file_owner_group, path).stdout.rstrip
              mode = run_command_from_identifier(:get_file_mode, path).stdout.rstrip
              owner = run_command_from_identifier(:get_file_owner_user, path).stdout.rstrip
              create_remote_file(content: content, path: path)
      Severity: Minor
      Found in lib/serverkit/resources/base.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