joselitofilho / aws-terraform-generator

The AWS Terraform Generator is a powerful tool designed to simplify and streamline the process of creating Terraform configurations for AWS infrastructure. With this tool, you can quickly generate Terraform code to provision AWS resources such as EC2 instances, S3 buckets, RDS databases, Lambda functions, API Gateways, and much more.
MIT License
14 stars 1 forks source link

Code complexity (improvement tips for less complex software) #3

Open marcelloh opened 8 months ago

marcelloh commented 8 months ago

Read about it here (if you haven't already)

This is the result of my complexity linter, do with it what you like ;-)

─────┤░░░▒▒▒▓▓▓ GoGognitive ▓▓▓▒▒▒░░░├─────

1 - aws-terraform-generator
aws-terraform-generator/internal/generators/apigateway/apigateway.go:26:1 - Build has complexity: 20
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 26, complexity = 2)
  + 1 (found 'function with (59) lines >= 50 ' at line: 26, complexity = 3)
  + 1 (found 'if' at line: 30, complexity = 4)
  + 1 (found 'range' at line: 49, complexity = 5)
  + 1 (found 'range with (33) lines >= 10 ' at line: 49, complexity = 6)
  + 1 (found 'range with (33) lines >= 25 ' at line: 49, complexity = 7)
    + 2 (found 'if' at line: 56, complexity = 9)
    + 2 (found 'if with (17) lines >= 10 ' at line: 56, complexity = 11)
      + 3 (found 'logical operator (1 times) && (AND)' at line: 56, complexity = 12)
      + 3 (found 'if' at line: 67, complexity = 15)
    + 2 (found 'range' at line: 74, complexity = 17)
      + 3 (found 'if' at line: 77, complexity = 20)

aws-terraform-generator/internal/generators/draw/draw.go:46:1 - Build has complexity: 15
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 46, complexity = 2)
  + 1 (found 'function with (73) lines >= 50 ' at line: 46, complexity = 3)
  + 1 (found 'if' at line: 50, complexity = 4)
  + 1 (found 'if' at line: 55, complexity = 5)
  + 1 (found 'if' at line: 64, complexity = 6)
  + 1 (found 'if' at line: 69, complexity = 7)
  + 1 (found 'if' at line: 76, complexity = 8)
  + 1 (found 'if' at line: 81, complexity = 9)
  + 1 (found 'defer' at line: 84, complexity = 10)
  + 1 (found 'if' at line: 86, complexity = 11)
  + 1 (found 'if' at line: 99, complexity = 12)
  + 1 (found 'if' at line: 106, complexity = 13)
  + 1 (found 'defer' at line: 109, complexity = 14)
  + 1 (found 'if' at line: 111, complexity = 15)

aws-terraform-generator/internal/generators/generators.go:212:1 - GenerateFiles has complexity: 10
  complexity = 1
  + 1 (found 'range' at line: 215, complexity = 2)
  + 1 (found 'range' at line: 219, complexity = 3)
  + 1 (found 'range' at line: 223, complexity = 4)
  + 1 (found 'range with (17) lines >= 10 ' at line: 223, complexity = 5)
    + 2 (found 'if' at line: 229, complexity = 7)
    + 2 (found 'if' at line: 235, complexity = 9)
      + 3 (found 'logical operator (1 times) && (AND)' at line: 235, complexity = 10)

aws-terraform-generator/internal/generators/graphviz/graphviz.go:68:1 - applyStyleForArrows has complexity: 19
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 68, complexity = 2)
  + 1 (found 'range' at line: 71, complexity = 3)
  + 1 (found 'range with (21) lines >= 10 ' at line: 71, complexity = 4)
    + 2 (found 'if' at line: 72, complexity = 6)
      + 3 (found 'logical operator (1 times) || (OR)' at line: 72, complexity = 7)
      + 3 (found 'branch' at line: 73, complexity = 10)
    + 2 (found 'if' at line: 77, complexity = 12)
      + 3 (found 'branch' at line: 78, complexity = 15)
    + 2 (found 'if' at line: 84, complexity = 17)
    + 2 (found 'else' at line: 86, complexity = 19)

