Function sort
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
sort(options: Option[], isSubGroup = false) {
const { optionsValue, optionsLabel } = this.props;
const pinnedList = this.getPinnedList();
const sortedOptions = options.sort((a, b) => {
const aPinned = this.checked(a) !== SelectStates.OFF || pinnedList.includes(a[optionsValue]);
- 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 checked
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
checked(option: Option): SelectStates {
if (!this.props.value) {
return SelectStates.OFF;
}
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { optionsLabel, className } = this.props;
let totalOptions = this.props.options.filter(option => {
let notDefined;
- 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 label
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
label(option: Option, isSelect = true) {
const { optionsValue, optionsLabel, prefix } = this.props;
const clickEvent = isSelect ? () => {} : this.toggleOptions.bind(this, option);
return (
<>
- 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 sortOnlyAggregates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
sortOnlyAggregates(options: Option[]) {
const { optionsLabel } = this.props;
if (!options.length || typeof options[0].results === 'undefined') {
return options;
}
- 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"