theBenForce/data-migration

View on GitHub

Showing 27 of 43 total issues

Function dynamoDbDriver has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const dynamoDbDriver: DriverBuilder<DynamoDbParameters, AWS.DynamoDB.DocumentClient> = (
  params,
  logger: Logger
): DynamoDbDriver => {
  let { TableName } = params;
Severity: Major
Found in plugins/drivers/dynamodb/src/index.ts - About 4 hrs to fix

    Function rdsDriver has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const rdsDriver: DriverBuilder<AuroraRdsParameters, AWS.RDSDataService> = (
      params: AuroraRdsParameters,
      logger: Logger
    ): AuroraRdsDriver => {
      let dataService: AWS.RDSDataService;
    Severity: Major
    Found in plugins/drivers/aurora-rds/src/index.ts - About 3 hrs to fix

      Function s3DriverBuilder has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const s3DriverBuilder: DriverBuilder<S3DriverParameters, AWS.S3> = (
        params,
        logger: Logger
      ): S3Driver => {
        let bucketName: string;
      Severity: Major
      Found in plugins/drivers/s3/src/index.ts - About 3 hrs to fix

        Function getScripts has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        export default async function getScripts({
          config,
          scope,
          context,
          log,
        Severity: Minor
        Found in packages/data-migration/src/methods/GetScripts.ts - About 3 hrs 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 lambdaDriverBuilder has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const lambdaDriverBuilder: DriverBuilder<LambdaParameters, AWS.Lambda> = (
          params,
          logger: Logger
        ): LambdaDriver => {
          let FunctionName: string;
        Severity: Major
        Found in plugins/drivers/lambda/src/index.ts - About 2 hrs to fix

          Function cognitoDriver has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const cognitoDriver: DriverBuilder<CognitoDriverParams, AWS.CognitoIdentityServiceProvider> = (
            params,
            logger: Logger
          ): CognitoDriver => {
            let cognitoidentityserviceprovider: AWS.CognitoIdentityServiceProvider;
          Severity: Major
          Found in plugins/drivers/cognito/src/index.ts - About 2 hrs to fix

            Function tracker has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const tracker: ExecutionTracker<DynamoTrackerParams> = (params, log: Logger) => {
              const { TableName } = params;
              const DocumentDb = new AWS.DynamoDB.DocumentClient({
                region: params.region,
                apiVersion: "2012-08-10",
            Severity: Major
            Found in plugins/trackers/dynamo/src/index.ts - About 2 hrs to fix

              Function run has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async run() {
                  const { args, flags } = this.parse(List);
                  const { scripts } = await loadScripts(flags);
              
                  cli.info(`Found ${scripts.length} scripts`);
              Severity: Minor
              Found in packages/data-migration-cli/src/commands/list.ts - About 1 hr to fix

                Function createScriptContext has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function createScriptContext(
                  drivers: Map<string, Driver<any, any>>,
                  config: { [key: string]: string },
                  log: Logger,
                  defaultParams?: Record<string, string>
                Severity: Minor
                Found in packages/data-migration/src/methods/CreateScriptContext.ts - About 1 hr 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 loadScripts has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default async function loadScripts(
                  flags: DefaultFlagParameters
                ): Promise<LoadScriptsResult> {
                  let config = await loadConfiguration(path.resolve(flags.config), { flags });
                  let stage = "prod";
                Severity: Minor
                Found in packages/data-migration-cli/src/utils/loadScripts.ts - About 1 hr to fix

                  Function run has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async run() {
                      const { flags } = this.parse(Up);
                      let stage: string = "";
                      let scripts: Array<InitializedMigrationScript>;
                      let context: ScriptContext;
                  Severity: Minor
                  Found in packages/data-migration-cli/src/commands/up.ts - About 1 hr to fix

                    Function default has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function (flags: DefaultFlagParameters, numberToRun: number = Infinity): Listr {
                      let stage: string = "";
                      let scripts: Array<InitializedMigrationScript>;
                      let context: ScriptContext;
                    
                    
                    Severity: Minor
                    Found in packages/data-migration-cli/src/utils/createDownMigrationTasks.ts - About 1 hr to fix

                      Function loadScript has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export async function loadScript<T>(
                        filename: string,
                        log: Logger,
                        scriptGlobals?: any
                      ): Promise<T> {
                      Severity: Minor
                      Found in packages/data-migration/src/Utils.ts - About 1 hr to fix

                        Function createScriptContext has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function createScriptContext(
                          drivers: Map<string, Driver<any, any>>,
                          config: { [key: string]: string },
                          log: Logger,
                          defaultParams?: Record<string, string>
                        Severity: Minor
                        Found in packages/data-migration/src/methods/CreateScriptContext.ts - About 1 hr to fix

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

                              async putRecordsBulk<T>(records: Array<T>): Promise<Array<T>> {
                                logger(`Writing ${records.length} entries to ${TableName}`);
                          
                                const params = {
                                  ReturnConsumedCapacity: "INDEXES",
                          Severity: Minor
                          Found in plugins/drivers/dynamodb/src/index.ts - About 1 hr to fix

                            Function getStackOutput has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            async function getStackOutput(
                              params: GetOutputParameters
                            ): Promise<Array<AWS.CloudFormation.Output>> {
                              const region = params[REGION_KEY];
                              const stackName = params[STACK_KEY];
                            Severity: Minor
                            Found in plugins/processors/dm-processor-cf/src/index.ts - About 1 hr to fix

                              Function getResourceValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              async function getResourceValue(log: Logger, params: GetResourceParameters): Promise<string> {
                                const { stack, region, logicalId } = params;
                                log(`Getting details for ${region} stack ${stack}`);
                              
                                let data: ListStackResourcesOutput;
                              Severity: Minor
                              Found in plugins/processors/dm-processor-cf/src/index.ts - About 1 hr to fix

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

                                export default async function ProcessParams(
                                  params: Record<string, string | ProcessorParams>,
                                  log: Logger,
                                  defaultParams?: Record<string, string>
                                ): Promise<Record<string, string>> {
                                Severity: Minor
                                Found in packages/data-migration/src/methods/ProcessParams.ts - About 1 hr to fix

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

                                      async cleanup() {
                                        if (!Object.keys(updatedVariables).length) {
                                          return;
                                        }
                                  
                                  
                                  Severity: Minor
                                  Found in plugins/drivers/lambda/src/index.ts - About 1 hr to fix

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

                                      async run() {
                                        const { args, flags } = this.parse(New);
                                    
                                        let config = await loadConfiguration(path.resolve(flags.config));
                                        const prefix = DataMigrationProcessor.getMigrationsPath(config, flags.scope);
                                    Severity: Minor
                                    Found in packages/data-migration-cli/src/commands/new.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language