aws-terraform-generator/internal/generators/graphviz/graphviz.go:96:1 - applyCustomArrowStyles has complexity: 15
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 96, complexity = 2)
  + 1 (found 'range' at line: 97, complexity = 3)
  + 1 (found 'range with (13) lines >= 10 ' at line: 97, complexity = 4)
    + 2 (found 'range' at line: 98, complexity = 6)
    + 2 (found 'range with (11) lines >= 10 ' at line: 98, complexity = 8)
      + 3 (found 'range' at line: 99, complexity = 11)
        + 4 (found 'if' at line: 102, complexity = 15)

aws-terraform-generator/internal/generators/kinesis/kinesis.go:33:1 - Build has complexity: 23
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 33, complexity = 2)
  + 1 (found 'function with (60) lines >= 50 ' at line: 33, complexity = 3)
  + 1 (found 'if' at line: 37, complexity = 4)
  + 1 (found 'range' at line: 49, complexity = 5)
  + 1 (found 'range with (30) lines >= 10 ' at line: 49, complexity = 6)
  + 1 (found 'range with (30) lines >= 25 ' at line: 49, complexity = 7)
    + 2 (found 'if' at line: 59, complexity = 9)
    + 2 (found 'if with (12) lines >= 10 ' at line: 59, complexity = 11)
      + 3 (found 'if' at line: 63, complexity = 14)
      + 3 (found 'branch' at line: 69, complexity = 17)
    + 2 (found 'if' at line: 73, complexity = 19)
  + 1 (found 'if' at line: 80, complexity = 20)
  + 1 (found 'if with (10) lines >= 10 ' at line: 80, complexity = 21)
    + 2 (found 'if' at line: 84, complexity = 23)

aws-terraform-generator/internal/generators/lambda/lambda.go:26:1 - Build has complexity: 14
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 26, complexity = 2)
  + 1 (found 'function with (69) lines >= 50 ' at line: 26, complexity = 3)
  + 1 (found 'if' at line: 30, complexity = 4)
  + 1 (found 'range' at line: 40, complexity = 5)
  + 1 (found 'range with (52) lines >= 10 ' at line: 40, complexity = 6)
  + 1 (found 'range with (52) lines >= 25 ' at line: 40, complexity = 7)
  + 1 (found 'range with (52) lines >= 50 ' at line: 40, complexity = 8)
    + 2 (found 'if' at line: 52, complexity = 10)
    + 2 (found 'if' at line: 76, complexity = 12)
    + 2 (found 'if' at line: 86, complexity = 14)

aws-terraform-generator/internal/generators/s3/s3.go:31:1 - Build has complexity: 23
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 31, complexity = 2)
  + 1 (found 'function with (58) lines >= 50 ' at line: 31, complexity = 3)
  + 1 (found 'if' at line: 35, complexity = 4)
  + 1 (found 'range' at line: 47, complexity = 5)
  + 1 (found 'range with (28) lines >= 10 ' at line: 47, complexity = 6)
  + 1 (found 'range with (28) lines >= 25 ' at line: 47, complexity = 7)
    + 2 (found 'if' at line: 55, complexity = 9)
    + 2 (found 'if with (12) lines >= 10 ' at line: 55, complexity = 11)
      + 3 (found 'if' at line: 59, complexity = 14)
      + 3 (found 'branch' at line: 65, complexity = 17)
    + 2 (found 'if' at line: 69, complexity = 19)
  + 1 (found 'if' at line: 76, complexity = 20)
  + 1 (found 'if with (10) lines >= 10 ' at line: 76, complexity = 21)
    + 2 (found 'if' at line: 80, complexity = 23)

aws-terraform-generator/internal/generators/sns/sns.go:40:1 - Build has complexity: 23
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 40, complexity = 2)
  + 1 (found 'function with (61) lines >= 50 ' at line: 40, complexity = 3)
  + 1 (found 'if' at line: 44, complexity = 4)
  + 1 (found 'range' at line: 56, complexity = 5)
  + 1 (found 'range with (31) lines >= 10 ' at line: 56, complexity = 6)
  + 1 (found 'range with (31) lines >= 25 ' at line: 56, complexity = 7)
    + 2 (found 'if' at line: 67, complexity = 9)
    + 2 (found 'if with (12) lines >= 10 ' at line: 67, complexity = 11)
      + 3 (found 'if' at line: 71, complexity = 14)
      + 3 (found 'branch' at line: 77, complexity = 17)
    + 2 (found 'if' at line: 81, complexity = 19)
  + 1 (found 'if' at line: 88, complexity = 20)
  + 1 (found 'if with (10) lines >= 10 ' at line: 88, complexity = 21)
    + 2 (found 'if' at line: 92, complexity = 23)

