airbnb/superset

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

Summary

Maintainability
F
4 days
Test Coverage

File FilterableTable.test.tsx has 312 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

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

      it('sorts floating numbers correctly', () => {
        const floatProps = {
          orderedColumnKeys: ['columnC'],
          data: [{ columnC: 45.67 }, { columnC: 1.23 }, { columnC: 89.0000001 }],
          height: 500,
    superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx on lines 121..154

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

    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

      it('sorts integers correctly', () => {
        const integerProps = {
          orderedColumnKeys: ['columnB'],
          data: [{ columnB: 21 }, { columnB: 0 }, { columnB: 623 }],
          height: 500,
    superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx on lines 156..197

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

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

      it('is valid element', () => {
        expect(React.isValidElement(<FilterableTable {...mockedProps} />)).toBe(
          true,
        );
      });
    superset-frontend/src/SqlLab/components/ColumnElement/ColumnElement.test.tsx on lines 29..31
    superset-frontend/src/SqlLab/components/QueryStateLabel/QueryStateLabel.test.tsx on lines 31..33
    superset-frontend/src/SqlLab/components/QueryTable/QueryTable.test.tsx on lines 37..39
    superset-frontend/src/SqlLab/components/TableElement/TableElement.test.tsx on lines 77..79
    superset-frontend/src/components/CachedLabel/CachedLabel.test.tsx on lines 32..34
    superset-frontend/src/components/EditableTitle/EditableTitle.test.tsx on lines 41..43
    superset-frontend/src/dashboard/components/RefreshIntervalModal.test.tsx on lines 111..117

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

        mockedProps.data.forEach(({ b: columnBContent }) => {
          expect(getByText(columnBContent)).toBeInTheDocument();
        });
    superset-frontend/src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.tsx on lines 135..137
    superset-frontend/src/SqlLab/components/SqlEditorLeftBar/SqlEditorLeftBar.test.tsx on lines 177..179

    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