nexxtway/react-rainbow

View on GitHub

Showing 445 of 2,739 total issues

Consider simplifying this complex logical expression.
Open

        if (isNumber(value)) {
            this.value = value;
            if (Number(value) > 23 || this.isUpOrDownKeyPressed || this.hasPropValue) {
                const newTypedValue = getSingleNewTypedValue(hour, value);
                normalizedValue = normalizeHour(newTypedValue, hour24);
Severity: Major
Found in src/components/TimePicker/timeSelect.js - About 1 hr to fix

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

    export default function getCountryFromValue(isoCode, countries) {
        if (Array.isArray(countries) && countries.length > 0) {
            if (isoCode) {
                const country = findCountryByIsoCode(isoCode, countries);
                if (country) {
    Severity: Minor
    Found in src/components/PhoneInput/helpers/getCountryFromValue.js - 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 getRowsWithInitalSelectedRows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function getRowsWithInitalSelectedRows(params = {}) {
        const { rows = [], selectedRows, maxRowSelection, indexes, selectedRowsKeys = {} } = params;
    
        if (Array.isArray(selectedRows) && maxRowSelection > 0) {
            const previousSelectionLength = getCurrentSelectionLength(selectedRowsKeys);
    Severity: Minor
    Found in src/components/Table/helpers/selector/getRowsWithInitalSelectedRows.js - 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 useHeaderArrowNav has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function useHeaderArrowNav({
        disableNextMonth,
        disablePreviousMonth,
        refs,
        firstIndex,
    Severity: Minor
    Found in src/components/Calendar/hooks/useHeaderArrowNav.js - 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 ActionsCell has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function ActionsCell(props) {
        const { columnChildren, rowsLength, rowIndex, rowData } = props;
    
        if (columnChildren) {
            const getMenuAlignment = () => {
    Severity: Minor
    Found in src/components/Table/body/actionsCell.js - 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 normalizeHour has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function normalizeHour(value, hour24 = false) {
        if (isNumber(value)) {
            const number = Number(value);
            if (value === '000' && !hour24) {
                return '12';
    Severity: Minor
    Found in src/components/TimePicker/helpers/normalizeHour.js - 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 componentDidUpdate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        componentDidUpdate(prevProps) {
            const { isOpen, onOpened } = this.props;
            const { isOpen: prevIsOpen } = prevProps;
    
            const wasOpened = isOpen && !prevIsOpen;
    Severity: Minor
    Found in src/components/Modal/index.js - 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 useReduxForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function useReduxForm(props) {
        const { error: propError, input, meta, ...rest } = props;
    
        const error = useMemo(() => {
            if (meta) {
    Severity: Minor
    Found in src/libs/hooks/useReduxForm.js - 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 useKeyboardNavigation has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        country,
        list,
        ref,
        scrollableRef,
        itemsRef,

      Function withReduxForm has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function withReduxForm(WrappedComponent) {
          return class extends Component {
              constructor(props) {
                  super(props);
                  this.fieldRef = React.createRef();
      Severity: Minor
      Found in src/libs/hocs/withReduxForm/index.js - 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 handleKeyDown has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          handleKeyDown(event) {
              const { searchValue } = this.state;
              const { keyCode } = event;
      
              if (keyCode === ESCAPE_KEY) {
      Severity: Minor
      Found in src/components/Lookup/index.js - 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 Indicators has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const Indicators = props => {
          const { carouselChildren, onSelect, selectedItem } = props;
          const containerRef = useRef();
      
          const { childrenRegistered: indicatorsRefs, register, unregister } = useChildrenRegister({
      Severity: Minor
      Found in src/components/CarouselCard/indicators/index.js - 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 InternalTooltip has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const InternalTooltip = React.forwardRef((props, ref) => {
          const [pos, setPos] = useState();
          const { className, style, children, isVisible, preferredPosition, triggerElementRef } = props;
          const tooltipRef = useRef();
      
      
      Severity: Minor
      Found in src/components/InternalTooltip/index.js - 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 TimePicker has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const TimePicker = React.forwardRef((props, ref) => {
          const {
              placeholder,
              label,
              required,
      Severity: Minor
      Found in src/components/TimePicker/index.js - 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 formatDateTime has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function formatDateTime(
          date,
          formatStyle = 'medium',
          locale = 'en-US',
          hour24 = false,
      Severity: Minor
      Found in src/components/DateTimePicker/helpers/formatDateTime.js - 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 DateTimePicker has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      const DateTimePicker = React.forwardRef((props, ref) => {
          const {
              placeholder,
              labelAlignment,
              hideLabel,
      Severity: Minor
      Found in src/components/DateTimePicker/index.js - 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 resolveOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function resolveOptions(conditions) {
          const {
              disableAnimations,
              disableLines,
              disableCurves,
      Severity: Minor
      Found in src/components/Chart/resolveOptions.js - 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 useDisabledControls has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          yearsRange,
          minDate,
          maxDate,
          currentMonth,
          rightCalendarMonth,
      Severity: Minor
      Found in src/components/Calendar/doubleCalendar/hooks/useDisabledControls.js - About 35 mins to fix

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

        export default function valuePropValidation(propValue, key, componentName, location, propFullName) {
        Severity: Minor
        Found in src/components/WeekDayPicker/helpers/valuePropValidation.js - About 35 mins to fix

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

          export default function hexToRgb(color) {
              if (isHexColor(color)) {
                  const hexColor = color.substr(1);
                  const regex = new RegExp(`.{1,${hexColor.length / 3}}`, 'g');
                  const regColors = hexColor.match(regex);
          Severity: Minor
          Found in src/styles/helpers/color/hexToRgb.js - 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

          Severity
          Category
          Status
          Source
          Language