Showing 334 of 1,376 total issues
Function getValue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
getValue(value) {
if (Array.isArray(value) && value.length) {
return value.map(item => this.getValue(item));
} else if (value && typeof value === 'object') {
// TODO: support for NestedList
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
selectAllLabel, renderListItem, showLoadMore, loadMoreLabel,
} = this.props;
const { isLastBucket } = this.state;
- 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 setURL
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
setURL(component, value) {
const searchParams = this.props.getSearchParams
? this.props.getSearchParams()
: window.location.search;
this.params = new URLSearchParams(searchParams);
- 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 value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
value: function(predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
- 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 componentWillReceiveProps
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
componentWillReceiveProps(nextProps) {
if (!isEqual(this.props.range, nextProps.range) && nextProps.range) {
this.updateQueryOptions(nextProps, nextProps.range);
// floor and ceil to take edge cases into account
this.updateRange({
- 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 renderAsCard
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
renderAsCard({ item, triggerClickAnalytics }) {
const onData = this.$props.onData || this.$scopedSlots.onData;
const result = onData(item);
if (result) {
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
Avoid deeply nested control flow statements. Open
if (hasMissingTerm) {
should = should.concat({
bool: {
must_not: {
exists: { field: props.dataField }
Function render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
let selectAll = [];
if (this.state.options.length === 0) {
return null;
- 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 handleWindowMouseup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
handleWindowMouseup(event) {
this.isMouseDown = false;
if (
(event.target === this.$refs.rootNode
- 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
Avoid deeply nested control flow statements. Open
if (hasMissingTerm) {
should = should.concat({
bool: {
must_not: {
exists: { field: props.dataField }
Avoid deeply nested control flow statements. Open
if (
selectedValues[component.componentId]
&& selectedValues[component.componentId].value
) {
currentPage = selectedValues[component.componentId].value - 1 || 0;
Function componentWillReceiveProps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
componentWillReceiveProps(nextProps) {
if (
nextProps.onAllData
&& (!isEqual(nextProps.hits, this.props.hits)
|| !isEqual(nextProps.aggregations, this.props.aggregations))
- 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
Avoid deeply nested control flow statements. Open
if (hasMissingTerm) {
should = should.concat({
bool: {
must_not: {
exists: { field: props.dataField },
Avoid deeply nested control flow statements. Open
if (hasMissingTerm) {
should = should.concat({
bool: {
must_not: {
exists: { field: props.dataField },
Function mapStateToProps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const mapStateToProps = (state, props) => ({
categories:
(state.aggregations[props.componentId]
&& state.aggregations[props.componentId][props.categoryField]
&& state.aggregations[props.componentId][props.categoryField].buckets)
- 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
if (label && ((isArray && value.length) || (!isArray && value))) {
const valueToRender = this.renderValue(value, isArray);
return (
<Button
class={getClassName(this.$props.innerClass, 'button') || ''}
Consider simplifying this complex logical expression. Open
if (
!isEqual(this.props.sortOptions, nextProps.sortOptions)
|| this.props.sortBy !== nextProps.sortBy
|| this.props.size !== nextProps.size
|| !isEqual(this.props.dataField, nextProps.dataField)
Consider simplifying this complex logical expression. Open
if (label && ((isArray && value.length) || (!isArray && value))) {
const valueToRender = category
? this.renderValue(`${value} in ${category} category`, isArray)
: this.renderValue(value, isArray);
return (
Consider simplifying this complex logical expression. Open
if (
!isEqual(this.props.sortOptions, nextProps.sortOptions)
|| this.props.sortBy !== nextProps.sortBy
|| this.props.size !== nextProps.size
|| !isEqual(this.props.dataField, nextProps.dataField)
Consider simplifying this complex logical expression. Open
if (props.nestedField) {
options
= options
&& state.aggregations[props.componentId][props.dataField][props.nestedField]
&& state.aggregations[props.componentId][props.dataField][props.nestedField].buckets