cloudamatic/mu

View on GitHub

Showing 255 of 2,705 total issues

Method run has a Cognitive Complexity of 125 (exceeds 75 allowed). Consider refactoring.
Open

      def run(purpose: "Chef run", update_runlist: true, max_retries: 5, output: true, override_runlist: nil, reboot_first_fail: false, timeout: 1800)
        self.class.loadChefLib
        if update_runlist and !@config['run_list'].nil?
          knifeAddToRunList(multiple: @config['run_list'])
        end
Severity: Minor
Found in modules/mu/groomers/chef.rb - About 1 day 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 generateBaskets has a Cognitive Complexity of 124 (exceeds 75 allowed). Consider refactoring.
Open

    def generateBaskets(prefix: "")
      groupings = {
        "" =>  MU::Cloud.resource_types.values.map { |v| v[:cfg_plural] }
      }

Severity: Minor
Found in modules/mu/adoption.rb - About 1 day 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

File server_pool.rb has 1250 lines of code (exceeds 1000 allowed). Consider refactoring.
Open

module MU
  class Cloud
    class AWS
      # A server pool as configured in {MU::Config::BasketofKittens::server_pools}
      class ServerPool < MU::Cloud::ServerPool
Severity: Major
Found in modules/mu/providers/aws/server_pool.rb - About 1 day to fix

    Method manageUser has a Cognitive Complexity of 121 (exceeds 75 allowed). Consider refactoring.
    Open

          def self.manageUser(user, name: nil, password: nil, email: nil, admin: false, mu_acct: true, unlock: false, ou: $MU_CFG["ldap"]["user_ou"], enable: false, disable: false, change_uid: -1)
            cur_users = listUsers
    
            first = last = nil
            if !name.nil?
    Severity: Minor
    Found in modules/mu/master/ldap.rb - About 7 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

    Class Google has 54 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Google
          @@authtoken = nil
          @@default_project = nil
          @@myRegion_var = nil
          @@my_hosted_cfg = nil
    Severity: Major
    Found in modules/mu/providers/google.rb - About 7 hrs to fix

      Method create has a Cognitive Complexity of 118 (exceeds 75 allowed). Consider refactoring.
      Open

              def create
                ext_zone = MU::Cloud::DNSZone.find(cloud_id: @config['name']).values.first
                @config["create_zone"] =
                  if ext_zone
                    false
      Severity: Minor
      Found in modules/mu/providers/aws/dnszone.rb - About 7 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 crawlChangeReport has a Cognitive Complexity of 118 (exceeds 75 allowed). Consider refactoring.
      Open

          def crawlChangeReport(tier, parent_key = nil, indent: "")
            report = []
            if tier.is_a?(Array)
              tier.each { |a|
                sub_report = crawlChangeReport(a, parent_key)
      Severity: Minor
      Found in modules/mu/adoption.rb - About 7 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

      File server.rb has 1219 lines of code (exceeds 1000 allowed). Consider refactoring.
      Open

      require 'net/ssh'
      require 'net/ssh/multi'
      require 'net/ssh/proxy/command'
      autoload :OpenStruct, "ostruct"
      autoload :Timeout, "timeout"
      Severity: Major
      Found in modules/mu/providers/google/server.rb - About 7 hrs to fix

        Method create_update has a Cognitive Complexity of 117 (exceeds 75 allowed). Consider refactoring.
        Open

                def create_update
                  @config = MU::Config.manxify(@config)
                  @config['region'] ||= MU::Cloud::Azure.myRegion(@config['credentials'])
                  tags = {}
                  if !@config['scrub_mu_isms']
        Severity: Minor
        Found in modules/mu/providers/azure/vpc.rb - About 7 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 method_missing has 306 lines of code (exceeds 150 allowed). Consider refactoring.
        Open

                def method_missing(method_sym, *arguments)
                  retries = 0
                  actual_resource = nil
        
                  enable_on_fail = true
        Severity: Major
        Found in modules/mu/providers/google.rb - About 7 hrs to fix

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

                def self.schema
                  {
                    "type" => "object",
                    "title" => "loadbalancer",
                    "description" => "Create Load Balancers",
          Severity: Major
          Found in modules/mu/config/loadbalancer.rb - About 6 hrs to fix

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

                  class Server < MU::Cloud::Server
            
                    # A list of block device names to use if we get a storage block that
                    # doesn't declare one explicitly.
                    # This probably fails on some AMIs. It's crude.
            Severity: Minor
            Found in modules/mu/providers/aws/server.rb - About 6 hrs to fix

              File google.rb has 1193 lines of code (exceeds 1000 allowed). Consider refactoring.
              Open

              require 'googleauth'
              require "net/http"
              require 'net/https'
              require 'multi_json'
              require 'stringio'
              Severity: Major
              Found in modules/mu/providers/google.rb - About 6 hrs to fix

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

                        def self.validateConfig(cluster, configurator)
                          ok = true
                start = Time.now
                          cluster['size'] = MU::Cloud.resourceClass("AWS", "Server").validateInstanceType(cluster["instance_type"], cluster["region"])
                          ok = false if cluster['size'].nil?
                Severity: Minor
                Found in modules/mu/providers/aws/container_cluster.rb - About 6 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

                Class Azure has 46 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class Azure
                      @@is_in_azure = nil
                      @@metadata = nil
                      @@acct_to_profile_map = nil #WHAT EVEN IS THIS? 
                      @@myRegion_var = nil
                Severity: Minor
                Found in modules/mu/providers/azure.rb - About 6 hrs to fix

                  Method insertKitten has 282 lines of code (exceeds 150 allowed). Consider refactoring.
                  Open

                      def insertKitten(descriptor, type, delay_validation = false, ignore_duplicates: false, overwrite: false)
                        append = false
                        start = Time.now
                  
                        shortclass, cfg_name, cfg_plural, classname = MU::Cloud.getResourceNames(type)
                  Severity: Major
                  Found in modules/mu/config.rb - About 6 hrs to fix

                    Class Database has 45 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                          class Database < MU::Cloud::Database
                    
                            # Map legal storage values for each disk type and database engine so
                            # our validator can check them for us.
                            STORAGE_RANGES = {
                    Severity: Minor
                    Found in modules/mu/providers/aws/database.rb - About 6 hrs to fix

                      Method validateConfig has 270 lines of code (exceeds 150 allowed). Consider refactoring.
                      Open

                              def self.validateConfig(cluster, configurator)
                                ok = true
                      start = Time.now
                                cluster['size'] = MU::Cloud.resourceClass("AWS", "Server").validateInstanceType(cluster["instance_type"], cluster["region"])
                                ok = false if cluster['size'].nil?
                      Severity: Major
                      Found in modules/mu/providers/aws/container_cluster.rb - About 5 hrs to fix

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

                                def self.schema(_config)
                                  toplevel_required = []
                        
                                  term_policies = MU::Cloud::AWS.credConfig ? MU::Cloud::AWS.autoscale.describe_termination_policy_types.termination_policy_types : ["AllocationStrategy", "ClosestToNextInstanceHour", "Default", "NewestInstance", "OldestInstance", "OldestLaunchConfiguration", "OldestLaunchTemplate"]
                                  
                        Severity: Major
                        Found in modules/mu/providers/aws/server_pool.rb - About 5 hrs to fix

                          Method create has a Cognitive Complexity of 106 (exceeds 75 allowed). Consider refactoring.
                          Open

                                  def create
                                    @cfm_name, @cfm_template = MU::Cloud::CloudFormation.cloudFormationBase("dnszone", self, scrub_mu_isms: @config['scrub_mu_isms'])
                                    MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "Name", @config['name'])
                                    MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "HostedZoneConfig", { "Comment" => MU.deploy_id })
                          
                          
                          Severity: Minor
                          Found in modules/mu/providers/cloudformation/dnszone.rb - About 5 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