qlik-oss/sn-table

View on GitHub

Showing 16 of 28 total issues

File data.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Modifiers from "qlik-modifiers";
// eslint-disable-next-line import/no-unresolved, import/extensions
import { ColumnWidthType, ColumnWidthValues } from "@qlik/nebula-table-utils/lib/constants";

const columnCommonHidden = {
Severity: Minor
Found in src/ext/property-panel/data.js - About 4 hrs to fix

    File types.ts has 324 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Direction, TableCellProps } from "@mui/material";
    import { stardust } from "@nebula.js/stardust";
    import type { ExtendedTheme } from "@qlik/nebula-table-utils/lib/hooks/use-extended-theme/types";
    import {
      Announce,
    Severity: Minor
    Found in src/table/types.ts - About 3 hrs to fix

      File sense-horizon.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module.exports = () => ({
        _inherit: true,
        _variables: {
          "@myColorLight": "#FFFFFF",
          "@myColorDark": "#404040",
      Severity: Minor
      Found in test/rendering/theme/sense-horizon.js - About 3 hrs to fix

        Function TableWrapper has 133 lines of code (exceeds 100 allowed). Consider refactoring.
        Open

        const TableWrapper = (props: TableWrapperProps) => {
          const { pageInfo, setPageInfo, direction, footerContainer, announce } = props;
          const { page, rowsPerPage } = pageInfo;
        
          const { totalColumnCount, totalRowCount, totalPages, paginationNeeded, rows, columns, totalsPosition } =
        Severity: Major
        Found in src/table/pagination-table/components/TableWrapper.tsx - About 2 hrs to fix

          Function sortingFactory has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
          Open

          export const sortingFactory = (
            dimensionsLength: number,
            model: EngineAPI.IGenericObject | undefined,
            isNewHeadCellMenuEnabled: boolean,
          ) => {
          Severity: Minor
          Found in src/nebula-hooks/use-sorting.ts - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function HeadCellMenu has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
          Open

          const HeadCellMenu = ({ column, tabIndex }: HeadCellMenuProps) => {
            const { isDim, qLibraryId, fieldId, headTextAlign, pageColIdx } = column;
            const { translator, embed, model, interactions, layout } = useContextSelector(
              TableContext,
              (value) => value.baseProps,
          Severity: Minor
          Found in src/table/components/head/HeadCellMenu.tsx - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function generateLayout has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            nDims: number,
            nMeas: number,
            nRows: number,
            qColumnOrder: number[] = [],
            qGrandTotalRow: Record<string, string>[] = [],
          Severity: Minor
          Found in src/__test__/generate-test-data.ts - About 45 mins to fix

            Function Cell has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
            Open

            const Cell = ({ columnIndex, rowIndex, style, data }: CellProps) => {
              const { rowsInPage, columns, bodyStyle, isHoverEnabled, maxLineCount } = data;
            
              const rowIsHovered = useContextSelector(TableContext, (value) => value.hoverIndex === rowIndex);
              const setHoverIndex = useContextSelector(TableContext, (value) => value.setHoverIndex);
            Severity: Minor
            Found in src/table/virtualized-table/Cell.tsx - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function getNextCellCoord has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
            Open

            export const getNextCellCoord = (
              evt: React.KeyboardEvent,
              rootElement: HTMLElement,
              cellCoord: FocusedCellCoord,
              allowedRows: {
            Severity: Minor
            Found in src/table/utils/get-element-utils.ts - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function manageData has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              model: EngineAPI.IGenericObject,
              layout: TableLayout,
              pageInfo: PageInfo,
              setPageInfo: SetPageInfo,
              viewService: ViewService,
            Severity: Minor
            Found in src/handle-data.ts - About 35 mins to fix

              Function handleHeadKeyDown has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
              Open

              export const handleHeadKeyDown = ({
                evt,
                rootElement,
                cellCoord,
                setFocusedCellCoord,
              Severity: Minor
              Found in src/table/utils/handle-keyboard.ts - About 35 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function handleHeadCellMenuKeyDown has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
              Open

              export const handleHeadCellMenuKeyDown = (event: React.KeyboardEvent) => {
                const { key, currentTarget } = event;
                const currentFocusItem = document.activeElement ?? currentTarget; // The rest key are handled by handleKeyDown in MUIMenuList
                if (key === KeyCodes.DOWN || key === KeyCodes.UP) {
                  const getNewFocusItem = (currentItem: Element) =>
              Severity: Minor
              Found in src/table/utils/handle-keyboard.ts - About 35 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function getTotalPosition has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
              Open

              export function getTotalPosition(layout: TableLayout, viewService: ViewService) {
                // For multi-page pdf the totals row may not be needed from the second pdf page
                if (viewService.viewState?.skipTotals) return { atTop: false, atBottom: false };
                const [hasDimension, hasMeasure, hasGrandTotal, isTotalModeAuto, position] = [
                  layout.qHyperCube.qDimensionInfo.length > 0,
              Severity: Minor
              Found in src/handle-data.ts - About 25 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function getVisibleColumnOrder has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
              Open

              const getVisibleColumnOrder = (
                columnOrder: number[],
                qDimensionInfo: ExtendedNxDimensionInfo[],
                qMeasureInfo: ExtendedNxMeasureInfo[],
              ) => {
              Severity: Minor
              Found in src/handle-data.ts - About 25 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function resetFocus has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
              Open

              export const resetFocus = ({
                focusedCellCoord,
                rootElement,
                shouldRefocus,
                isSelectionMode,
              Severity: Minor
              Found in src/table/utils/accessibility-utils.ts - About 25 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function findVirtualizedVisibleRows has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
              Open

              export function findVirtualizedVisibleRows(rootElement: HTMLElement, viewService: ViewService) {
                const tableBody = rootElement.querySelector(".sn-table-body");
                const bodyRect = tableBody?.getBoundingClientRect();
                const cells = tableBody?.querySelectorAll(".sn-table-body .sn-table-cell");
                if (!cells || !bodyRect) return {};
              Severity: Minor
              Found in src/table/utils/find-visible-rows.ts - About 25 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Severity
              Category
              Status
              Source
              Language