mikaelvesavuori/archfit

View on GitHub

Showing 11 of 11 total issues

Function getTest has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private getTest(key: ArchFitTestName) {
    const input: Record<string, any> = {
      data: this.data,
      region: this.config.region,
      period: this.config.period
Severity: Major
Found in src/domain/services/ArchFit.ts - About 4 hrs to fix

    Function checkProvisioning has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function checkProvisioning(
      dynamoDBMaxUtilization: DynamoDBCapacityUtilization,
      dynamoDBTables: TableDescription[],
      threshold: number
    ): Record<string, any> {
    Severity: Minor
    Found in src/domain/fitness-functions/dynamoDBProvisionedThroughput.ts - About 1 hr to fix

      Function getDataForAPIGateway has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private async getDataForAPIGateway(region: string, period: number) {
          if (
            (this.hasTest('APIGatewayErrorRate') ||
              this.hasTest('APIGatewayRequestValidation')) &&
            !this.dataStore.hasData('apiGatewayInstances')
      Severity: Minor
      Found in src/application/services/FitnessDataService.ts - About 1 hr to fix

        Function main has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function main() {
          const config: ArchFitConfiguration = {
            region: 'eu-north-1',
            currency: 'EUR',
            period: 30,
        Severity: Minor
        Found in src/test.ts - About 1 hr to fix

          Function getDataForDynamoDB has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private async getDataForDynamoDB(region: string, period: number) {
              if (
                this.hasTest('DynamoDBOnDemandMode') ||
                this.hasTest('DynamoDBProvisionedThroughput')
              ) {
          Severity: Minor
          Found in src/application/services/FitnessDataService.ts - About 1 hr to fix

            Function costs has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const costs = (period: number) => {
              const {
                firstDayOfCurrentMonth,
                firstDayOfPeriod,
                midpointOfPeriod,
            Severity: Minor
            Found in testdata/service/costs.ts - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if (
                    (this.hasTest('LambdaArchitecture') ||
                      this.hasTest('LambdaDeadLetterQueueUsage') ||
                      this.hasTest('LambdaMemoryCap') ||
                      this.hasTest('LambdaRuntimes') ||
              Severity: Major
              Found in src/application/services/FitnessDataService.ts - About 1 hr to fix

                Function getOtherData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  private async getOtherData(region: string) {
                    if (this.hasTest('RatioServersToServerless')) {
                      if (!this.dataStore.hasData('ec2Instances'))
                        this.dataStore.store('ec2Instances', await getEC2Instances(region));
                      if (!this.dataStore.hasData('fargateTasks'))
                Severity: Minor
                Found in src/application/services/FitnessDataService.ts - About 45 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getPublicS3Buckets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export async function getPublicS3Buckets(region: string): Promise<string[]> {
                  const client = new S3Client({ region });
                  const buckets = await getS3Buckets(region);
                
                  const publicBuckets: string[] = [];
                Severity: Minor
                Found in src/infrastructure/aws/getPublicS3Buckets.ts - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getDataForDynamoDB has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  private async getDataForDynamoDB(region: string, period: number) {
                    if (
                      this.hasTest('DynamoDBOnDemandMode') ||
                      this.hasTest('DynamoDBProvisionedThroughput')
                    ) {
                Severity: Minor
                Found in src/application/services/FitnessDataService.ts - About 35 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getDataForAPIGateway has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private async getDataForAPIGateway(region: string, period: number) {
                    if (
                      (this.hasTest('APIGatewayErrorRate') ||
                        this.hasTest('APIGatewayRequestValidation')) &&
                      !this.dataStore.hasData('apiGatewayInstances')
                Severity: Minor
                Found in src/application/services/FitnessDataService.ts - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Severity
                Category
                Status
                Source
                Language