nexxtway/react-rainbow

View on GitHub

Showing 445 of 2,739 total issues

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

const CounterInput = React.forwardRef((props, ref) => {
    const {
        id,
        name,
        value,
Severity: Minor
Found in src/components/CounterInput/index.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

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

function detach(elem, listener) {
    if (!elem) {
        return;
    }
    if (elem.resizedAttached && typeof listener === 'function') {
Severity: Minor
Found in src/libs/ResizeSensor/index.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

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

const Rgba = React.forwardRef((_props, ref) => {
    const { rgba, hsv, hex, tabIndex, onChange } = useContext(ColorPickerContext) || {};

    const firstRef = useRef();
    const lastRef = useRef();
Severity: Minor
Found in src/components/ColorPicker/commons/rgba/index.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

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

export function clearAllBodyScrollLocks() {
    if (isIosDevice) {
        // Clear all locks ontouchstart/ontouchmove handlers, and the references.
        locks.forEach(lock => {
            lock.targetElement.ontouchstart = null;
Severity: Minor
Found in src/libs/scrollController/index.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

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

function DayComponent(props) {
    const {
        date,
        firstDayMonth,
        isSelected,
Severity: Minor
Found in src/components/Calendar/day.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

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

export default function buildNewRangeFromValue(value, currentRange) {
    if (currentRange && currentRange.length > 0) {
        const [rangeStart, rangeEnd] = currentRange;
        const newRangeStart = new Date(rangeStart);
        newRangeStart.setHours(0, 0, 0, 0);
Severity: Minor
Found in src/components/Calendar/helpers/buildNewRangeFromValue.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

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

export default function getSearchParams(searchOptions) {
    let searchParams = {};

    if (searchOptions) {
        const { bounds, country, location, ...otherSearchOptions } = searchOptions;
Severity: Minor
Found in src/components/GoogleAddressLookup/helpers/getSearchParams.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

Avoid too many return statements within this function.
Open

        return recomposeColor({ type, values });
Severity: Major
Found in src/styles/helpers/color/colorToRgba.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return {
                left: leftUpAnchor.x,
                top: leftUpAnchor.y - contentHeight - margin,
            };
    Severity: Major
    Found in src/components/PrimitiveMenu/utils.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return 'right-to-left';
      Severity: Major
      Found in src/components/CarouselImage/index.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return true;
        Severity: Major
        Found in src/components/PhoneInput/countriesDropdown/helpers/filterCountries.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return false;
          Severity: Major
          Found in src/components/PhoneInput/countriesDropdown/helpers/filterCountries.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    if (type === 'hsla') return hslToRgb(color);
            Severity: Major
            Found in src/styles/helpers/color/colorToRgba.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return {
                      left: leftBottomAnchor.x,
                      top: leftBottomAnchor.y + margin,
                  };
              Severity: Major
              Found in src/components/PrimitiveMenu/utils.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return '';
                Severity: Major
                Found in src/styles/helpers/color/colorToRgba.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return (
                          <StyledCell
                              as="td"
                              role="gridcell"
                              tabIndex={-1}
                  Severity: Major
                  Found in src/components/Table/body/cell.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return hour;
                    Severity: Major
                    Found in src/components/TimePicker/helpers/get24HourTime.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return '';
                      Severity: Major
                      Found in src/components/TimePicker/helpers/normalizeHour.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return onChange([option]);
                        Severity: Major
                        Found in src/components/InternalDropdown/index.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return <div className="react-rainbow-defualt-array">{value}</div>;
                          Severity: Major
                          Found in library/styleguideComponents/PropsTable/bodyRows.js - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language