Showing 8 of 8 total issues
Function birdwatcher
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
export default function birdwatcher(watchedComponent, name = '', configuration = defaultConfiguration) {
if (typeof name === 'object') {
configuration = name;
name = '';
}
- 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 birdwatcher
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function birdwatcher(watchedComponent, name = '', configuration = defaultConfiguration) {
if (typeof name === 'object') {
configuration = name;
name = '';
}
Function default
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(birdwatcheredObj, name, methodName, method, configuration, birdwatcherObject) {
return function() {
try {
return method.apply(this, arguments);
} catch (o_O) {
Function configure
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function configure(birdwatcherOverride, nameOverride, configurationOverride) {
if (!isBirdwatcher(birdwatcherOverride)) {
configurationOverride = nameOverride;
nameOverride = birdwatcherOverride;
birdwatcherOverride = false;
Avoid deeply nested control flow statements. Open
if (isWatchablePropertyOfComponent(watchedComponent, prop)) {
/**
* Create a cloure which will be called instead of the existing method on the birdwatchered object.
* Usually it will simply add a call for the method and return it's value, as usual.
* This is a completly covert operation... the object being birdwatchered doesn't even know
Function default
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export default function(birdwatcheredObj, name, methodName, method, configuration, birdwatcherObject) {
Function pick
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function pick(source, ...keys) {
const pickedObject = {};
if (typeof source === 'object') {
while (keys.length) {
const key = keys.pop();
- 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 isWatchablePropertyOfConstructor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function isWatchablePropertyOfConstructor(WatchedClass, methodName) {
if (!WatchedClass || !methodName) {
return false;
}
- 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"