nexxtway/react-rainbow

View on GitHub

Showing 445 of 2,739 total issues

Avoid too many return statements within this function.
Open

    return value;
Severity: Major
Found in library/styleguideComponents/PropsTable/bodyRows.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return onChange({
                    label,
                    name,
                    icon,
                    value: optionValue,
    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={className}>
                              {description}
                              {propTypeEnumRender(type.value)}
                          </div>
      Severity: Major
      Found in library/styleguideComponents/PropsTable/bodyRows.js - About 30 mins to fix

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

        export default function hexToRgba(color, alpha = 1) {
            if (color.charAt(0) !== '#') {
                return '';
            }
        
        
        Severity: Minor
        Found in src/styles/helpers/color/hexToRgba.js - 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 colorToRgba has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function colorToRgba(color) {
            if (typeof color !== 'string') return '';
        
            try {
                const { type, values } = decomposeColor(color);
        Severity: Minor
        Found in src/styles/helpers/color/colorToRgba.js - 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 PageButtons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function PageButtons(props) {
            const { pages, activePage, onChange, variant } = props;
        
            const getAriaCurrent = page => {
                if (page === activePage) {
        Severity: Minor
        Found in src/components/Pagination/pageButtons.js - 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 formatDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function formatDate(date, formatStyle = 'medium', locale = 'en-US') {
            if (date) {
                try {
                    const options = FORMATS[formatStyle] || FORMATS.medium;
                    const value = typeof date === 'string' ? new Date(date) : date;
        Severity: Minor
        Found in src/components/DatePicker/helpers/formatDate.js - 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 Child has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function Child(props) {
            const {
                label,
                isExpanded,
                isLoading,
        Severity: Minor
        Found in src/components/Tree/child.js - 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 getTabIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const getTabIndex = ({ name, selectedNode, isSelected, isFirstNode, focusedNode }) => {
            if (
                (focusedNode && name === focusedNode) ||
                (isSelected && !focusedNode) ||
                (isFirstNode && !selectedNode && !focusedNode)
        Severity: Minor
        Found in src/components/Tree/helpers/getTabIndex.js - 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 get24Hour has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function get24Hour(hour, ampm) {
            const hourNumber = Number(hour);
            if (ampm === 'AM') {
                if (hourNumber === 12) {
                    return '00';
        Severity: Minor
        Found in src/components/TimePicker/helpers/get24HourTime.js - 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 EditableCell has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function EditableCell(props) {
            const { value, onChange, row, field } = props;
            const [isEditMode, setIsEditMode] = useState(false);
            const [internalValue, setInternalValue] = useState(value);
            const inputRef = useRef(null);
        Severity: Minor
        Found in src/components/Table/body/editableCell.js - 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 getNextHour has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

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

            handleKeyDown(event) {
                const { keyCode } = event;
        
                if (keyCode === RIGHT_KEY) {
                    this.handleRightKeyPressed();
        Severity: Minor
        Found in src/components/TimePicker/timeSelect.js - 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 Cell has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function Cell(props) {
            const {
                header,
                component,
                value,
        Severity: Minor
        Found in src/components/Table/body/cell.js - 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 getFormattedEventTimeRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function getFormattedEventTimeRange(startDate, endDate, locale) {
            const startDateParts = formatter(locale).formatToParts(startDate);
            const endDateParts = formatter(locale).formatToParts(endDate);
        
            const formattedStartDate = getFormattedEventTime(
        Severity: Minor
        Found in src/components/WeeklyCalendar/week/helpers/getFormattedEventTimeRange.js - 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 getPrevHour has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

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

        export default function getFormattedValue(value, highlightMatch, icon) {
            if (!value) return null;
        
            if (value && typeof value === 'string') {
                return {
        Severity: Minor
        Found in src/components/GoogleAddressLookup/helpers/getFormattedValue.js - 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 AccordionTimeline has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function AccordionTimeline(props) {
            const { id, children, className, style, multiple, activeSectionNames, onToggleSection } = props;
            const registeredTimelineMarkers = useRef([]);
            const [activeNames, setActiveNames] = useState(activeSectionNames);
            const containerRef = useRef();
        Severity: Minor
        Found in src/components/ActivityTimeline/accordionTimeline.js - 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 getTypeValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function getTypeValue(value, dataType) {
            switch (dataType.name) {
                case 'String':
                    return value;
        
        
        Severity: Minor
        Found in src/components/ImportRecordsFlow/helpers/getFieldAssignedPreviewData.js - 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 componentDidUpdate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            componentDidUpdate(prevProps) {
                const {
                    children: prevChildren,
                    showCheckboxColumn: prevShowCheckboxColumn,
                    maxRowSelection: prevMaxRowSelection,
        Severity: Minor
        Found in src/components/Table/index.js - 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