aws-terraform-generator/internal/generators/sqs/sqs.go:31:1 - Build has complexity: 23
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 31, complexity = 2)
  + 1 (found 'function with (58) lines >= 50 ' at line: 31, complexity = 3)
  + 1 (found 'if' at line: 35, complexity = 4)
  + 1 (found 'range' at line: 47, complexity = 5)
  + 1 (found 'range with (28) lines >= 10 ' at line: 47, complexity = 6)
  + 1 (found 'range with (28) lines >= 25 ' at line: 47, complexity = 7)
    + 2 (found 'if' at line: 55, complexity = 9)
    + 2 (found 'if with (12) lines >= 10 ' at line: 55, complexity = 11)
      + 3 (found 'if' at line: 59, complexity = 14)
      + 3 (found 'branch' at line: 65, complexity = 17)
    + 2 (found 'if' at line: 69, complexity = 19)
  + 1 (found 'if' at line: 76, complexity = 20)
  + 1 (found 'if with (10) lines >= 10 ' at line: 76, complexity = 21)
    + 2 (found 'if' at line: 80, complexity = 23)

aws-terraform-generator/internal/generators/structure/structure.go:24:1 - Build has complexity: 16
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 24, complexity = 2)
  + 1 (found 'if' at line: 28, complexity = 3)
  + 1 (found 'range' at line: 34, complexity = 4)
  + 1 (found 'range with (23) lines >= 10 ' at line: 34, complexity = 5)
    + 2 (found 'range' at line: 41, complexity = 7)
    + 2 (found 'range with (13) lines >= 10 ' at line: 41, complexity = 9)
      + 3 (found 'range' at line: 45, complexity = 12)
        + 4 (found 'if' at line: 49, complexity = 16)

aws-terraform-generator/internal/generators/terraform/terraform.go:97:1 - parseHCLFile has complexity: 11
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 97, complexity = 2)
  + 1 (found 'if' at line: 98, complexity = 3)
  + 1 (found 'if with (13) lines >= 10 ' at line: 98, complexity = 4)
    + 2 (found 'if' at line: 100, complexity = 6)
    + 2 (found 'if with (10) lines >= 10 ' at line: 100, complexity = 8)
      + 3 (found 'if' at line: 102, complexity = 11)

aws-terraform-generator/internal/generators/terraform/terraform.go:172:1 - parseResourcesFromEnvironment has complexity: 23
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 172, complexity = 2)
  + 1 (found 'if' at line: 173, complexity = 3)
  + 1 (found 'if with (24) lines >= 10 ' at line: 173, complexity = 4)
    + 2 (found 'if' at line: 174, complexity = 6)
    + 2 (found 'range' at line: 180, complexity = 8)
    + 2 (found 'range with (16) lines >= 10 ' at line: 180, complexity = 10)
      + 3 (found 'if' at line: 183, complexity = 13)
      + 3 (found 'type switch' at line: 187, complexity = 16)
      + 3 (found 'case with (4) lines >= 3 ' at line: 188, complexity = 19)
        + 4 (found 'range' at line: 189, complexity = 23)

aws-terraform-generator/internal/generators/terraform/terraform.go:212:1 - buildVarExpressions has complexity: 16
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 212, complexity = 2)
  + 1 (found 'range' at line: 215, complexity = 3)
  + 1 (found 'range with (12) lines >= 10 ' at line: 215, complexity = 4)
    + 2 (found 'type switch' at line: 216, complexity = 6)
    + 2 (found 'case with (4) lines >= 3 ' at line: 217, complexity = 8)
      + 3 (found 'if' at line: 218, complexity = 11)
    + 2 (found 'case with (4) lines >= 3 ' at line: 221, complexity = 13)
      + 3 (found 'if' at line: 222, complexity = 16)

