airbnb/caravel

View on GitHub
superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx

Summary

Maintainability
C
1 day
Test Coverage

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

test('should render with error theme', () => {
  const errorProps = {
    ...mockedProps,
    level: 'error' as ErrorLevel,
  };
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 173..184

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

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

test('should render error icon', () => {
  const errorProps = {
    ...mockedProps,
    level: 'error' as ErrorLevel,
  };
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 68..75

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

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

test('should render with warning theme', () => {
  render(<BasicErrorAlert {...mockedProps} />);
  expect(screen.getByRole('alert')).toHaveStyle(
    `
      backgroundColor: ${supersetTheme.colors.warning.light2};
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 164..171

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

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

jest.mock(
  'src/components/Icons/Icon',
  () =>
    ({ fileName }: { fileName: string }) => (
      <span role="img" aria-label={fileName.replace('_', '-')} />
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 25..31
superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx on lines 24..30
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 26..32
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx on lines 26..32
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 25..31
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 25..31
superset-frontend/src/explore/components/controls/FixedOrMetricControl/FixedOrMetricControl.test.tsx on lines 23..29
superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.test.tsx on lines 38..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 64.

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

test('should render warning icon', () => {
  render(<BasicErrorAlert {...mockedProps} />);
  expect(
    screen.getByRole('img', { name: 'warning-solid' }),
  ).toBeInTheDocument();
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 61..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 58.

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

test('should render', () => {
  const { container } = render(<BasicErrorAlert {...mockedProps} />);
  expect(container).toBeInTheDocument();
});
superset-frontend/src/components/Badge/Badge.test.tsx on lines 27..30
superset-frontend/src/components/Datasource/Field.test.tsx on lines 34..37
superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx on lines 42..47
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 56..59
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx on lines 41..44
superset-frontend/src/components/ErrorMessage/IssueCode.test.tsx on lines 28..31
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 57..60
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 56..59
superset-frontend/src/components/ModalTrigger/ModalTrigger.test.tsx on lines 28..31
superset-frontend/src/components/ProgressBar/ProgressBar.test.tsx on lines 26..29
superset-frontend/src/components/Slider/Slider.test.tsx on lines 29..32
superset-frontend/src/components/TableView/TableView.test.tsx on lines 46..49
superset-frontend/src/components/Tags/Tag.test.tsx on lines 32..35
superset-frontend/src/components/Tags/TagsList.test.tsx on lines 56..59
superset-frontend/src/explore/components/controls/TextControl/TextControl.test.tsx on lines 31..34
superset-frontend/src/features/tags/TagModal.test.tsx on lines 34..37

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

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

test('should render the error title', () => {
  render(<BasicErrorAlert {...mockedProps} />);
  expect(screen.getByText('Error title')).toBeInTheDocument();
});
superset-frontend/src/components/Badge/Badge.test.tsx on lines 37..40
superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx on lines 64..67
superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx on lines 49..52
superset-frontend/src/components/ErrorMessage/IssueCode.test.tsx on lines 33..36
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 62..65
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 61..64
superset-frontend/src/components/ModalTrigger/ModalTrigger.test.tsx on lines 33..36
superset-frontend/src/components/ModalTrigger/ModalTrigger.test.tsx on lines 38..41
superset-frontend/src/components/ModalTrigger/ModalTrigger.test.tsx on lines 52..55
superset-frontend/src/components/ProgressBar/ProgressBar.test.tsx on lines 31..34
superset-frontend/src/components/TableView/TableView.test.tsx on lines 51..54
superset-frontend/src/components/TableView/TableView.test.tsx on lines 85..88
superset-frontend/src/explore/components/controls/TextControl/TextControl.test.tsx on lines 36..39
superset-frontend/src/explore/components/controls/TextControl/TextControl.test.tsx on lines 41..44
superset-frontend/src/explore/components/controls/TextControl/TextControl.test.tsx on lines 46..49

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

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

test('should render the error body', () => {
  render(<BasicErrorAlert {...mockedProps} />);
  expect(screen.getByText('Error body')).toBeInTheDocument();
});
superset-frontend/src/components/Badge/Badge.test.tsx on lines 37..40
superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx on lines 59..62
superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx on lines 49..52
superset-frontend/src/components/ErrorMessage/IssueCode.test.tsx on lines 33..36
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 62..65
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 61..64
superset-frontend/src/components/ModalTrigger/ModalTrigger.test.tsx on lines 33..36
superset-frontend/src/components/ModalTrigger/ModalTrigger.test.tsx on lines 38..41
superset-frontend/src/components/ModalTrigger/ModalTrigger.test.tsx on lines 52..55
superset-frontend/src/components/ProgressBar/ProgressBar.test.tsx on lines 31..34
superset-frontend/src/components/TableView/TableView.test.tsx on lines 51..54
superset-frontend/src/components/TableView/TableView.test.tsx on lines 85..88
superset-frontend/src/explore/components/controls/TextControl/TextControl.test.tsx on lines 36..39
superset-frontend/src/explore/components/controls/TextControl/TextControl.test.tsx on lines 41..44
superset-frontend/src/explore/components/controls/TextControl/TextControl.test.tsx on lines 46..49

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

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