airbnb/caravel

View on GitHub
superset-frontend/src/views/CRUD/utils.test.tsx

Summary

Maintainability
F
4 days
Test Coverage

File utils.test.tsx has 494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
Severity: Minor
Found in superset-frontend/src/views/CRUD/utils.test.tsx - About 7 hrs to fix

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

    test('identifies error payloads indicating that ssh_tunnel password is needed', () => {
      let needsSSHTunnelPassword;
    
      needsSSHTunnelPassword = isNeedsSSHPassword({
        _schema: ['Must provide a password for the ssh tunnel'],
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 3 other locations - About 3 hrs to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 187..202
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 223..240
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 242..259

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

    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

    test('identifies error payloads indicating that ssh_tunnel private_key is needed', () => {
      let needsSSHTunnelPrivateKey;
    
      needsSSHTunnelPrivateKey = isNeedsSSHPrivateKey({
        _schema: ['Must provide a private key for the ssh tunnel'],
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 3 other locations - About 3 hrs to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 187..202
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 204..221
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 242..259

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

    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

    test('identifies error payloads indicating that ssh_tunnel private_key_password is needed', () => {
      let needsSSHTunnelPrivateKeyPassword;
    
      needsSSHTunnelPrivateKeyPassword = isNeedsSSHPrivateKeyPassword({
        _schema: ['Must provide a private key password for the ssh tunnel'],
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 3 other locations - About 3 hrs to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 187..202
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 204..221
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 223..240

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

    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

    test('identifies error payloads indicating that password is needed', () => {
      let needsPassword;
    
      needsPassword = isNeedsPassword({
        _schema: ['Must provide a password for the database'],
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 3 other locations - About 3 hrs to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 204..221
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 223..240
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 242..259

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

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

    const terminalErrors = {
      errors: [
        {
          message: 'Error importing database',
          error_type: 'GENERIC_COMMAND_ERROR',
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 1 hr to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 99..119
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 121..141
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 143..163
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 165..185

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

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

    const sshTunnelPasswordNeededErrors = {
      errors: [
        {
          message: 'Error importing database',
          error_type: 'GENERIC_COMMAND_ERROR',
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 1 hr to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 39..57
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 99..119
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 143..163
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 165..185

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

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

    const sshTunnelPrivateKeyNeededErrors = {
      errors: [
        {
          message: 'Error importing database',
          error_type: 'GENERIC_COMMAND_ERROR',
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 1 hr to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 39..57
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 99..119
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 121..141
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 165..185

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

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

    const sshTunnelPrivateKeyPasswordNeededErrors = {
      errors: [
        {
          message: 'Error importing database',
          error_type: 'GENERIC_COMMAND_ERROR',
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 1 hr to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 39..57
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 99..119
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 121..141
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 143..163

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

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

    const passwordNeededErrors = {
      errors: [
        {
          message: 'Error importing database',
          error_type: 'GENERIC_COMMAND_ERROR',
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 1 hr to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 39..57
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 121..141
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 143..163
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 165..185

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

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

    test('extracts files that need overwrite confirmation', () => {
      const alreadyExists = getAlreadyExists(overwriteNeededErrors.errors);
      expect(alreadyExists).toEqual(['databases/imported_database.yaml']);
    });
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 30 mins to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 278..281
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 283..288
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 290..295
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 297..304

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

    test('extracts DB configuration files that need ssh_tunnel private_key_passwords', () => {
      const sshPrivateKeyPasswordsNeeded = getSSHPrivateKeyPasswordsNeeded(
        sshTunnelPrivateKeyPasswordNeededErrors.errors,
      );
      expect(sshPrivateKeyPasswordsNeeded).toEqual([
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 30 mins to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 278..281
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 283..288
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 290..295
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 306..309

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

    test('extracts DB configuration files that need ssh_tunnel private_keys', () => {
      const sshPrivateKeysNeeded = getSSHPrivateKeysNeeded(
        sshTunnelPrivateKeyNeededErrors.errors,
      );
      expect(sshPrivateKeysNeeded).toEqual(['databases/imported_database.yaml']);
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 30 mins to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 278..281
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 283..288
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 297..304
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 306..309

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

    test('extracts DB configuration files that need passwords', () => {
      const passwordsNeeded = getPasswordsNeeded(passwordNeededErrors.errors);
      expect(passwordsNeeded).toEqual(['databases/imported_database.yaml']);
    });
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 30 mins to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 283..288
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 290..295
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 297..304
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 306..309

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

    test('extracts DB configuration files that need ssh_tunnel passwords', () => {
      const sshPasswordsNeeded = getSSHPasswordsNeeded(
        sshTunnelPasswordNeededErrors.errors,
      );
      expect(sshPasswordsNeeded).toEqual(['databases/imported_database.yaml']);
    Severity: Major
    Found in superset-frontend/src/views/CRUD/utils.test.tsx and 4 other locations - About 30 mins to fix
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 278..281
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 290..295
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 297..304
    superset-frontend/src/views/CRUD/utils.test.tsx on lines 306..309

    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

    There are no issues that match your filters.

    Category
    Status