udondan/iam-floyd

View on GitHub

Showing 60 of 99 total issues

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

  public ifAwsPrincipalArn(
    value: string | string[],
    operator?: Operator | string,
  ) {
    return this.if('aws:PrincipalArn', value, operator ?? Operator.arnLike);
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 3 other locations - About 55 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 236..245
lib/shared/policy-statement/2-conditions.ts on lines 751..756
lib/shared/policy-statement/2-conditions.ts on lines 793..795

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

  public ifAwsEc2InstanceSourcePrivateIPv4(
    value: string | string[],
    operator?: Operator | string,
  ) {
    return this.if(
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 3 other locations - About 55 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 366..371
lib/shared/policy-statement/2-conditions.ts on lines 751..756
lib/shared/policy-statement/2-conditions.ts on lines 793..795

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

  public forCanonicalUser(...userIDs: string[]) {
    userIDs.forEach((userID) =>
      this.addPrincipal(PrincipalType.canonicalUser, userID),
    );
    return this;
Severity: Major
Found in lib/shared/policy-statement/8-principals.ts and 2 other locations - About 50 mins to fix
lib/shared/policy-statement/8-principals.ts on lines 120..125
lib/shared/policy-statement/8-principals.ts on lines 246..251

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

  public forService(...services: string[]) {
    services.forEach((service) =>
      this.addPrincipal(PrincipalType.service, service),
    );
    return this;
Severity: Major
Found in lib/shared/policy-statement/8-principals.ts and 2 other locations - About 50 mins to fix
lib/shared/policy-statement/8-principals.ts on lines 120..125
lib/shared/policy-statement/8-principals.ts on lines 163..168

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

  public forFederated(...providers: string[]) {
    providers.forEach((provider) =>
      this.addPrincipal(PrincipalType.federated, provider),
    );
    return this;
Severity: Major
Found in lib/shared/policy-statement/8-principals.ts and 2 other locations - About 50 mins to fix
lib/shared/policy-statement/8-principals.ts on lines 163..168
lib/shared/policy-statement/8-principals.ts on lines 246..251

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

      const uniqueActions = this.floydActions
        .filter((elem, pos) => {
          return self.floydActions.indexOf(elem) == pos;
        })
        .sort();
Severity: Minor
Found in lib/shared/policy-statement/3-actions.ts and 1 other location - About 50 mins to fix
lib/shared/policy-statement/3-actions.ts on lines 46..50

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

      const actions = this.floydActions
        .filter((elem, pos) => {
          return self.floydActions.indexOf(elem) == pos;
        })
        .sort();
Severity: Minor
Found in lib/shared/policy-statement/3-actions.ts and 1 other location - About 50 mins to fix
lib/shared/policy-statement/3-actions.ts on lines 78..82

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

  public ifAwsSecureTransport(value?: boolean) {
    return this.if(
      `aws:SecureTransport`,
      typeof value !== 'undefined' ? value : true,
      Operator.bool,
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 3 other locations - About 50 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 329..335
lib/shared/policy-statement/2-conditions.ts on lines 382..388
lib/shared/policy-statement/2-conditions.ts on lines 938..944

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

  public ifAwsMultiFactorAuthPresent(value?: boolean) {
    return this.if(
      `aws:MultiFactorAuthPresent`,
      typeof value !== 'undefined' ? value : true,
      Operator.bool,
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 3 other locations - About 50 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 382..388
lib/shared/policy-statement/2-conditions.ts on lines 710..716
lib/shared/policy-statement/2-conditions.ts on lines 938..944

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

  public ifAwsPrincipalIsAWSService(value?: boolean) {
    return this.if(
      `aws:PrincipalIsAWSService`,
      typeof value !== 'undefined' ? value : true,
      Operator.bool,
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 3 other locations - About 50 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 329..335
lib/shared/policy-statement/2-conditions.ts on lines 710..716
lib/shared/policy-statement/2-conditions.ts on lines 938..944

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

  public ifAwsViaAWSService(value?: boolean) {
    return this.if(
      `aws:ViaAWSService`,
      typeof value !== 'undefined' ? value : true,
      Operator.bool,
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 3 other locations - About 50 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 329..335
lib/shared/policy-statement/2-conditions.ts on lines 382..388
lib/shared/policy-statement/2-conditions.ts on lines 710..716

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

      resourceType.conditionKeys.forEach((key) => {
        desc += `\n- .${createConditionName(
          module.conditions![key].key,
          module.servicePrefix!,
        )}()`;
Severity: Minor
Found in lib/generator/index.ts and 1 other location - About 40 mins to fix
lib/generator/index.ts on lines 375..380

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

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

      action.conditions?.forEach((condition) => {
        desc += `\n- .${createConditionName(
          module.conditions![condition].key,
          module.servicePrefix!,
        )}()`;
Severity: Minor
Found in lib/generator/index.ts and 1 other location - About 40 mins to fix
lib/generator/index.ts on lines 471..476

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

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 (
      resourceType.url.length &&
      resourceType.url != 'https://docs.aws.amazon.com/'
    ) {
      desc += `\n\n${resourceType.url}`;
Severity: Minor
Found in lib/generator/index.ts and 1 other location - About 35 mins to fix
lib/generator/index.ts on lines 388..390

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

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 (action.url.length && action.url != 'https://docs.aws.amazon.com/') {
      desc += `\n\n${action.url}`;
    }
Severity: Minor
Found in lib/generator/index.ts and 1 other location - About 35 mins to fix
lib/generator/index.ts on lines 462..467

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

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

function upperFirst(str: string): string {
  return str.charAt(0).toUpperCase() + str.slice(1);
}
Severity: Minor
Found in lib/generator/index.ts and 1 other location - About 35 mins to fix
lib/generator/index.ts on lines 723..725

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

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

export function lowerFirst(str: string): string {
  return str.charAt(0).toLowerCase() + str.slice(1);
}
Severity: Minor
Found in lib/generator/index.ts and 1 other location - About 35 mins to fix
lib/generator/index.ts on lines 719..721

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

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

  public ifAwsPrincipalType(
    value: string | string[],
    operator?: Operator | string,
  ) {
    return this.if('aws:PrincipalType', value, operator);
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 20 other locations - About 30 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 148..153
lib/shared/policy-statement/2-conditions.ts on lines 165..170
lib/shared/policy-statement/2-conditions.ts on lines 217..222
lib/shared/policy-statement/2-conditions.ts on lines 288..293
lib/shared/policy-statement/2-conditions.ts on lines 347..352
lib/shared/policy-statement/2-conditions.ts on lines 402..407
lib/shared/policy-statement/2-conditions.ts on lines 425..430
lib/shared/policy-statement/2-conditions.ts on lines 534..536
lib/shared/policy-statement/2-conditions.ts on lines 552..557
lib/shared/policy-statement/2-conditions.ts on lines 610..615
lib/shared/policy-statement/2-conditions.ts on lines 641..646
lib/shared/policy-statement/2-conditions.ts on lines 675..680
lib/shared/policy-statement/2-conditions.ts on lines 730..735
lib/shared/policy-statement/2-conditions.ts on lines 774..779
lib/shared/policy-statement/2-conditions.ts on lines 807..812
lib/shared/policy-statement/2-conditions.ts on lines 824..829
lib/shared/policy-statement/2-conditions.ts on lines 845..847
lib/shared/policy-statement/2-conditions.ts on lines 884..889
lib/shared/policy-statement/2-conditions.ts on lines 901..903
lib/shared/policy-statement/2-conditions.ts on lines 915..917

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

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

  public ifAwsSourceVpc(
    value: string | string[],
    operator?: Operator | string,
  ) {
    return this.if('aws:SourceVpc', value, operator);
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 20 other locations - About 30 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 148..153
lib/shared/policy-statement/2-conditions.ts on lines 165..170
lib/shared/policy-statement/2-conditions.ts on lines 217..222
lib/shared/policy-statement/2-conditions.ts on lines 288..293
lib/shared/policy-statement/2-conditions.ts on lines 347..352
lib/shared/policy-statement/2-conditions.ts on lines 402..407
lib/shared/policy-statement/2-conditions.ts on lines 425..430
lib/shared/policy-statement/2-conditions.ts on lines 513..518
lib/shared/policy-statement/2-conditions.ts on lines 534..536
lib/shared/policy-statement/2-conditions.ts on lines 552..557
lib/shared/policy-statement/2-conditions.ts on lines 610..615
lib/shared/policy-statement/2-conditions.ts on lines 641..646
lib/shared/policy-statement/2-conditions.ts on lines 675..680
lib/shared/policy-statement/2-conditions.ts on lines 730..735
lib/shared/policy-statement/2-conditions.ts on lines 774..779
lib/shared/policy-statement/2-conditions.ts on lines 824..829
lib/shared/policy-statement/2-conditions.ts on lines 845..847
lib/shared/policy-statement/2-conditions.ts on lines 884..889
lib/shared/policy-statement/2-conditions.ts on lines 901..903
lib/shared/policy-statement/2-conditions.ts on lines 915..917

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

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

  public ifAwsPrincipalAccount(
    value: string | string[],
    operator?: Operator | string,
  ) {
    return this.if('aws:PrincipalAccount', value, operator);
Severity: Major
Found in lib/shared/policy-statement/2-conditions.ts and 20 other locations - About 30 mins to fix
lib/shared/policy-statement/2-conditions.ts on lines 148..153
lib/shared/policy-statement/2-conditions.ts on lines 165..170
lib/shared/policy-statement/2-conditions.ts on lines 217..222
lib/shared/policy-statement/2-conditions.ts on lines 288..293
lib/shared/policy-statement/2-conditions.ts on lines 402..407
lib/shared/policy-statement/2-conditions.ts on lines 425..430
lib/shared/policy-statement/2-conditions.ts on lines 513..518
lib/shared/policy-statement/2-conditions.ts on lines 534..536
lib/shared/policy-statement/2-conditions.ts on lines 552..557
lib/shared/policy-statement/2-conditions.ts on lines 610..615
lib/shared/policy-statement/2-conditions.ts on lines 641..646
lib/shared/policy-statement/2-conditions.ts on lines 675..680
lib/shared/policy-statement/2-conditions.ts on lines 730..735
lib/shared/policy-statement/2-conditions.ts on lines 774..779
lib/shared/policy-statement/2-conditions.ts on lines 807..812
lib/shared/policy-statement/2-conditions.ts on lines 824..829
lib/shared/policy-statement/2-conditions.ts on lines 845..847
lib/shared/policy-statement/2-conditions.ts on lines 884..889
lib/shared/policy-statement/2-conditions.ts on lines 901..903
lib/shared/policy-statement/2-conditions.ts on lines 915..917

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

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