airbnb/superset

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

Summary

Maintainability
F
3 days
Test Coverage

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

test('should NOT render the modal', () => {
  const expandableProps = {
    ...mockedProps,
    source: 'explore' as ErrorSource,
  };
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 103..116
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 88..101

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

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

test('should render the modal', () => {
  render(<ErrorAlert {...mockedProps} />, { useRedux: true });
  const button = screen.getByText('See more');
  userEvent.click(button);
  expect(screen.getByRole('dialog')).toBeInTheDocument();
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 91..101
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 76..86

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

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 error theme', () => {
  const errorProps = {
    ...mockedProps,
    level: 'error' as ErrorLevel,
  };
superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx on lines 79..90

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

test('should render the error subtitle', () => {
  render(<ErrorAlert {...mockedProps} />, { useRedux: true });
  const button = screen.getByText('See more');
  userEvent.click(button);
  expect(screen.getByText('Error subtitle')).toBeInTheDocument();
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 70..75
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 99..104
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 158..163
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx on lines 47..52
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 68..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 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 6 locations. Consider refactoring.
Open

test('should render the Copy button', () => {
  render(<ErrorAlert {...mockedProps} />, { useRedux: true });
  const button = screen.getByText('See more');
  userEvent.click(button);
  expect(screen.getByText('Copy message')).toBeInTheDocument();
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 70..75
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 92..97
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 99..104
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx on lines 47..52
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 68..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 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 6 locations. Consider refactoring.
Open

test('should render the error body', () => {
  render(<ErrorAlert {...mockedProps} />, { useRedux: true });
  const button = screen.getByText('See more');
  userEvent.click(button);
  expect(screen.getByText('Error body')).toBeInTheDocument();
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 70..75
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 92..97
superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx on lines 158..163
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx on lines 47..52
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 68..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 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 2 locations. Consider refactoring.
Open

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

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

test('should render the error title', () => {
  const titleProps = {
    ...mockedProps,
    source: 'explore' as ErrorSource,
  };
superset-frontend/src/components/ProgressBar/ProgressBar.test.tsx on lines 46..53
superset-frontend/src/components/ProgressBar/ProgressBar.test.tsx on lines 55..62

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

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

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/BasicErrorAlert.test.tsx on lines 25..31
superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx on lines 26..32
superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx on lines 25..31
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx on lines 27..33
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 26..32
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 26..32
superset-frontend/src/explore/components/controls/FixedOrMetricControl/FixedOrMetricControl.test.tsx on lines 24..30
superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.test.tsx on lines 39..45

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

test('should render the error description', () => {
  render(<ErrorAlert {...mockedProps} />, { useRedux: true });
  expect(screen.getByText('we are unable to connect db.')).toBeInTheDocument();
});
superset-frontend/src/dashboard/components/URLShortLinkButton/URLShortLinkButton.test.tsx on lines 49..52
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndMetricSelect.test.tsx on lines 72..77
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndSelectLabel.test.tsx on lines 55..58

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

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

test('should render', () => {
  const { container } = render(<ErrorAlert {...mockedProps} />);
  expect(container).toBeInTheDocument();
});
superset-frontend/src/components/Badge/Badge.test.tsx on lines 29..32
superset-frontend/src/components/Datasource/Field.test.tsx on lines 38..41
superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx on lines 39..42
superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx on lines 43..48
superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx on lines 42..45
superset-frontend/src/components/ErrorMessage/IssueCode.test.tsx on lines 29..32
superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx on lines 58..61
superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx on lines 57..60
superset-frontend/src/components/ModalTrigger/ModalTrigger.test.tsx on lines 29..32
superset-frontend/src/components/ProgressBar/ProgressBar.test.tsx on lines 27..30
superset-frontend/src/components/TableView/TableView.test.tsx on lines 47..50
superset-frontend/src/components/Tags/Tag.test.tsx on lines 33..36
superset-frontend/src/components/Tags/TagsList.test.tsx on lines 57..60
superset-frontend/src/explore/components/controls/TextControl/TextControl.test.tsx on lines 32..35
superset-frontend/src/features/tags/TagModal.test.tsx on lines 35..38

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

There are no issues that match your filters.

Category
Status