Showing 4 of 17 total issues
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let example;
switch(this.state.example) {
case '1': example = <Example1/>; break;
case '2': example = <Example2/>; break;
Function componentWillReceiveProps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
componentWillReceiveProps(nextProps) {
if (nextProps.reversed && !this.props.reversed) {
let target = typeof this.props.target === 'function' ? this.props.target() : this.props.target;
if (!(target instanceof HTMLElement)) target = ReactDOM.findDOMNode(this.props.target);
const width = Math.round(target.getBoundingClientRect().width);
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
componentWillReceiveProps(nextProps) {
if (nextProps.outOfBoundsBottom) {
const rect = ReactDOM.findDOMNode(this).getBoundingClientRect();
if (!this.originalHeight) this.originalHeight = rect.height;
if (rect.top + this.originalHeight > document.documentElement.clientHeight) {
- 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 shallowEqual
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function shallowEqual(objA, objB) {
if (objA === objB) {
return true
}
- 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"