cloudamatic/mu

View on GitHub

Showing 425 of 2,705 total issues

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

      def self.apis(model = nil, alt_object: nil, credentials: nil, model_version: "V2019_01_01")
        require 'azure_mgmt_api_management'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("ApiManagement").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 "AWS::EC2::Subnet"
                  MU::Cloud::AWS.createStandardTags(resource.physical_resource_id)
                  MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @credentials)
                  data = {
                      "collection" => @config["name"],
Severity: Major
Found in modules/mu/providers/aws/collection.rb and 1 other location - About 1 hr to fix
modules/mu/providers/aws/collection.rb on lines 193..200

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 53.

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 12 locations. Consider refactoring.
Open

      def self.keyvault(model = nil, alt_object: nil, credentials: nil, model_version: "V2018_02_14")
        require 'azure_mgmt_key_vault'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("KeyVault").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 12 locations. Consider refactoring.
Open

      def self.subs(model = nil, alt_object: nil, credentials: nil, model_version: "V2015_11_01")
        require 'azure_mgmt_subscriptions'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("Subscriptions").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 12 locations. Consider refactoring.
Open

      def self.network(model = nil, alt_object: nil, credentials: nil, model_version: "V2019_02_01")
        require 'azure_mgmt_network'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("Network").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 12 locations. Consider refactoring.
Open

      def self.marketplace(model = nil, alt_object: nil, credentials: nil, model_version: "V2015_06_01")
        require 'azure_mgmt_marketplace_ordering'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("Resources").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 12 locations. Consider refactoring.
Open

      def self.billing(model = nil, alt_object: nil, credentials: nil, model_version: "V2018_03_01_preview")
        require 'azure_mgmt_billing'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("Billing").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896

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 53.

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

          if resp and resp.policy_names and resp.policy_names.size > 0
            resp.policy_names.each { |pol_name|
              pol = MU::Cloud::AWS.iam(credentials: @credentials).get_user_policy(user_name: @cloud_id, policy_name: pol_name)
              doc = JSON.parse(CGI.unescape(pol.policy_document))
              bok["inline_policies"] = MU::Cloud.resourceClass("AWS", "Role").doc2MuPolicies(pol.policy_name, doc, bok["inline_policies"])
Severity: Major
Found in modules/mu/providers/aws/user.rb and 1 other location - About 1 hr to fix
modules/mu/providers/aws/group.rb on lines 292..298

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 53.

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 12 locations. Consider refactoring.
Open

      def self.containers(model = nil, alt_object: nil, credentials: nil, model_version: "V2019_04_01")
        require 'azure_mgmt_container_service'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("ContainerService").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 12 locations. Consider refactoring.
Open

      def self.serviceaccts(model = nil, alt_object: nil, credentials: nil, model_version: "V2015_08_31_preview")
        require 'azure_mgmt_msi'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("ManagedServiceIdentity").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 12 locations. Consider refactoring.
Open

      def self.features(model = nil, alt_object: nil, credentials: nil, model_version: "V2015_12_01")
        require 'azure_mgmt_features'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("Features").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 12 locations. Consider refactoring.
Open

      def self.storage(model = nil, alt_object: nil, credentials: nil, model_version: "V2019_04_01")
        require 'azure_mgmt_storage'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("Storage").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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 "AWS::EC2::VPC"
                  MU::Cloud::AWS.createStandardTags(resource.physical_resource_id)
                  MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @credentials)
                  data = {
                      "collection" => @config["name"],
Severity: Major
Found in modules/mu/providers/aws/collection.rb and 1 other location - About 1 hr to fix
modules/mu/providers/aws/collection.rb on lines 185..192

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 53.

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 12 locations. Consider refactoring.
Open

      def self.compute(model = nil, alt_object: nil, credentials: nil, model_version: "V2019_03_01")
        require 'azure_mgmt_compute'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("Compute").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 815..824
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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

          if resp and resp.policy_names and resp.policy_names.size > 0
            resp.policy_names.each { |pol_name|
              pol = MU::Cloud::AWS.iam(credentials: @credentials).get_group_policy(group_name: @cloud_id, policy_name: pol_name)
              doc = JSON.parse(CGI.unescape(pol.policy_document))
              bok["inline_policies"] = MU::Cloud.resourceClass("AWS", "Role").doc2MuPolicies(pol.policy_name, doc, bok["inline_policies"])
Severity: Major
Found in modules/mu/providers/aws/group.rb and 1 other location - About 1 hr to fix
modules/mu/providers/aws/user.rb on lines 430..436

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 53.

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 12 locations. Consider refactoring.
Open

      def self.resources(model = nil, alt_object: nil, credentials: nil, model_version: "V2018_05_01")
        require 'azure_mgmt_resources'

        if model and model.is_a?(Symbol)
          return Object.const_get("Azure").const_get("Resources").const_get("Mgmt").const_get(model_version).const_get("Models").const_get(model)
Severity: Major
Found in modules/mu/providers/azure.rb and 11 other locations - About 1 hr to fix
modules/mu/providers/azure.rb on lines 689..698
modules/mu/providers/azure.rb on lines 725..734
modules/mu/providers/azure.rb on lines 743..752
modules/mu/providers/azure.rb on lines 761..770
modules/mu/providers/azure.rb on lines 779..788
modules/mu/providers/azure.rb on lines 797..806
modules/mu/providers/azure.rb on lines 833..842
modules/mu/providers/azure.rb on lines 851..860
modules/mu/providers/azure.rb on lines 869..878
modules/mu/providers/azure.rb on lines 887..896
modules/mu/providers/azure.rb on lines 924..933

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 53.

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

            userdata = MU::Cloud.fetchUserdata(
              platform: @config["platform"],
              template_variables: {
                "deployKey" => Base64.urlsafe_encode64(@deploy.public_key),
                "deploySSHKey" => @deploy.ssh_public_key,
Severity: Major
Found in modules/mu/providers/cloudformation/server_pool.rb and 1 other location - About 1 hr to fix
modules/mu/providers/cloudformation/server.rb on lines 40..56

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 52.

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

          @userdata = MU::Cloud.fetchUserdata(
            platform: @config["platform"],
            template_variables: {
              "deployKey" => Base64.urlsafe_encode64(@deploy.public_key),
              "deploySSHKey" => @deploy.ssh_public_key,
Severity: Major
Found in modules/mu/providers/cloudformation/server.rb and 1 other location - About 1 hr to fix
modules/mu/providers/cloudformation/server_pool.rb on lines 162..178

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 52.

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

        @my_threads << Thread.new {
          MU.dupGlobals(parent_thread_id)
          Thread.current.thread_variable_set("name", "mu_groom_container")
#          Thread.abort_on_exception = false
          MU::Cloud.resource_types.values.each { |data|
Severity: Major
Found in modules/mu/deploy.rb and 1 other location - About 1 hr to fix
modules/mu/deploy.rb on lines 275..284

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 51.

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

        bash "Set read cache max size on #{node['glusterfs']['server']['volume']}" do
          not_if "gluster volume info #{node['glusterfs']['server']['volume']} | grep 'performance.cache-size: #{node['glusterfs']['server']['read_cache_size']}'"
          code "gluster volume set #{node['glusterfs']['server']['volume']} performance.cache-size #{node['glusterfs']['server']['read_cache_size']}"
Severity: Major
Found in cookbooks/mu-glusterfs/recipes/server.rb and 1 other location - About 1 hr to fix
cookbooks/mu-glusterfs/recipes/server.rb on lines 164..166

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 51.

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

Severity
Category
Status
Source
Language