cloudamatic/mu

View on GitHub

Showing 2,704 of 2,705 total issues

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

      def self.cloudwatchlogs(region: MU.curRegion, credentials: nil)
        region ||= myRegion
        @@cloudwatchlogs_api[credentials] ||= {}
        @@cloudwatchlogs_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudWatchLogs", region: region, credentials: credentials)
        @@cloudwatchlogs_api[credentials][region]
Severity: Major
Found in modules/mu/providers/aws.rb and 31 other locations - About 45 mins to fix
modules/mu/providers/aws.rb on lines 1077..1081
modules/mu/providers/aws.rb on lines 1091..1095
modules/mu/providers/aws.rb on lines 1099..1103
modules/mu/providers/aws.rb on lines 1107..1111
modules/mu/providers/aws.rb on lines 1115..1119
modules/mu/providers/aws.rb on lines 1129..1133
modules/mu/providers/aws.rb on lines 1137..1141
modules/mu/providers/aws.rb on lines 1145..1149
modules/mu/providers/aws.rb on lines 1153..1157
modules/mu/providers/aws.rb on lines 1161..1165
modules/mu/providers/aws.rb on lines 1169..1173
modules/mu/providers/aws.rb on lines 1178..1182
modules/mu/providers/aws.rb on lines 1194..1198
modules/mu/providers/aws.rb on lines 1202..1206
modules/mu/providers/aws.rb on lines 1210..1214
modules/mu/providers/aws.rb on lines 1218..1222
modules/mu/providers/aws.rb on lines 1226..1230
modules/mu/providers/aws.rb on lines 1234..1238
modules/mu/providers/aws.rb on lines 1242..1246
modules/mu/providers/aws.rb on lines 1250..1254
modules/mu/providers/aws.rb on lines 1266..1270
modules/mu/providers/aws.rb on lines 1274..1278
modules/mu/providers/aws.rb on lines 1282..1286
modules/mu/providers/aws.rb on lines 1290..1294
modules/mu/providers/aws.rb on lines 1298..1302
modules/mu/providers/aws.rb on lines 1306..1310
modules/mu/providers/aws.rb on lines 1314..1318
modules/mu/providers/aws.rb on lines 1322..1326
modules/mu/providers/aws.rb on lines 1330..1334
modules/mu/providers/aws.rb on lines 1338..1342
modules/mu/providers/aws.rb on lines 1346..1350

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

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 deeply nested control flow statements.
Open

                  elsif dnsrec["type"] == "A"
                    if public
                      { "Fn::GetAtt" => [@dependencies["server"][dnsrec['target']].cloudobj.cfm_name, "PublicIp"] }
                    else
                      { "Fn::GetAtt" => [@dependencies["server"][dnsrec['target']].cloudobj.cfm_name, "PrivateIp"] }