aws-terraform-generator/internal/generators/terraform/terraform.go:249:1 - evaluateExpression has complexity: 11
  complexity = 1
  + 1 (found 'type switch' at line: 253, complexity = 2)
  + 1 (found 'case with (5) lines >= 3 ' at line: 258, complexity = 3)
    + 2 (found 'range' at line: 260, complexity = 5)
  + 1 (found 'case with (4) lines >= 3 ' at line: 263, complexity = 6)
    + 2 (found 'range' at line: 264, complexity = 8)
  + 1 (found 'case with (8) lines >= 3 ' at line: 269, complexity = 9)
    + 2 (found 'range' at line: 270, complexity = 11)

aws-terraform-generator/internal/generators/terraform/terraform.go:288:1 - evaluateFunctionExpression has complexity: 21
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 288, complexity = 2)
  + 1 (found 'range' at line: 291, complexity = 3)
  + 1 (found 'range with (27) lines >= 10 ' at line: 291, complexity = 4)
  + 1 (found 'range with (27) lines >= 25 ' at line: 291, complexity = 5)
    + 2 (found 'type switch' at line: 296, complexity = 7)
    + 2 (found 'case with (15) lines >= 3 ' at line: 299, complexity = 9)
    + 2 (found 'case with (15) lines >= 10 ' at line: 299, complexity = 11)
      + 3 (found 'range' at line: 302, complexity = 14)
      + 3 (found 'range with (10) lines >= 10 ' at line: 302, complexity = 17)
        + 4 (found 'type switch' at line: 305, complexity = 21)

aws-terraform-generator/internal/guides/code.go:19:1 - GuideCode has complexity: 9
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 19, complexity = 2)
  + 1 (found 'if' at line: 20, complexity = 3)
  + 1 (found 'if' at line: 31, complexity = 4)
  + 1 (found 'range' at line: 40, complexity = 5)
    + 2 (found 'if' at line: 41, complexity = 7)
  + 1 (found 'if' at line: 47, complexity = 8)
  + 1 (found 'if' at line: 57, complexity = 9)

aws-terraform-generator/internal/guides/diagram.go:18:1 - GuideDiagram has complexity: 11
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 18, complexity = 2)
  + 1 (found 'function with (62) lines >= 50 ' at line: 18, complexity = 3)
  + 1 (found 'if' at line: 19, complexity = 4)
  + 1 (found 'if' at line: 23, complexity = 5)
  + 1 (found 'range' at line: 37, complexity = 6)
    + 2 (found 'if' at line: 38, complexity = 8)
  + 1 (found 'if' at line: 43, complexity = 9)
  + 1 (found 'if with (20) lines >= 10 ' at line: 43, complexity = 10)
  + 1 (found 'if' at line: 64, complexity = 11)

aws-terraform-generator/internal/resources/diff.go:10:1 - FindDifferences has complexity: 15
  complexity = 1
  + 1 (found 'range' at line: 17, complexity = 2)
  + 1 (found 'range' at line: 22, complexity = 3)
  + 1 (found 'range' at line: 28, complexity = 4)
    + 2 (found 'if' at line: 29, complexity = 6)
  + 1 (found 'range' at line: 36, complexity = 7)
    + 2 (found 'if' at line: 37, complexity = 9)
  + 1 (found 'range' at line: 43, complexity = 10)
    + 2 (found 'if' at line: 44, complexity = 12)
  + 1 (found 'range' at line: 49, complexity = 13)
    + 2 (found 'if' at line: 50, complexity = 15)

aws-terraform-generator/internal/transformers/drawiotoresources/transformer.go:12:1 - Transform has complexity: 14
  complexity = 1
  + 1 (found 'range' at line: 15, complexity = 2)
    + 2 (found 'if' at line: 19, complexity = 4)
  + 1 (found 'range' at line: 25, complexity = 5)
  + 1 (found 'range' at line: 29, complexity = 6)
  + 1 (found 'range with (11) lines >= 10 ' at line: 29, complexity = 7)
    + 2 (found 'if' at line: 31, complexity = 9)
      + 3 (found 'logical operator (1 times) && (AND)' at line: 31, complexity = 10)
      + 3 (found 'if' at line: 35, complexity = 13)
        + 4 (found 'logical operator (1 times) && (AND)' at line: 35, complexity = 14)

