Function FormField
has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring. Open
(
{
children,
className,
component,
- 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
File FormField.js
has 501 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {
Children,
cloneElement,
forwardRef,
useContext,
Consider simplifying this complex logical expression. Open
if (themeBorder) {
const innerProps =
themeBorder.position === 'inner'
? {
border: {
Function Message
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const Message = ({ error, info, message, type, ...rest }) => {
const theme = useContext(ThemeContext) || defaultProps.theme;
if (message) {
let icon;
- 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 Input
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const Input = ({ component, disabled, invalid, name, onChange, ...rest }) => {
const formContext = useContext(FormContext);
const [value, setValue] = formContext.useFormInput({
name,
value: rest.value,
- 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
Consider simplifying this complex logical expression. Open
} else if (
focus &&
formFieldTheme.focus &&
formFieldTheme.focus.border &&
formFieldTheme.focus.border.color
Consider simplifying this complex logical expression. Open
} else if (
// backward compatibility check
(error && themeBorder && themeBorder.error.color) ||
(error && formFieldTheme.error && formFieldTheme.error.border)
) {