Showing 14 of 14 total issues
Function nearBy
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
nearBy(lat, lon, radius) {
const limit = this._limit;
this._limit = this._constLimit;
if (isGeoJSON(this.data)) {
- 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 createCompactSet
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.createCompactSet = (data, opts) => {
if (typeof data === 'string') {
try {
data = JSON.parse(data);
} catch (e) {
Function searchBetween
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function searchBetween(set, min, max, limit) {
const hash = set.hash;
const data = set.data;
const result = [];
const length = data.length;
- 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 nearBy
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
nearBy(lat, lon, radius) {
const limit = this._limit;
this._limit = this._constLimit;
if (isGeoJSON(this.data)) {
Function createCompactSet
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.createCompactSet = (data, opts) => {
if (typeof data === 'string') {
try {
data = JSON.parse(data);
} catch (e) {
- 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 medianOf
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function medianOf(low, mid, high) {
if (mid.g < low.g) {
if (high.g < mid.g) {
return mid;
}
- 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 getCoords
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getCoords = data => {
if (data && data.type === 'Point') {
const coords = data.coordinates;
if (isArray(coords) && coords.length === 2) {
const lat = coords[1];
- 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 partition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function partition(items, l, r, x) {
while (l <= r) {
while (items[l].g < x.g) {
l++;
}
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(data, opts) {
opts = opts || {};
this.data = data || [];
this.hash = opts.hash || 'g';
this.setOptions = opts.setOptions || 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"
Further reading
Avoid too many return
statements within this function. Open
return nearBy(this, { lat, lon, radius });
Avoid too many return
statements within this function. Open
return nearBy(this, { lat, lon, radius, limit }).slice(0, limit);
Function isGeoJSON
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports.isGeoJSON = data => {
if (data) {
if (data.type) {
if (geoTypes[data.type]) {
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"
Further reading
Function binarySearch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports.binarySearch = (set, needle, low, high, max) => {
const hash = set.hash;
const data = set.data;
while (low <= high) {
- 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 downHeap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function downHeap(items, k, n) {
const item = items[k];
let child;
while ((child = 2 * k + 1) < n) { // eslint-disable-line no-cond-assign
- 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"