SymphonyPlatformSolutions/symphony-ui-toolkit

View on GitHub

Showing 64 of 262 total issues

File DatePicker.tsx has 519 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as PropTypes from 'prop-types';
import * as React from 'react';
import { createPortal } from 'react-dom';
import { Component, createRef } from 'react';
import { clsx } from 'clsx';
Severity: Major
Found in packages/components/src/components/date-picker/DatePicker.tsx - About 1 day to fix

    File DayPicker.tsx has 446 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import * as PropTypes from 'prop-types';
    import * as React from 'react';
    import { clsx } from 'clsx';
    
    import { Modifier } from '../model/Modifiers';

      Function render has 163 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const {
            hideSelectedOptions,
            closeMenuOnSelect,
            displayArrowIndicator,
      Severity: Major
      Found in packages/components/src/components/dropdown/Dropdown.tsx - About 6 hrs to fix

        File TimePicker.tsx has 369 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Dropdown } from '../dropdown';
        import * as React from 'react';
        import { useEffect, useMemo, useState } from 'react';
        import { Keys } from '../common/eventUtils';
        import { ErrorMessages } from '../validation/interfaces';
        Severity: Minor
        Found in packages/components/src/components/time-picker/TimePicker.tsx - About 4 hrs to fix

          Function debounce has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
          Open

          export function debounce(func: any, wait?: any, options?: any): any {
            let lastArgs,
              lastThis,
              maxWait,
              result,
          Severity: Minor
          Found in packages/components/src/utils/debounce.ts - About 4 hrs 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 debounce has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function debounce(func: any, wait?: any, options?: any): any {
            let lastArgs,
              lastThis,
              maxWait,
              result,
          Severity: Major
          Found in packages/components/src/utils/debounce.ts - About 3 hrs to fix

            File Dropdown.tsx has 309 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import * as React from 'react';
            import { CSSProperties } from 'react';
            import Select, { ActionMeta, createFilter } from 'react-select';
            import CreatableSelect from 'react-select/creatable';
            import AsyncSelect from 'react-select/async';
            Severity: Minor
            Found in packages/components/src/components/dropdown/Dropdown.tsx - About 3 hrs to fix

              Function renderBody has 85 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                renderBody() {
                  const {
                    dir,
                    locale,
                    selectedDays,

                File timeUtils.tsx has 304 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { format as formatTime, parse as parseTime, isValid } from 'date-fns';
                
                import Time from './Time';
                import { DisabledTime, TimePickerOption } from '../interfaces';
                
                
                Severity: Minor
                Found in packages/components/src/components/time-picker/utils/timeUtils.tsx - About 3 hrs to fix

                  Function handleKeyDownCell has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    handleKeyDownCell(e: React.KeyboardEvent, date: Date, modifers): void {
                      const { locale, dir } = this.props;
                      const { currentMonth } = this.state;
                      if (e.key !== Keys.ESC) {
                        cancelEvent(e);

                    Function render has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        const {
                          id,
                          disabled,
                          format,
                    Severity: Major
                    Found in packages/components/src/components/date-picker/DatePicker.tsx - About 2 hrs to fix

                      Function Header has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const Header: FunctionComponent<HeaderProps> = ({ date, dir, labels, months, onChange, parentRef }) => {
                        const changeYear = (amount: number) => {
                          onChange(addYears(date, amount));
                        };
                      
                      

                      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 handleKeyDownCell has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                        handleKeyDownCell(e: React.KeyboardEvent, date: Date, modifers): void {
                          const { locale, dir } = this.props;
                          const { currentMonth } = this.state;
                          if (e.key !== Keys.ESC) {
                            cancelEvent(e);

                      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 getNextSelectionIndexes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const getNextSelectionIndexes = (
                        value: string,
                        cursorPosition: number,
                        searchForward = true
                      ): { start: number; end: number } => {
                      Severity: Minor
                      Found in packages/components/src/components/time-picker/utils/timeUtils.tsx - About 2 hrs 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

                      DatePicker has 23 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class DatePicker extends Component<
                        DatePickerComponentProps,
                        DatePickerComponentState
                      > {
                        static defaultProps = {
                      Severity: Minor
                      Found in packages/components/src/components/date-picker/DatePicker.tsx - About 2 hrs to fix

                        Function focusOnlyEnabledCell has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                        Open

                          focusOnlyEnabledCell(
                            date: Date,
                            action: 'next' | 'previous',
                            maxStepCheck: number,
                            needToChangeMonth = true

                        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 updateState has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          public async updateState(value: string): Promise<string[]> {
                            let errorsMap = {};
                            let valid = true;
                            let errors = [];
                            let validationResults;
                        Severity: Major
                        Found in packages/components/src/components/validation/Validation.tsx - About 2 hrs to fix

                          Function toNumber has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function toNumber(value) {
                            if (typeof value == 'number') {
                              return value;
                            }
                            if (isSymbol(value)) {
                          Severity: Minor
                          Found in packages/components/src/utils/debounce.ts - About 2 hrs 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 renderCalendar has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            renderCalendar() {
                              const {
                                date,
                                disabledDays,
                                dir,
                          Severity: Minor
                          Found in packages/components/src/components/date-picker/DatePicker.tsx - About 1 hr to fix

                            Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render() {
                                const { children, validator } = this.props;
                            
                                let childWithValidation;
                                if (React.Children.count(children) === 0) {
                            Severity: Minor
                            Found in packages/components/src/components/validation/Validation.tsx - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language