Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { type, placeholder, disabled, name } = this.props;
let className = "text-input " + this.props.name;
if (this.props.showRequired && !this.props.isPristine) {
Function convertValidationsToObject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const convertValidationsToObject = (validations: any) => {
if (typeof validations === "string") {
return validations.split(/,(?![^{[]*[}\]])/g).reduce((validationsAccumulator, validation) => {
let args = validation.split(":");
const validateMethod = args.shift() as string;
- 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 TextInputWithAsyncValidationSupport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const TextInputWithAsyncValidationSupport = (props: any) => {
const { asyncValidation, asyncValidationError, validations, ...innerProps } = props;
const [asyncValidationPassed, setAsyncValidationPassed] = useState(true);
// eslint-disable-next-line react-hooks/exhaustive-deps
- 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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render () {
const { type, placeholder, disabled, name } = this.props;
let className = "text-input " + this.props.name;
if (this.props.showRequired && !this.props.isPristine) {
- 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 onChange
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
onChange (event: any) {
const cursor = event.target.selectionStart;
let newVal = event.currentTarget.value;
const delay = this.props.isValidValue(newVal) ? 0 : TIMEOUT;
- 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"