nexxtway/react-rainbow

View on GitHub

Showing 2,739 of 2,739 total issues

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

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

export default function PageObjectCard({ results, type }) {
    const getTypeText = () => {
        if (type === 'page-object') {
            return 'Page Object';
        }
Severity: Minor
Found in library/styleguideComponents/ReactComponent/Utils/pageObjectCard.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 Path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function Path(props) {
    const { currentStepName, onClick, children, id, className, style } = props;
    const [hoveredStepName, setHoveredStepName] = useState(null);
    const [stepsCount, setStepsCount] = useState(0);
    const registeredSteps = useRef([]);
Severity: Minor
Found in src/components/Path/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

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

    scrollToSelectedTab(name) {
        const { tabsetChildren } = this;
        const tabset = this.tabsetRef.current;
        const { scrollLeft, offsetWidth: tabsetWidth } = tabset;
        const tabIndex = getTabIndexFromName(tabsetChildren, name);
Severity: Minor
Found in src/components/Tabset/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

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

export default function getCurrentMonth(currentMonth, minDate, maxDate) {
    const month = getFirstDayMonth(normalizeDate(currentMonth));
    month.setHours(0, 0, 0, 0);

    if (minDate) {
Severity: Minor
Found in src/components/MonthlyCalendar/helpers/getCurrentMonth.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