aws-terraform-generator/internal/transformers/resourcestoyaml/lambda.go:26:1 - buildLambdas has complexity: 16
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 26, complexity = 2)
  + 1 (found 'function with (54) lines >= 50 ' at line: 26, complexity = 3)
  + 1 (found 'range' at line: 32, complexity = 4)
  + 1 (found 'range with (23) lines >= 10 ' at line: 32, complexity = 5)
    + 2 (found 'if' at line: 36, complexity = 7)
    + 2 (found 'if with (18) lines >= 10 ' at line: 36, complexity = 9)
  + 1 (found 'range' at line: 56, complexity = 10)
  + 1 (found 'range with (21) lines >= 10 ' at line: 56, complexity = 11)
    + 2 (found 'if' at line: 57, complexity = 13)
      + 3 (found 'branch' at line: 58, complexity = 16)

aws-terraform-generator/internal/transformers/terraformtoresources/transformer.go:120:1 - buildRelationships has complexity: 19
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 120, complexity = 2)
  + 1 (found 'range' at line: 121, complexity = 3)
  + 1 (found 'range with (21) lines >= 10 ' at line: 121, complexity = 4)
    + 2 (found 'range' at line: 124, complexity = 6)
    + 2 (found 'range with (17) lines >= 10 ' at line: 124, complexity = 8)
      + 3 (found 'if' at line: 129, complexity = 11)
        + 4 (found 'range' at line: 130, complexity = 15)
        + 4 (found 'branch' at line: 136, complexity = 19)

aws-terraform-generator/internal/transformers/terraformtoresources/transformer.go:144:1 - getResourceByARN has complexity: 23
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 144, complexity = 2)
  + 1 (found 'switch' at line: 145, complexity = 3)
  + 1 (found 'case with (6) lines >= 3 ' at line: 154, complexity = 4)
    + 2 (found 'if' at line: 155, complexity = 6)
    + 2 (found 'else' at line: 157, complexity = 8)
  + 1 (found 'case with (6) lines >= 3 ' at line: 160, complexity = 9)
    + 2 (found 'if' at line: 161, complexity = 11)
    + 2 (found 'else' at line: 163, complexity = 13)
  + 1 (found 'case with (6) lines >= 3 ' at line: 166, complexity = 14)
    + 2 (found 'if' at line: 167, complexity = 16)
    + 2 (found 'else' at line: 169, complexity = 18)
  + 1 (found 'case with (6) lines >= 3 ' at line: 172, complexity = 19)
    + 2 (found 'if' at line: 173, complexity = 21)
    + 2 (found 'else' at line: 175, complexity = 23)

aws-terraform-generator/internal/transformers/terraformtoresources/transformer.go:183:1 - hasResourceMatched has complexity: 28
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 183, complexity = 2)
  + 1 (found 'if' at line: 184, complexity = 3)
  + 1 (found 'if' at line: 189, complexity = 4)
  + 1 (found 'range' at line: 195, complexity = 5)
  + 1 (found 'range with (12) lines >= 10 ' at line: 195, complexity = 6)
    + 2 (found 'if' at line: 197, complexity = 8)
      + 3 (found 'branch' at line: 199, complexity = 11)
    + 2 (found 'if' at line: 202, complexity = 13)
      + 3 (found 'branch' at line: 204, complexity = 16)
  + 1 (found 'range' at line: 208, complexity = 17)
  + 1 (found 'range with (12) lines >= 10 ' at line: 208, complexity = 18)
    + 2 (found 'if' at line: 210, complexity = 20)
      + 3 (found 'branch' at line: 212, complexity = 23)
    + 2 (found 'if' at line: 215, complexity = 25)
      + 3 (found 'branch' at line: 217, complexity = 28)

aws-terraform-generator/internal/transformers/terraformtoresources/transformer.go:236:1 - processTerraformResources has complexity: 12
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 236, complexity = 2)
  + 1 (found 'range' at line: 237, complexity = 3)
  + 1 (found 'range with (26) lines >= 10 ' at line: 237, complexity = 4)
  + 1 (found 'range with (26) lines >= 25 ' at line: 237, complexity = 5)
    + 2 (found 'if' at line: 238, complexity = 7)
    + 2 (found 'if with (24) lines >= 10 ' at line: 238, complexity = 9)
      + 3 (found 'switch' at line: 239, complexity = 12)

