cloudamatic/mu

View on GitHub

Showing 255 of 2,705 total issues

Method genPolicyDocument has a Cognitive Complexity of 93 (exceeds 75 allowed). Consider refactoring.
Open

        def self.genPolicyDocument(policies, deploy_obj: nil, bucket_style: false, version: "2012-10-17", doc_id: nil)
          if policies
            name = nil
            doc = {
              "Version" => version,
Severity: Minor
Found in modules/mu/providers/aws/role.rb - About 3 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 schema has 206 lines of code (exceeds 150 allowed). Consider refactoring.
Open

      def self.schema
        {
          "type" => "object",
          "required" => ["name"],
          "description" => "Create Virtual Private Clouds with custom public or private subnets.",
Severity: Major
Found in modules/mu/config/vpc.rb - About 3 hrs to fix

    Class Server has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class Server < MU::Cloud::Server
    
            # Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like <tt>@vpc</tt>, for us.
            # @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
            def initialize(**args)
    Severity: Minor
    Found in modules/mu/providers/azure/server.rb - About 3 hrs to fix

      Class Role has 27 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Role < MU::Cloud::Role
      
              # Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
              # @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
              def initialize(**args)
      Severity: Minor
      Found in modules/mu/providers/aws/role.rb - About 3 hrs to fix

        Class Ansible has 27 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Ansible
        
              # Failure to load or create a deploy
              class NoAnsibleExecError < MuError;
              end
        Severity: Minor
        Found in modules/mu/groomers/ansible.rb - About 3 hrs to fix

          Method create has 204 lines of code (exceeds 150 allowed). Consider refactoring.
          Open

                  def create
                    labels = Hash[@tags.keys.map { |k|
                      [k.downcase, @tags[k].downcase.gsub(/[^-_a-z0-9]/, '-')] }
                    ]
                    labels["name"] = MU::Cloud::Google.nameStr(@mu_name)
          Severity: Major
          Found in modules/mu/providers/google/container_cluster.rb - About 3 hrs to fix

            Method createResources has a Cognitive Complexity of 92 (exceeds 75 allowed). Consider refactoring.
            Open

                def createResources(services, mode="create")
                  return if services.nil?
            
                  parent_thread_id = Thread.current.object_id
                  services.uniq!
            Severity: Minor
            Found in modules/mu/deploy.rb - About 3 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 schema has 202 lines of code (exceeds 150 allowed). Consider refactoring.
            Open

                    def self.schema(config)
                      toplevel_required = []
                      gke_defaults = defaults
                      schema = {
                        "auto_upgrade" => {
            Severity: Major
            Found in modules/mu/providers/google/container_cluster.rb - About 3 hrs to fix

              Class MommaCat has 26 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class MommaCat
              
                  # An exception denoting a failure in MommaCat#fetchSecret and related methods
                  class SecretError < MuError;
                  end
              Severity: Minor
              Found in modules/mu/mommacat.rb - About 3 hrs to fix

                Class CacheCluster has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                      class CacheCluster < MU::Cloud::CacheCluster
                
                        # Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
                        # @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
                        def initialize(**args)
                Severity: Minor
                Found in modules/mu/providers/aws/cache_cluster.rb - About 2 hrs to fix

                  Class MommaCat has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class MommaCat
                      @myhome = Etc.getpwuid(Process.uid).dir
                      @nagios_home = "/opt/mu/var/nagios_user_home"
                      @locks = Hash.new
                      @deploy_cache = Hash.new
                  Severity: Minor
                  Found in modules/mu/mommacat/storage.rb - About 2 hrs to fix

                    Method groom has 189 lines of code (exceeds 150 allowed). Consider refactoring.
                    Open

                            def groom
                              if @config['notifications'] and @config['notifications']['topic']
                    # XXX expand to a full reference block for a Notification resource
                                arn = if @config['notifications']['topic'].match(/^arn:/)
                                  @config['notifications']['topic']
                    Severity: Major
                    Found in modules/mu/providers/aws/server_pool.rb - About 2 hrs to fix

                      Class Master has 23 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class Master
                          require 'date'
                          require 'colorize'
                          require 'fileutils'
                          autoload :Chef, 'mu/master/chef'
                      Severity: Minor
                      Found in modules/mu/master.rb - About 2 hrs to fix

                        Method validateConfig has a Cognitive Complexity of 88 (exceeds 75 allowed). Consider refactoring.
                        Open

                                def self.validateConfig(cluster, configurator)
                                  ok = true
                                  cluster['project'] ||= MU::Cloud::Google.defaultProject(cluster['credentials'])
                        
                                  cluster['master_az'] ||= cluster['availability_zone'] if cluster['availability_zone']
                        Severity: Minor
                        Found in modules/mu/providers/google/container_cluster.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 toKitten has a Cognitive Complexity of 88 (exceeds 75 allowed). Consider refactoring.
                        Open

                                def toKitten(**_args)
                                  bok = {
                                    "cloud" => "AWS",
                                    "credentials" => @credentials,
                                    "cloud_id" => @cloud_id,
                        Severity: Minor
                        Found in modules/mu/providers/aws/endpoint.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 toKitten has 185 lines of code (exceeds 150 allowed). Consider refactoring.
                        Open

                                def toKitten(**_args)
                        
                                  bok = {
                                    "cloud" => "Google",
                                    "project" => @config['project'],
                        Severity: Major
                        Found in modules/mu/providers/google/container_cluster.rb - About 2 hrs to fix

                          Method genParams has 185 lines of code (exceeds 150 allowed). Consider refactoring.
                          Open

                                  def genParams(ext = nil)
                                    params = {
                                      :domain_name => @config['domain_name'] || @deploydata['domain_name']
                                    }
                          
                          
                          Severity: Major
                          Found in modules/mu/providers/aws/search_domain.rb - About 2 hrs to fix

                            Method schema has 185 lines of code (exceeds 150 allowed). Consider refactoring.
                            Open

                                  def self.schema
                                    {
                                    "type" => "object",
                                    "description" => "Create a dedicated database server.",
                                    "required" => ["name", "engine", "size", "cloud"],
                            Severity: Major
                            Found in modules/mu/config/database.rb - About 2 hrs to fix

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

                                    class Role < MU::Cloud::Role
                              
                                      # Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like <tt>@vpc</tt>, for us.
                                      # @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
                                      def initialize(**args)
                              Severity: Minor
                              Found in modules/mu/providers/google/role.rb - About 2 hrs to fix

                                Method check_dependencies has a Cognitive Complexity of 87 (exceeds 75 allowed). Consider refactoring.
                                Open

                                    def check_dependencies
                                      ok = true
                                
                                      @config.each_pair { |type, values|
                                        next if !values.instance_of?(Array)
                                Severity: Minor
                                Found in modules/mu/config.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

                                Severity
                                Category
                                Status
                                Source
                                Language