Showing 9 of 9 total issues
File emtBot.js
has 447 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Copyright (c) 2018 Jesús Fernández <jesus@nublar.net>
// MIT License
'use strict';
const settings = require('./settings.js');
Function buildStop
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
const buildStop = function (rawStop) {
return new P(function (resolve, reject) {
let newStop = {};
let nodeId = _.get(rawStop, 'Node[0]', -1);
let stopId = _.get(rawStop, 'stopId', -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 findStops
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const findStops = function (query, location, exact = false) {
return new P(function (resolve, reject) {
let isEmptyQuery = false;
let isLocationQuery = false;
let isNaNQuery = 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
Function buildStop
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
const buildStop = function (rawStop) {
return new P(function (resolve, reject) {
let newStop = {};
let nodeId = _.get(rawStop, 'Node[0]', -1);
let stopId = _.get(rawStop, 'stopId', -1);
Function findStops
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
const findStops = function (query, location, exact = false) {
return new P(function (resolve, reject) {
let isEmptyQuery = false;
let isLocationQuery = false;
let isNaNQuery = false;
Function renderStop
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderStop = function (stop) {
return new P(function (resolve) {
let arriving = 'Sin estimaciones';
if (stop.arriving.length > 0) {
let widths = getColumnWidths(stop, columns);
Function processRefresh
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const processRefresh = function (request, stopId) {
if (_.isNaN(+stopId)) {
debug('Bad refresh stopId');
return;
}
Function getStopLocation
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getStopLocation = function (stopId, line, direction) {
debug(`Getting location for stop ${stopId} with line ${line} and direction ${direction}`);
let cachedStop = stopCache.filter(function (o) {
return o.Node == stopId;
})[0];
Function getArrivingBuses
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getArrivingBuses = function (stop) {
// Return a promise
return new P(function (resolve) {
EMTAPI.getIncomingBusesToStop(stop.Id)
.then(function (arriving) {
- 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"