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);
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) {
- Read upRead up
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);
- Read upRead up
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,
- Read upRead up
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 = () => {
- Read upRead up
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';
- Read upRead up
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;
- Read upRead up
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) {
- Read upRead up
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();
- Read upRead up
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) {
- Read upRead up
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({
- Read upRead up
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();
- Read upRead up
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,
- Read upRead up
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,
- Read upRead up
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,
- Read upRead up
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,
- Read upRead up
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,
Function valuePropValidation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export default function valuePropValidation(propValue, key, componentName, location, propFullName) {
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);
- Read upRead up
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"