cloudamatic/mu

View on GitHub

Showing 2,704 of 2,705 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                begin
                  MU::Cloud::AWS.ec2(credentials: credentials, region: region).delete_network_interface(network_interface_id: route.network_interface_id) if !noop
                rescue Aws::EC2::Errors::InvalidNetworkInterfaceIDNotFound
                  MU.log "Network Interface #{route.network_interface_id} has already been deleted", MU::WARN
                end
Severity: Minor
Found in modules/mu/providers/aws/vpc.rb and 1 other location - About 30 mins to fix
modules/mu/providers/aws/vpc.rb on lines 1761..1765

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        when 'debian'
          not_if { ::Dir.glob("/opt/splunkforwarder/splunkforwarder-#{node['splunk']['preferred_version']}-*").size > 0 }
          provider Chef::Provider::Package::Dpkg
          notifies :run, "execute[accept license]", :immediately if node['splunk']['accept_license']
Severity: Minor
Found in cookbooks/mu-splunk/definitions/splunk_installer.rb and 1 other location - About 30 mins to fix
cookbooks/mu-splunk/definitions/splunk_installer.rb on lines 83..86

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            begin
              MU::Cloud::AWS.ec2(credentials: credentials, region: region).delete_route_table(route_table_id: table.route_table_id) if !noop
            rescue Aws::EC2::Errors::InvalidRouteTableIDNotFound
              MU.log "Route table #{table.route_table_id} already removed", MU::WARN
            end
Severity: Minor
Found in modules/mu/providers/aws/vpc.rb and 1 other location - About 30 mins to fix
modules/mu/providers/aws/vpc.rb on lines 1729..1733

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 3 locations. Consider refactoring.
Open

                begin 
                  matches[zone.id] = MU::Cloud::AWS.route53(credentials: args[:credentials]).get_hosted_zone(id: zone.id).hosted_zone
                rescue Aws::Route53::Errors::NoSuchHostedZone
                  MU.log "Hosted zone #{zone.id} doesn't exist"
Severity: Minor
Found in modules/mu/providers/aws/dnszone.rb and 2 other locations - About 30 mins to fix
modules/mu/providers/aws/dnszone.rb on lines 902..905
modules/mu/providers/aws/dnszone.rb on lines 916..919

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      execute "./sacli -k #{key} -v #{value} ConfigPut" do
        cwd node['openvpn']['scripts']
        not_if "#{node['openvpn']['scripts']}/sacli ConfigQuery | grep #{key} | grep #{value}"
        notifies :restart, "service[openvpnas]"
Severity: Minor
Found in cookbooks/mu-openvpn/recipes/default.rb and 1 other location - About 30 mins to fix
cookbooks/mu-openvpn/recipes/default.rb on lines 78..81

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        when 'rhel'
          not_if { ::Dir.glob("/opt/splunkforwarder/splunkforwarder-#{node['splunk']['preferred_version']}-*").size > 0 }
          provider Chef::Provider::Package::Rpm
          notifies :run, "execute[accept license]", :immediately if node['splunk']['accept_license']
Severity: Minor
Found in cookbooks/mu-splunk/definitions/splunk_installer.rb and 1 other location - About 30 mins to fix
cookbooks/mu-splunk/definitions/splunk_installer.rb on lines 87..90

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      execute "./sacli -k vpn.server.routing.private_network.#{i} -v #{cidr} ConfigPut" do
        cwd node['openvpn']['scripts']
        not_if "#{node['openvpn']['scripts']}/sacli ConfigQuery | grep vpn.server.routing.private_network.#{i} | grep #{cidr}"
        notifies :restart, "service[openvpnas]"
Severity: Minor
Found in cookbooks/mu-openvpn/recipes/default.rb and 1 other location - About 30 mins to fix
cookbooks/mu-openvpn/recipes/default.rb on lines 86..89

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

              params_name, params_template = MU::Cloud::CloudFormation.cloudFormationBase("dbclusterparametergroup", name: @mu_name, tags: @config['tags'], scrub_mu_isms: @config['scrub_mu_isms'])
              MU::Cloud::CloudFormation.setCloudFormationProp(@cfm_template[@cfm_name], "DBClusterParameterGroupName", { "Ref" => params_name })
Severity: Minor
Found in modules/mu/providers/cloudformation/database.rb and 1 other location - About 30 mins to fix
modules/mu/providers/cloudformation/database.rb on lines 137..138

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

              resp = MU::Cloud::AWS.dynamo(credentials: args[:credentials], region: args[:region]).describe_table(table_name: args[:cloud_id])
              found[args[:cloud_id]] = resp.table if resp and resp.table
            rescue ::Aws::DynamoDB::Errors::ResourceNotFoundException
Severity: Minor
Found in modules/mu/providers/aws/nosqldb.rb and 1 other location - About 30 mins to fix
modules/mu/providers/aws/container_cluster.rb on lines 572..574

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid too many return statements within this method.
Open

                        return vpc_block
Severity: Major
Found in modules/mu/providers/google/vpc.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return projectobj.cloud_id
    Severity: Major
    Found in modules/mu/providers/google.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return found
      Severity: Major
      Found in modules/mu/providers/google.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                                return vpc_block
        Severity: Major
        Found in modules/mu/providers/google/vpc.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return name_only ? acctname : $MU_CFG['aws'][acctname]
          Severity: Major
          Found in modules/mu/providers/aws.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                  return if public_iface.nat_ip == nat_ip
            Severity: Major
            Found in modules/mu/providers/google/vpc.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return nil
              Severity: Major
              Found in modules/mu/providers/google/vpc.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return MU::Cloud::AWS::VPC.can_route_to_master_peer?(my_subnets_key, target_subnets_key, instance_id)
                Severity: Major
                Found in modules/mu/providers/aws/vpc.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                return name_only ? set : cfg
                  Severity: Major
                  Found in modules/mu/providers/aws.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return tree
                    Severity: Major
                    Found in modules/mu/providers/cloudformation.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                return nil
                      Severity: Major
                      Found in modules/mu/providers/google.rb - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language