aws-terraform-generator/internal/transformers/terraformtoresources/transformer.go:371:1 - processLambda has complexity: 28
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 371, complexity = 2)
  + 1 (found 'function with (61) lines >= 50 ' at line: 371, complexity = 3)
  + 1 (found 'range' at line: 378, complexity = 4)
    + 2 (found 'if' at line: 379, complexity = 6)
      + 3 (found 'branch' at line: 384, complexity = 9)
  + 1 (found 'if' at line: 388, complexity = 10)
  + 1 (found 'if' at line: 394, complexity = 11)
  + 1 (found 'range' at line: 405, complexity = 12)
  + 1 (found 'range with (26) lines >= 10 ' at line: 405, complexity = 13)
  + 1 (found 'range with (26) lines >= 25 ' at line: 405, complexity = 14)
    + 2 (found 'switch' at line: 406, complexity = 16)
    + 2 (found 'case with (4) lines >= 3 ' at line: 407, complexity = 18)
    + 2 (found 'case with (4) lines >= 3 ' at line: 411, complexity = 20)
    + 2 (found 'case with (3) lines >= 3 ' at line: 415, complexity = 22)
    + 2 (found 'case with (4) lines >= 3 ' at line: 418, complexity = 24)
    + 2 (found 'case with (4) lines >= 3 ' at line: 422, complexity = 26)
    + 2 (found 'case with (3) lines >= 3 ' at line: 426, complexity = 28)

aws-terraform-generator/internal/transformers/terraformtoresources/vars.go:11:1 - buildKeyValueFromLocals has complexity: 11
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 11, complexity = 2)
  + 1 (found 'range' at line: 14, complexity = 3)
  + 1 (found 'range with (16) lines >= 10 ' at line: 14, complexity = 4)
    + 2 (found 'range' at line: 15, complexity = 6)
    + 2 (found 'range with (14) lines >= 10 ' at line: 15, complexity = 8)
      + 3 (found 'type switch' at line: 18, complexity = 11)

aws-terraform-generator/internal/transformers/terraformtoresources/vars.go:34:1 - buildKeyValueFromVariables has complexity: 11
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 34, complexity = 2)
  + 1 (found 'range' at line: 37, complexity = 3)
  + 1 (found 'range with (16) lines >= 10 ' at line: 37, complexity = 4)
    + 2 (found 'range' at line: 38, complexity = 6)
    + 2 (found 'range with (14) lines >= 10 ' at line: 38, complexity = 8)
      + 3 (found 'type switch' at line: 41, complexity = 11)

aws-terraform-generator/internal/transformers/terraformtoresources/vars.go:93:1 - replaceVariables has complexity: 10
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 93, complexity = 2)
  + 1 (found 'for' at line: 94, complexity = 3)
    + 2 (found 'range' at line: 95, complexity = 5)
    + 2 (found 'if' at line: 99, complexity = 7)
      + 3 (found 'branch' at line: 100, complexity = 10)

aws-terraform-generator/internal/transformers/terraformtoresources/vars.go:107:1 - replaceLocals has complexity: 10
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 107, complexity = 2)
  + 1 (found 'for' at line: 108, complexity = 3)
    + 2 (found 'range' at line: 109, complexity = 5)
    + 2 (found 'if' at line: 113, complexity = 7)
      + 3 (found 'branch' at line: 114, complexity = 10)

aws-terraform-generator/internal/transformers/terraformtoresources/vars.go:121:1 - replaceStrings has complexity: 15
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 121, complexity = 2)
  + 1 (found 'for' at line: 122, complexity = 3)
  + 1 (found 'for with (11) lines >= 10 ' at line: 122, complexity = 4)
    + 2 (found 'range' at line: 123, complexity = 6)
    + 2 (found 'range' at line: 127, complexity = 8)
      + 3 (found 'if' at line: 128, complexity = 11)
        + 4 (found 'branch' at line: 129, complexity = 15)

aws-terraform-generator/internal/transformers/yamltoresources/transformer.go:118:1 - extractResourcesByType has complexity: 10
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 118, complexity = 2)
  + 1 (found 'range' at line: 122, complexity = 3)
  + 1 (found 'range with (21) lines >= 10 ' at line: 122, complexity = 4)
    + 2 (found 'if' at line: 126, complexity = 6)
      + 3 (found 'logical operator (2 times) || (OR)' at line: 126, complexity = 8)
    + 2 (found 'if' at line: 134, complexity = 10)

