webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js
Function render
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { upstreamSubscriptions } = this.props;
const getSubscriptionActions = () => {
let actions = '';
Function quantityValidation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
quantityValidation(pool) {
const origQuantity = pool.updatedQuantity;
if (origQuantity && stringIsPositiveNumber(origQuantity)) {
const parsedQuantity = parseInt(origQuantity, 10);
const aboveZeroMsg = [false, __('Please enter a positive number above zero')];
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
const { upstreamSubscriptions } = this.props;
const getSubscriptionActions = () => {
let actions = '';
- 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 too many return
statements within this function. Open
Open
if (parsedQuantity <= 0) return aboveZeroMsg;
Avoid too many return
statements within this function. Open
Open
return [false, __('Please enter digits only')];
Avoid too many return
statements within this function. Open
Open
return [true, ''];