airbnb/caravel

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

Summary

Maintainability
C
1 day
Test Coverage

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

test('should render the issue codes', () => {
  render(<ParameterErrorMessage {...mockedProps} />, { useRedux: true });
  const button = screen.getByText('See more');
  userEvent.click(button);
  expect(screen.getByText(/This may be triggered by:/)).toBeInTheDocument();
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 76..83
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 66..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 128.

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

test('should render the error message', () => {
  render(<ParameterErrorMessage {...mockedProps} />, { useRedux: true });
  const button = screen.getByText('See more');
  userEvent.click(button);
  expect(screen.getByText('Error message')).toBeInTheDocument();
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 69..74
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 91..96
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 98..103
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 157..162
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx on lines 46..51

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

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/BasicErrorAlert.test.tsx on lines 24..30
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/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 17 locations. Consider refactoring.
Open

test('should render', () => {
  const { container } = render(<ParameterErrorMessage {...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/BasicErrorAlert.test.tsx on lines 38..41
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/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 default title', () => {
  render(<ParameterErrorMessage {...mockedProps} />);
  expect(screen.getByText('Parameter error')).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/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/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