tbleckert/react-select-search

View on GitHub

Showing 6 of 6 total issues

Function Options has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Options(props) {
    const {
        options,
        cls,
        renderOption,
Severity: Minor
Found in src/components/Options.jsx - About 1 hr to fix

    Function getDisplayValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function getDisplayValue(option, options, placeholder) {
        if (!option && !placeholder) {
            return options && options.length ? options[0].name || '' : '';
        }
    
    
    Severity: Minor
    Found in src/lib/getDisplayValue.js - About 1 hr 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 search has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    function search(q, text) {
        const searchLength = q.length;
        const textLength = text.length;
    
        if (searchLength > textLength) {
    Severity: Minor
    Found in src/lib/fuzzySearch.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 useHighlight has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function useHighlight(options, onSelect, ref) {
        const [highlighted, setHighlighted] = useState(-1);
    
        return [
            {
    Severity: Minor
    Found in src/useHighlight.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 useSelect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function useSelect({
        options: defaultOptions,
        defaultValue,
        value,
        multiple,
    Severity: Minor
    Found in src/useSelect.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 highlight has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function highlight(current, dir, options) {
        const max = options.length - 1;
        let option = null;
        let i = -1;
        let newHighlighted = current;
    Severity: Minor
    Found in src/lib/highlight.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

    Severity
    Category
    Status
    Source
    Language