SymphonyPlatformSolutions/symphony-ui-toolkit

View on GitHub

Showing 64 of 262 total issues

Function DropdownList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const DropdownList = ({ selectProps, ...props }: any) => {
  if (selectProps?.enableTermSearch) {
    const select = selectProps?.selectRef?.current?.select;
    const selectValueSync = select?.state?.selectValue;
    const selectValueAsync = select?.state?.value?.searchHeader;
Severity: Minor
Found in packages/components/src/components/dropdown/CustomRender.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 handleKeyDown has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const handleKeyDown = (
  event,
  setInputValue,
  options,
  steps,
Severity: Minor
Found in packages/components/src/components/time-picker/TimePicker.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 SelectionInput has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const SelectionInput: React.FC<SelectionInputPropsWithType> = ({
  id,
  type,
  name,
  label,
Severity: Minor
Found in packages/components/src/components/selection/SelectionInput.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 moveFocusOnNextField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const moveFocusOnNextField = (event, setInputValue, format) => {
  const isValidCharacter = /^[0-9aAmMpP]$/i.test(event.key);
  const cursorPosition = event.target.selectionStart;
  let inputValue = event.target.value;
  if (isValidCharacter) {
Severity: Minor
Found in packages/components/src/components/time-picker/TimePicker.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

Avoid deeply nested control flow statements.
Open

              if (enabledCell) {
                enabledCell.focus();
              } else {
                // if all cell are disabled, focus the first day of month
                this.focusCell(

    Function getChildWithValidation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      private getChildWithValidation(child) {
        if (!React.isValidElement(child)) {
          console.error('Child is not a valid React element', child);
        }
        return React.cloneElement(child as any, {
    Severity: Minor
    Found in packages/components/src/components/validation/Validation.tsx - 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 handleClickOutside has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      private handleClickOutside(event) {
        const { popperElement, refContainer, showPicker } = this.state;
        if (
          refContainer &&
          !refContainer.contains(event.target) &&
    Severity: Minor
    Found in packages/components/src/components/date-picker/DatePicker.tsx - 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 LabelTooltipDecorator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const LabelTooltipDecorator: React.FC<LabelTooltipDecoratorProps> = ({
      id,
      htmlFor,
      label,
      placement,

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

    const Modal: React.FC<ModalProps> = ({
      size,
      className,
      children,
      closeButton,
    Severity: Minor
    Found in packages/components/src/components/modal/Modal.tsx - 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 componentDidUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      componentDidUpdate(prevProps: ResizeDetectDivProps) {
        const { width, height } = this.props;
        const widthChanged = width - prevProps.width;
        const heightChanged = height - prevProps.height;
        if (widthChanged && this.props.onWidthChange) {
    Severity: Minor
    Found in packages/components/src/core/hoc/ResizeDetectDiv.tsx - 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

    Avoid too many return statements within this function.
    Open

          return { disabledTime: 'This time is not available' };
    Severity: Major
    Found in packages/components/src/components/time-picker/TimePicker.tsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return { disabledDate: 'This date is not available' };
      Severity: Major
      Found in packages/components/src/components/date-picker/DatePicker.tsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return null;
        Severity: Major
        Found in packages/components/src/components/time-picker/TimePicker.tsx - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return null;
          Severity: Major
          Found in packages/components/src/components/date-picker/DatePicker.tsx - About 30 mins to fix

            Function callParentAndChildMethod has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const callParentAndChildMethod = (parent, child, methodName) => (
              ...args
            ) => {
              parent && methodName && parent[methodName]
                ? parent[methodName](...args)
            Severity: Minor
            Found in packages/components/src/utils/index.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 getISOTimeFromLocalTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const getISOTimeFromLocalTime = (
              time: string,
              format: string = TIME_FORMAT.HH_MM_SS_24
            ): Time => {
              if (!time || !format || !getTimeFromString(time)) {
            Severity: Minor
            Found in packages/components/src/components/time-picker/utils/timeUtils.tsx - 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 handleKeyDownFooter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              handleKeyDownFooter(e): void {
                switch (e.key) {
                case Keys.TAB:
                  if (!e.shiftKey) {
                    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 DropdownMenu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export const DropdownMenu: React.FC<DropdownMenuProps> = ({children, className, show = true, onClose, ...rest}: DropdownMenuProps) => {
              const classes = clsx(
                'tk-dropdown-menu',
                className,
              )
            Severity: Minor
            Found in packages/components/src/components/dropdown-menu/DropdownMenu.tsx - 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 getSiblingOrCurrent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export function getSiblingOrCurrent(elem, selector: string, direction: 'nextElementSibling' | 'previousElementSibling', maxStepToCheck: number) {
              let sibling = elem; // get current first
            
              // If there's no selector, return the first sibling
              if (!selector) return sibling;
            Severity: Minor
            Found in packages/components/src/components/date-picker/utils/dateUtils.tsx - 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 computeError has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              private computeError(date): ErrorMessages {
                const { disabledDays } = this.props;
            
                if (!date) {
                  return null;
            Severity: Minor
            Found in packages/components/src/components/date-picker/DatePicker.tsx - 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