theBenForce/data-migration

View on GitHub

Showing 43 of 43 total issues

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

                  Function dynamoDbDriver has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const dynamoDbDriver: DriverBuilder<DynamoDbParameters, AWS.DynamoDB.DocumentClient> = (
                    params,
                    logger: Logger
                  ): DynamoDbDriver => {
                    let { TableName } = params;
                  Severity: Minor
                  Found in plugins/drivers/dynamodb/src/index.ts - About 55 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

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

                  interface DynamoDbParameters {
                    region: string;
                    profile?: string;
                    TableName: string;
                    accessKeyId?: string;
                  Severity: Minor
                  Found in plugins/drivers/dynamodb/src/index.ts and 1 other location - About 40 mins to fix
                  plugins/drivers/lambda/src/index.ts on lines 4..11

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

                  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

                  interface LambdaParameters {
                    region: string;
                    profile?: string;
                    FunctionName: string;
                    accessKeyId?: string;
                  Severity: Minor
                  Found in plugins/drivers/lambda/src/index.ts and 1 other location - About 40 mins to fix
                  plugins/drivers/dynamodb/src/index.ts on lines 5..12

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

                  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 isOutputParameters(value: any): value is GetOutputParameters {
                    return value?.stack && value?.region && value?.output;
                  }
                  Severity: Minor
                  Found in plugins/processors/dm-processor-cf/src/index.ts and 1 other location - About 40 mins to fix
                  plugins/processors/dm-processor-cf/src/index.ts on lines 71..73

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

                  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 isResourceParameters(value: any): value is GetResourceParameters {
                    return value?.stack && value?.region && value?.logicalId;
                  }
                  Severity: Minor
                  Found in plugins/processors/dm-processor-cf/src/index.ts and 1 other location - About 40 mins to fix
                  plugins/processors/dm-processor-cf/src/index.ts on lines 64..66

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

                  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

                    return function log(message: string) {
                      if (observer && observer.error) {
                        observer.error(message);
                      } else {
                        // tslint:disable-next-line:no-console
                  Severity: Minor
                  Found in packages/data-migration/src/Utils.ts and 1 other location - About 35 mins to fix
                  packages/data-migration/src/Utils.ts on lines 26..33

                  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

                            try {
                              if (script.down) {
                                result = await script.down(context, scriptLogger);
                              }
                  
                  
                  Severity: Minor
                  Found in packages/data-migration/src/methods/GetScripts.ts and 1 other location - About 35 mins to fix
                  packages/data-migration/src/methods/GetScripts.ts on lines 52..63

                  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

                    return function (message: string) {
                      if (observer && observer.next) {
                        observer.next(message);
                      } else {
                        // tslint:disable-next-line:no-console
                  Severity: Minor
                  Found in packages/data-migration/src/Utils.ts and 1 other location - About 35 mins to fix
                  packages/data-migration/src/Utils.ts on lines 37..44

                  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

                            try {
                              result = await script.up(context, scriptLogger);
                              if (tracker) {
                                scriptLogger(`Marking as done`);
                                await tracker.markDone(fname, start, context.getDriversUsed());
                  Severity: Minor
                  Found in packages/data-migration/src/methods/GetScripts.ts and 1 other location - About 35 mins to fix
                  packages/data-migration/src/methods/GetScripts.ts on lines 73..87

                  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

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

                  const lambdaDriverBuilder: DriverBuilder<LambdaParameters, AWS.Lambda> = (
                    params,
                    logger: Logger
                  ): LambdaDriver => {
                    let FunctionName: string;
                  Severity: Minor
                  Found in plugins/drivers/lambda/src/index.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

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

                  const rdsDriver: DriverBuilder<AuroraRdsParameters, AWS.RDSDataService> = (
                    params: AuroraRdsParameters,
                    logger: Logger
                  ): AuroraRdsDriver => {
                    let dataService: AWS.RDSDataService;
                  Severity: Minor
                  Found in plugins/drivers/aurora-rds/src/index.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

                  Function run has a Cognitive Complexity of 6 (exceeds 5 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 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