Showing 9 of 13 total issues
Function commit
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
commit(streamName, events, expectedVersion = ExpectedVersion.Any, metadata = {}, callback = null) {
assert(!(this.storage instanceof Storage.ReadOnly), 'The storage was opened in read-only mode. Can not commit to it.');
assert(typeof streamName === 'string' && streamName !== '', 'Must specify a stream name for commit.');
assert(typeof events !== 'undefined' && events !== null, 'No events specified for commit.');
Function matches
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function matches(document, matcher) {
if (typeof document === 'undefined') return false;
if (typeof matcher === 'undefined') return true;
if (typeof matcher === 'function') return matcher(document);
- 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 ensureIndex
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
ensureIndex(name, matcher) {
if (name === '_all') {
return this.index;
}
if (name in this.secondaryIndexes) {
Function scanPartitions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
scanPartitions(config) {
const defaults = {
readBufferSize: DEFAULT_READ_BUFFER_SIZE
};
this.partitionConfig = Object.assign(defaults, config);
- 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 binarySearch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function binarySearch(number, length, get) {
let low = 1;
let high = length;
if (get(low) > number) {
- 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 commit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
commit(streamName, events, expectedVersion = ExpectedVersion.Any, metadata = {}, callback = null) {
assert(!(this.storage instanceof Storage.ReadOnly), 'The storage was opened in read-only mode. Can not commit to it.');
assert(typeof streamName === 'string' && streamName !== '', 'Must specify a stream name for commit.');
assert(typeof events !== 'undefined' && events !== null, 'No events specified for commit.');
- 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
return false;
Avoid too many return
statements within this function. Open
return true;
Function ensureIndex
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
ensureIndex(name, matcher) {
if (name === '_all') {
return this.index;
}
if (name in this.secondaryIndexes) {
- 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"