Severity: Major
Found in modules/mu/providers/cloudformation/dnszone.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                slack_path_str += "#{preposition} \*"+path.join(" ⇨ ")+"\*" if path.size > 0
    Severity: Major
    Found in modules/mu/adoption.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if disable
                      attr[:userAccountControl] = (attr[:userAccountControl].to_i & AD_PW_ATTRS['disable']).to_s
                    end
      Severity: Major
      Found in modules/mu/master/ldap.rb - About 45 mins to fix

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

              def self.cloudfront(region: MU.curRegion, credentials: nil)
                region ||= myRegion
                @@cloudfront_api[credentials] ||= {}
                @@cloudfront_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudFront", region: region, credentials: credentials)
                @@cloudfront_api[credentials][region]
        Severity: Major
        Found in modules/mu/providers/aws.rb and 31 other locations - About 45 mins to fix
        modules/mu/providers/aws.rb on lines 1077..1081
        modules/mu/providers/aws.rb on lines 1091..1095
        modules/mu/providers/aws.rb on lines 1099..1103
        modules/mu/providers/aws.rb on lines 1107..1111
        modules/mu/providers/aws.rb on lines 1115..1119
        modules/mu/providers/aws.rb on lines 1129..1133
        modules/mu/providers/aws.rb on lines 1137..1141
        modules/mu/providers/aws.rb on lines 1145..1149
        modules/mu/providers/aws.rb on lines 1153..1157
        modules/mu/providers/aws.rb on lines 1161..1165
        modules/mu/providers/aws.rb on lines 1169..1173
        modules/mu/providers/aws.rb on lines 1178..1182
        modules/mu/providers/aws.rb on lines 1186..1190
        modules/mu/providers/aws.rb on lines 1194..1198
        modules/mu/providers/aws.rb on lines 1210..1214
        modules/mu/providers/aws.rb on lines 1218..1222
        modules/mu/providers/aws.rb on lines 1226..1230
        modules/mu/providers/aws.rb on lines 1234..1238
        modules/mu/providers/aws.rb on lines 1242..1246
        modules/mu/providers/aws.rb on lines 1250..1254
        modules/mu/providers/aws.rb on lines 1266..1270
        modules/mu/providers/aws.rb on lines 1274..1278
        modules/mu/providers/aws.rb on lines 1282..1286
        modules/mu/providers/aws.rb on lines 1290..1294
        modules/mu/providers/aws.rb on lines 1298..1302
        modules/mu/providers/aws.rb on lines 1306..1310
        modules/mu/providers/aws.rb on lines 1314..1318
        modules/mu/providers/aws.rb on lines 1322..1326
        modules/mu/providers/aws.rb on lines 1330..1334
        modules/mu/providers/aws.rb on lines 1338..1342
        modules/mu/providers/aws.rb on lines 1346..1350

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

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

                  if @config['raw_policies']
                    pol_arns = MU::Cloud.resourceClass("AWS", "Role").manageRawPolicies(
                      @config['raw_policies'],
                      basename: @deploy.getResourceName(@config['name']),
                      credentials: @credentials
        Severity: Minor
        Found in modules/mu/providers/aws/user.rb and 1 other location - About 45 mins to fix
        modules/mu/providers/aws/group.rb on lines 90..97

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

        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 deeply nested control flow statements.
        Open

                          if !@config["vpc"]["vpc_name"].nil? and @dependencies.has_key?("vpc") and @dependencies["vpc"].has_key?(@config["vpc"]["vpc_name"])
                            igw_name, igw_template = MU::Cloud::CloudFormation.cloudFormationBase("vpcgwattach", name: @dependencies["vpc"][@config["vpc"]["vpc_name"]].cloudobj.mu_name, scrub_mu_isms: @config['scrub_mu_isms'])
                            MU::Cloud::CloudFormation.setCloudFormationProp(eip_template[eip_name], "DependsOn", igw_name)
                          end
        Severity: Major
        Found in modules/mu/providers/cloudformation/server.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if used_uids.include?(change_uid)
                            raise MuLDAPError, "Uid #{change_uid} is unavailable, cannot allocate to user #{user}"
                          end
          Severity: Major
          Found in modules/mu/master/ldap.rb - About 45 mins to fix

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

                  def self.ec2(region: MU.curRegion, credentials: nil)
                    region ||= myRegion
                    @@ec2_api[credentials] ||= {}
                    @@ec2_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "EC2", region: region, credentials: credentials)
                    @@ec2_api[credentials][region]
            Severity: Major
            Found in modules/mu/providers/aws.rb and 31 other locations - About 45 mins to fix
            modules/mu/providers/aws.rb on lines 1077..1081
            modules/mu/providers/aws.rb on lines 1099..1103
            modules/mu/providers/aws.rb on lines 1107..1111
            modules/mu/providers/aws.rb on lines 1115..1119
            modules/mu/providers/aws.rb on lines 1129..1133
            modules/mu/providers/aws.rb on lines 1137..1141
            modules/mu/providers/aws.rb on lines 1145..1149
            modules/mu/providers/aws.rb on lines 1153..1157
            modules/mu/providers/aws.rb on lines 1161..1165
            modules/mu/providers/aws.rb on lines 1169..1173
            modules/mu/providers/aws.rb on lines 1178..1182
            modules/mu/providers/aws.rb on lines 1186..1190
            modules/mu/providers/aws.rb on lines 1194..1198
            modules/mu/providers/aws.rb on lines 1202..1206
            modules/mu/providers/aws.rb on lines 1210..1214
            modules/mu/providers/aws.rb on lines 1218..1222
            modules/mu/providers/aws.rb on lines 1226..1230
            modules/mu/providers/aws.rb on lines 1234..1238
            modules/mu/providers/aws.rb on lines 1242..1246
            modules/mu/providers/aws.rb on lines 1250..1254
            modules/mu/providers/aws.rb on lines 1266..1270
            modules/mu/providers/aws.rb on lines 1274..1278
            modules/mu/providers/aws.rb on lines 1282..1286
            modules/mu/providers/aws.rb on lines 1290..1294
            modules/mu/providers/aws.rb on lines 1298..1302
            modules/mu/providers/aws.rb on lines 1306..1310
            modules/mu/providers/aws.rb on lines 1314..1318
            modules/mu/providers/aws.rb on lines 1322..1326
            modules/mu/providers/aws.rb on lines 1330..1334
            modules/mu/providers/aws.rb on lines 1338..1342
            modules/mu/providers/aws.rb on lines 1346..1350

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

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

                  def self.sqs(region: MU.curRegion, credentials: nil)
                    region ||= myRegion
                    @@sqs_api[credentials] ||= {}
                    @@sqs_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "SQS", region: region, credentials: credentials)
                    @@sqs_api[credentials][region]
            Severity: Major
            Found in modules/mu/providers/aws.rb and 31 other locations - About 45 mins to fix
            modules/mu/providers/aws.rb on lines 1077..1081
            modules/mu/providers/aws.rb on lines 1091..1095
            modules/mu/providers/aws.rb on lines 1099..1103
            modules/mu/providers/aws.rb on lines 1107..1111
            modules/mu/providers/aws.rb on lines 1115..1119
            modules/mu/providers/aws.rb on lines 1129..1133
            modules/mu/providers/aws.rb on lines 1137..1141
            modules/mu/providers/aws.rb on lines 1145..1149
            modules/mu/providers/aws.rb on lines 1153..1157
            modules/mu/providers/aws.rb on lines 1161..1165
            modules/mu/providers/aws.rb on lines 1169..1173
            modules/mu/providers/aws.rb on lines 1178..1182
            modules/mu/providers/aws.rb on lines 1186..1190
            modules/mu/providers/aws.rb on lines 1194..1198
            modules/mu/providers/aws.rb on lines 1202..1206
            modules/mu/providers/aws.rb on lines 1210..1214
            modules/mu/providers/aws.rb on lines 1218..1222
            modules/mu/providers/aws.rb on lines 1234..1238
            modules/mu/providers/aws.rb on lines 1242..1246
            modules/mu/providers/aws.rb on lines 1250..1254
            modules/mu/providers/aws.rb on lines 1266..1270
            modules/mu/providers/aws.rb on lines 1274..1278
            modules/mu/providers/aws.rb on lines 1282..1286
            modules/mu/providers/aws.rb on lines 1290..1294
            modules/mu/providers/aws.rb on lines 1298..1302
            modules/mu/providers/aws.rb on lines 1306..1310
            modules/mu/providers/aws.rb on lines 1314..1318
            modules/mu/providers/aws.rb on lines 1322..1326
            modules/mu/providers/aws.rb on lines 1330..1334
            modules/mu/providers/aws.rb on lines 1338..1342
            modules/mu/providers/aws.rb on lines 1346..1350

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

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

                  def self.cloudfront(region: MU.curRegion, credentials: nil)
                    region ||= myRegion
                    @@cloudfront_api[credentials] ||= {}
                    @@cloudfront_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudFront", region: region, credentials: credentials)
                    @@cloudfront_api[credentials][region]
            Severity: Major
            Found in modules/mu/providers/aws.rb and 31 other locations - About 45 mins to fix
            modules/mu/providers/aws.rb on lines 1077..1081
            modules/mu/providers/aws.rb on lines 1091..1095
            modules/mu/providers/aws.rb on lines 1099..1103
            modules/mu/providers/aws.rb on lines 1107..1111
            modules/mu/providers/aws.rb on lines 1115..1119
            modules/mu/providers/aws.rb on lines 1129..1133
            modules/mu/providers/aws.rb on lines 1137..1141
            modules/mu/providers/aws.rb on lines 1145..1149
            modules/mu/providers/aws.rb on lines 1153..1157
            modules/mu/providers/aws.rb on lines 1161..1165
            modules/mu/providers/aws.rb on lines 1169..1173
            modules/mu/providers/aws.rb on lines 1178..1182
            modules/mu/providers/aws.rb on lines 1186..1190
            modules/mu/providers/aws.rb on lines 1194..1198
            modules/mu/providers/aws.rb on lines 1202..1206
            modules/mu/providers/aws.rb on lines 1210..1214
            modules/mu/providers/aws.rb on lines 1218..1222
            modules/mu/providers/aws.rb on lines 1226..1230
            modules/mu/providers/aws.rb on lines 1234..1238
            modules/mu/providers/aws.rb on lines 1242..1246
            modules/mu/providers/aws.rb on lines 1250..1254
            modules/mu/providers/aws.rb on lines 1266..1270
            modules/mu/providers/aws.rb on lines 1274..1278
            modules/mu/providers/aws.rb on lines 1282..1286
            modules/mu/providers/aws.rb on lines 1290..1294
            modules/mu/providers/aws.rb on lines 1298..1302
            modules/mu/providers/aws.rb on lines 1306..1310
            modules/mu/providers/aws.rb on lines 1314..1318
            modules/mu/providers/aws.rb on lines 1322..1326
            modules/mu/providers/aws.rb on lines 1330..1334
            modules/mu/providers/aws.rb on lines 1338..1342

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

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

                  def self.rds(region: MU.curRegion, credentials: nil)
                    region ||= myRegion
                    @@rds_api[credentials] ||= {}
                    @@rds_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "RDS", region: region, credentials: credentials)
                    @@rds_api[credentials][region]
            Severity: Major
            Found in modules/mu/providers/aws.rb and 31 other locations - About 45 mins to fix
            modules/mu/providers/aws.rb on lines 1077..1081
            modules/mu/providers/aws.rb on lines 1091..1095
            modules/mu/providers/aws.rb on lines 1099..1103
            modules/mu/providers/aws.rb on lines 1107..1111
            modules/mu/providers/aws.rb on lines 1115..1119
            modules/mu/providers/aws.rb on lines 1137..1141
            modules/mu/providers/aws.rb on lines 1145..1149
            modules/mu/providers/aws.rb on lines 1153..1157
            modules/mu/providers/aws.rb on lines 1161..1165
            modules/mu/providers/aws.rb on lines 1169..1173
            modules/mu/providers/aws.rb on lines 1178..1182
            modules/mu/providers/aws.rb on lines 1186..1190
            modules/mu/providers/aws.rb on lines 1194..1198
            modules/mu/providers/aws.rb on lines 1202..1206
            modules/mu/providers/aws.rb on lines 1210..1214
            modules/mu/providers/aws.rb on lines 1218..1222
            modules/mu/providers/aws.rb on lines 1226..1230
            modules/mu/providers/aws.rb on lines 1234..1238
            modules/mu/providers/aws.rb on lines 1242..1246
            modules/mu/providers/aws.rb on lines 1250..1254
            modules/mu/providers/aws.rb on lines 1266..1270
            modules/mu/providers/aws.rb on lines 1274..1278
            modules/mu/providers/aws.rb on lines 1282..1286
            modules/mu/providers/aws.rb on lines 1290..1294
            modules/mu/providers/aws.rb on lines 1298..1302
            modules/mu/providers/aws.rb on lines 1306..1310
            modules/mu/providers/aws.rb on lines 1314..1318
            modules/mu/providers/aws.rb on lines 1322..1326
            modules/mu/providers/aws.rb on lines 1330..1334
            modules/mu/providers/aws.rb on lines 1338..1342
            modules/mu/providers/aws.rb on lines 1346..1350

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

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

                  def self.cloudformation(region: MU.curRegion, credentials: nil)
                    region ||= myRegion
                    @@cloudformation_api[credentials] ||= {}
                    @@cloudformation_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CloudFormation", region: region, credentials: credentials)
                    @@cloudformation_api[credentials][region]
            Severity: Major
            Found in modules/mu/providers/aws.rb and 31 other locations - About 45 mins to fix
            modules/mu/providers/aws.rb on lines 1077..1081
            modules/mu/providers/aws.rb on lines 1091..1095
            modules/mu/providers/aws.rb on lines 1099..1103
            modules/mu/providers/aws.rb on lines 1107..1111
            modules/mu/providers/aws.rb on lines 1115..1119
            modules/mu/providers/aws.rb on lines 1129..1133
            modules/mu/providers/aws.rb on lines 1145..1149
            modules/mu/providers/aws.rb on lines 1153..1157
            modules/mu/providers/aws.rb on lines 1161..1165
            modules/mu/providers/aws.rb on lines 1169..1173
            modules/mu/providers/aws.rb on lines 1178..1182
            modules/mu/providers/aws.rb on lines 1186..1190
            modules/mu/providers/aws.rb on lines 1194..1198
            modules/mu/providers/aws.rb on lines 1202..1206
            modules/mu/providers/aws.rb on lines 1210..1214
            modules/mu/providers/aws.rb on lines 1218..1222
            modules/mu/providers/aws.rb on lines 1226..1230
            modules/mu/providers/aws.rb on lines 1234..1238
            modules/mu/providers/aws.rb on lines 1242..1246
            modules/mu/providers/aws.rb on lines 1250..1254
            modules/mu/providers/aws.rb on lines 1266..1270
            modules/mu/providers/aws.rb on lines 1274..1278
            modules/mu/providers/aws.rb on lines 1282..1286
            modules/mu/providers/aws.rb on lines 1290..1294
            modules/mu/providers/aws.rb on lines 1298..1302
            modules/mu/providers/aws.rb on lines 1306..1310
            modules/mu/providers/aws.rb on lines 1314..1318
            modules/mu/providers/aws.rb on lines 1322..1326
            modules/mu/providers/aws.rb on lines 1330..1334
            modules/mu/providers/aws.rb on lines 1338..1342
            modules/mu/providers/aws.rb on lines 1346..1350

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

            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 deeply nested control flow statements.
            Open

                              if dnsrec["type"] == "CNAME"
                                if public
                                  deploydata['public_dns_name'].empty? ? deploydata['private_dns_name'] : deploydata['public_dns_name']
                                else
                                  deploydata['private_dns_name']
            Severity: Major
            Found in modules/mu/providers/cloudformation/dnszone.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          rescue StandardError => e
                            MU.log "Failed to fetch #{cryptfile} from Cloud Storage bucket #{MU.adminBucketName}", MU::ERR, details: e.inspect
                            %x{/bin/dd if=/dev/urandom of=#{temp_dev} bs=1M count=1 > /dev/null 2>&1}
                            raise e
              Severity: Major
              Found in modules/mu/master.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                  if @config['basis'] and !unq.nil? and !unq.empty?
                                    @mu_windows_name = @deploy.getResourceName(@config['name'], max_length: 15, need_unique_string: true, use_unique_string: unq, reuse_unique_string: true)
                                  else
                                    @mu_windows_name = @deploy.getResourceName(@config['name'], max_length: 15, need_unique_string: true)
                                  end
                Severity: Major
                Found in modules/mu/cloud/resource_base.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  MU.log "No base image for platform #{platform} in cloud #{cloud} region #{region} found", MU::WARN if !quiet
                  Severity: Major
                  Found in modules/mu/cloud/machine_images.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                    if @type == "folders"
                    MU.log "would assign name '#{@obj.mu_name}' in ref to this folder if I were feeling aggressive", MU::WARN, details: self.to_h
                    end
                    Severity: Major
                    Found in modules/mu/config/ref.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      if used_uids.include?(change_uid)
                                        raise MuLDAPError, "Uid #{change_uid} is unavailable, cannot allocate to user #{user}"
                                      end
                      Severity: Major
                      Found in modules/mu/master/ldap.rb - About 45 mins to fix

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

                              def self.cognito_ident(region: MU.curRegion, credentials: nil)
                                region ||= myRegion
                                @@cognito_ident_api[credentials] ||= {}
                                @@cognito_ident_api[credentials][region] ||= MU::Cloud::AWS::AmazonEndpoint.new(api: "CognitoIdentity", region: region, credentials: credentials)
                                @@cognito_ident_api[credentials][region]
                        Severity: Major
                        Found in modules/mu/providers/aws.rb and 31 other locations - About 45 mins to fix
                        modules/mu/providers/aws.rb on lines 1077..1081
                        modules/mu/providers/aws.rb on lines 1091..1095
                        modules/mu/providers/aws.rb on lines 1099..1103
                        modules/mu/providers/aws.rb on lines 1107..1111
                        modules/mu/providers/aws.rb on lines 1115..1119
                        modules/mu/providers/aws.rb on lines 1129..1133
                        modules/mu/providers/aws.rb on lines 1137..1141
                        modules/mu/providers/aws.rb on lines 1145..1149
                        modules/mu/providers/aws.rb on lines 1153..1157
                        modules/mu/providers/aws.rb on lines 1161..1165
                        modules/mu/providers/aws.rb on lines 1169..1173
                        modules/mu/providers/aws.rb on lines 1178..1182
                        modules/mu/providers/aws.rb on lines 1186..1190
                        modules/mu/providers/aws.rb on lines 1194..1198
                        modules/mu/providers/aws.rb on lines 1202..1206
                        modules/mu/providers/aws.rb on lines 1210..1214
                        modules/mu/providers/aws.rb on lines 1218..1222
                        modules/mu/providers/aws.rb on lines 1226..1230
                        modules/mu/providers/aws.rb on lines 1234..1238
                        modules/mu/providers/aws.rb on lines 1242..1246
                        modules/mu/providers/aws.rb on lines 1250..1254
                        modules/mu/providers/aws.rb on lines 1266..1270
                        modules/mu/providers/aws.rb on lines 1274..1278
                        modules/mu/providers/aws.rb on lines 1282..1286
                        modules/mu/providers/aws.rb on lines 1290..1294
                        modules/mu/providers/aws.rb on lines 1298..1302
                        modules/mu/providers/aws.rb on lines 1306..1310
                        modules/mu/providers/aws.rb on lines 1314..1318
                        modules/mu/providers/aws.rb on lines 1330..1334
                        modules/mu/providers/aws.rb on lines 1338..1342
                        modules/mu/providers/aws.rb on lines 1346..1350

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

                        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