aws-terraform-generator/internal/transformers/yamltoresources/transformer.go:195:1 - transformAPIGateways has complexity: 16
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 195, complexity = 2)
  + 1 (found 'range' at line: 198, complexity = 3)
  + 1 (found 'range with (40) lines >= 10 ' at line: 198, complexity = 4)
  + 1 (found 'range with (40) lines >= 25 ' at line: 198, complexity = 5)
    + 2 (found 'if' at line: 202, complexity = 7)
    + 2 (found 'range' at line: 210, complexity = 9)
    + 2 (found 'range with (27) lines >= 10 ' at line: 210, complexity = 11)
    + 2 (found 'range with (27) lines >= 25 ' at line: 210, complexity = 13)
      + 3 (found 'if' at line: 216, complexity = 16)

aws-terraform-generator/internal/transformers/yamltoresources/transformer.go:240:1 - transformLambda has complexity: 10
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 240, complexity = 2)
  + 1 (found 'if' at line: 243, complexity = 3)
  + 1 (found 'if' at line: 251, complexity = 4)
  + 1 (found 'range' at line: 260, complexity = 5)
  + 1 (found 'range with (15) lines >= 10 ' at line: 260, complexity = 6)
    + 2 (found 'if' at line: 264, complexity = 8)
  + 1 (found 'range' at line: 278, complexity = 9)
  + 1 (found 'range' at line: 283, complexity = 10)

aws-terraform-generator/internal/transformers/yamltoresources/transformer.go:297:1 - transformLambdaEnvars has complexity: 13
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 297, complexity = 2)
  + 1 (found 'too many arguments : 6 (max: 5 is allowed)' at line: 297, complexity = 3)
  + 1 (found 'range' at line: 301, complexity = 4)
  + 1 (found 'range with (23) lines >= 10 ' at line: 301, complexity = 5)
    + 2 (found 'switch' at line: 304, complexity = 7)
    + 2 (found 'case with (3) lines >= 3 ' at line: 309, complexity = 9)
    + 2 (found 'case with (3) lines >= 3 ' at line: 312, complexity = 11)
    + 2 (found 'case with (3) lines >= 3 ' at line: 315, complexity = 13)

aws-terraform-generator/internal/transformers/yamltoresources/transformer.go:326:1 - getValueTypeFromEnvar has complexity: 10
  complexity = 1
  + 1 (found 'missing or wrong comment for function with more that 10 lines' at line: 326, complexity = 2)
  + 1 (found 'switch' at line: 327, complexity = 3)
  + 1 (found 'case with (3) lines >= 3 ' at line: 328, complexity = 4)
  + 1 (found 'case with (3) lines >= 3 ' at line: 331, complexity = 5)
  + 1 (found 'case with (3) lines >= 3 ' at line: 334, complexity = 6)
  + 1 (found 'case with (3) lines >= 3 ' at line: 337, complexity = 7)
  + 1 (found 'case with (3) lines >= 3 ' at line: 340, complexity = 8)
  + 1 (found 'case with (3) lines >= 3 ' at line: 343, complexity = 9)
  + 1 (found 'case with (3) lines >= 3 ' at line: 346, complexity = 10)

91 = files
200 = functions
3148 = function lines
36 = complex functions
1371 = complex function lines
18.00 % are complex functions
43.55 % of lines belong to complex functions
5.01 = overall average complexity per function

28 = highest complexity
aws-terraform-generator/internal/transformers/terraformtoresources/transformer.go:183:1 - hasResourceMatched has complexity: 28

0 = complex lines

busy for: 32.183834ms
joselitofilho commented 8 months ago

Hi @marcelloh,

Thank you for sharing that. Would you mind sending me your .golangci.yaml file? I'd like to merge it with the current one to replicate all these cases above.

marcelloh commented 8 months ago

I'm sorry, this is a self made linter that works better than the ones inside golangci-lint. (Of course I will lint again if you ask me)

joselitofilho commented 8 months ago

@marcelloh ,

I'm wondering if you could create an application similar to this: https://goreportcard.com/. This way, we could analyze our projects there to identify issues using your linter.

marcelloh commented 8 months ago

No, because I'm perhaps making this tool commercially available (only for people I like very much: it's free)