cloudamatic/mu

View on GitHub

Showing 2,704 of 2,705 total issues

Assignment Branch Condition size for updateAWSMetaData is too high. [273.4/75]
Open

def updateAWSMetaData(deploys = MU::MommaCat.listDeploys, nodes = [])
  deploys.each { |muid|
    mommacat = MU::MommaCat.new(muid)

    if mommacat.original_config.nil?
Severity: Minor
Found in bin/mu-node-manage by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

File server.rb has 1941 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/aws/server.rb - About 3 days to fix

    Method dependencies has a Cognitive Complexity of 220 (exceeds 75 allowed). Consider refactoring.
    Open

            def dependencies(use_cache: false, debug: false)
              @dependencies ||= {}
              @loadbalancers ||= []
              @firewall_rules ||= []
    
    
    Severity: Minor
    Found in modules/mu/cloud/resource_base.rb - About 3 days 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

    Assignment Branch Condition size for createUpdateLaunchConfig is too high. [270.5/75]
    Open

            def createUpdateLaunchConfig
              return if !@config['basis'] or !@config['basis']["launch_config"]
    
              instance_secret = Password.random(50)
              @deploy.saveNodeSecret("default", instance_secret, "instance_secret")

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for create_update is too high. [259.1/75]
    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 by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Class has too many lines. [1243/1000]
    Open

          class ServerPool < MU::Cloud::ServerPool
    
            # 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)

    This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for create is too high. [250/75]
    Open

            def create
              @cfm_name, @cfm_template = MU::Cloud::CloudFormation.cloudFormationBase(self.class.cfg_name, self, tags: @config['tags'], scrub_mu_isms: @config['scrub_mu_isms']) if @cfm_template.nil?
              MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "CidrBlock", @config['ip_block'])
              ["enable_dns_support", "enable_dns_hostnames"].each { |arg|
                if !@config[arg].nil?

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for create is too high. [250.7/75]
    Open

            def create
              @cfm_name, @cfm_template = MU::Cloud::CloudFormation.cloudFormationBase(self.class.cfg_name, self, tags: @config['tags'], scrub_mu_isms: @config['scrub_mu_isms']) if @cfm_template.nil?
              @cfm_launch_name, launch_template = MU::Cloud::CloudFormation.cloudFormationBase("launch_config", self, scrub_mu_isms: @config['scrub_mu_isms'])
              MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "LaunchConfigurationName", { "Ref" => @cfm_launch_name } )
              MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "DependsOn", @cfm_launch_name)

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Module has too many lines. [332/100]
    Open

      module Helper
    
        # Fetch a Google instance metadata parameter (example: instance/id).
        # @param param [String]: The parameter name to fetch
        # @return [String, nil]

    This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for groom is too high. [248.4/75]
    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']

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for create is too high. [247.2/75]
    Open

            def create
              flag="SUCCESS"
              MU.setVar("curRegion", @region) if !@region.nil?
              region = @region
              server=@config["name"]

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for create is too high. [246.3/75]
    Open

            def create
              # RDS is picky, we can't just use our regular node names for things
              # like the default schema or username. And it varies from engine to
              # engine.
              basename = @config["name"].to_s

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for create is too high. [238.8/75]
    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)

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    File container_cluster.rb has 1773 lines of code (exceeds 1000 allowed). Consider refactoring.
    Open

    module MU
      class Cloud
        class AWS
          # A ContainerCluster as configured in {MU::Config::BasketofKittens::container_clusters}
          class ContainerCluster < MU::Cloud::ContainerCluster
    Severity: Major
    Found in modules/mu/providers/aws/container_cluster.rb - About 2 days to fix

      Assignment Branch Condition size for groom is too high. [235.3/75]
      Open

              def groom
                labelCluster 
      
                me = cloud_desc
      
      

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      Class has too many lines. [1204/1000]
      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)

      This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Class has too many lines. [1203/1000]
      Open

          class AWS
            @@myRegion_var = nil
      
            @@creds_loaded = {}
      
      
      Severity: Minor
      Found in modules/mu/providers/aws.rb by rubocop

      This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method has too many lines. [354/200]
      Open

            def self.common_properties
              {
                "name" => {"type" => "string"},
                "ansible_vars" => {
                  "type" => "object",
      Severity: Minor
      Found in modules/mu/config/server.rb by rubocop

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

              def self.schema(_config)
                toplevel_required = []
      
                schema = {
                  "flavor" => {
      Severity: Major
      Found in modules/mu/providers/aws/container_cluster.rb - About 2 days to fix

        Method has too many lines. [352/200]
        Open

              def self.processReference(vpc_block, parent_type, parent, configurator, sibling_vpcs: [], dflt_region: MU.curRegion, dflt_project: nil, credentials: nil)
        
                if !vpc_block.is_a?(Hash) and vpc_block.kind_of?(MU::Cloud::VPC)
                  return true
                end
        Severity: Minor
        Found in modules/mu/config/vpc.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Severity
        Category
        Status
        Source
        Language