Showing 301 of 580 total issues
File index.js
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
var d3 = require('d3');
var debug = require('debug')('transitive:display');
var each = require('each');
var Legend = require('./legend');
File r5.js
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
const geoTz = require('geo-tz')
const fetch = require('isomorphic-fetch')
const moment = require('moment-timezone')
const config = require('./config')
Function end
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Request.prototype.end = function(fn){
var self = this;
var xhr = this.xhr = request.getXHR();
var query = this._query.join('&');
var timeout = this._timeout;
Function notifyManagers
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
schema.statics.notifyManagers = function (_location) {
// get the location
Location.findById(_location, (err, location) => {
if (err) {
log.error('Could not find locations', err)
Function end
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Batch.prototype.end = function(cb){
var self = this
, total = this.fns.length
, pending = total
, results = []
Function placePointLabels
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.placePointLabels = function() {
var styler = this.transitive.styler;
var labeledPoints = [];
Function setOrientation
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.setOrientation = function(orientation) {
this.orientation = orientation;
var markerBBox = this.parent.getMarkerBBox();
if (!markerBBox) return;
Function exports
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (ctx, next) {
log('render')
var transitiveLayer
var plan = ctx.session.plan()
Function load
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
session.load = function (ctx, next) {
session.settings(store('session') || DEFAULT_SETTINGS)
loadUser(function (err) {
if (err) return next(err)
Function send
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.send = function send (options, callback, template) {
if (process.env.NODE_ENV === 'test') {
if (options.to.email && options.template) {
return callback(null, {
_id: '123',
Function setAddress
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Plan.prototype.setAddress = function (name, locationData, callback) {
callback = callback || function () {} // noop callback
if (
!locationData &&
(
- 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 load
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Network.prototype.load = function(data) {
debug('loading', data);
var self = this;
// check 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 render
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
module.exports.render = function (ctx, next) {
if (ctx.redirect) {
log('redirecting from %s to %s', decodeURIComponent(ctx.path), ctx.redirect)
return page.redirect(ctx.redirect + window.location.search)
}
- 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 refresh
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.refresh = function(panning) {
base.refresh.call(this, panning);
var display = this.transitive.display;
var network = this.transitive.network;
Function exports
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(Model) {
/**
* Create `get` request
*/
Function PointClusterMap
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PointClusterMap(transitive) {
this.transitive = transitive;
this.clusters = [];
this.clusterLookup = {}; // maps Point object to its containing cluster
Function exports
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function() {
var size = [960, 500],
scale = 256,
translate = [size[0] / 2, size[1] / 2],
zoomDelta = 0;
Function placeSegmentLabels
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.placeSegmentLabels = function() {
each(this.segmentLabels, function(label) {
label.clear();
});
Function formatDepartureTimes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function formatDepartureTimes (times) {
var hours = {}
var maxPerHour = 0
var text = ''
- 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 pathtoRegexp
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function pathtoRegexp (path, keys, options) {
if (keys && !Array.isArray(keys)) {
options = keys;
keys = null;
}
- 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"