Showing 301 of 580 total issues
Function modeList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
View.prototype.modeList = function () {
var modes = []
if (this.model.bus() || this.model.train()) modes.push('transit')
if (this.model.bike() || this.model.bikeShare()) modes.push('biking')
if (this.model.car()) modes.push('driving')
- 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 findExtension
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
RenderedEdge.prototype.findExtension = function(vertex) {
var incidentEdges = vertex.incidentEdges(this.graphEdge);
var bundlerId = this.patternIds || this.pathSegmentIds;
for (var e = 0; e < incidentEdges.length; e++) {
var edgeSegments = incidentEdges[e].renderedEdges;
- 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 reset
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Styler.prototype.reset = function() {
for (var i in types) {
var type = types[i];
this[type] = clone(styles[type] || {});
for (var key in this[type]) {
- 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 exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (route, opts) {
opts = opts || {}
var accessMode = route.access()[0].mode.toLowerCase()
- 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 generateQuery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Plan.prototype.generateQuery = function () {
var from = this.from_ll() || {}
var to = this.to_ll() || {}
// Transit modes
- 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 updateRoutes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function updateRoutes (plan, opts, callback) {
opts = opts || {}
const done = function (err, res) {
if (err) {
- 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 getRouteNames
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getRouteNames (routes) {
var agencyRoutes = {} // maps agency name to array of routes
routes.forEach(function (r) {
var agencyName = r.agencyName
// FIXME: fix this in the R5 response
- 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 View
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var View = view(require('./template.html'), function (view, model) {
view.scrollable = view.find('.scrollable')
view.panelFooter = view.find('.footer')
view.optionsContainer = view.find('.options-container')
view.welcomeBox = view.find('.welcome-box')
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
Styler.prototype.load = function(styles) {
var self = this;
for (var i in types) {
var type = types[i];
if (styles[type]) {
- 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 convertOtpData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Profiler.prototype.convertOtpData = function(opts) {
var self = this;
self.data = {
journeys: [],
patterns: [],
- 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 save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
View.prototype.save = function (e) {
debug('save')
var data = serialize(this.el)
if (!data.internalId && !data.email) {
- 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 updateActiveZoomFactors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Display.prototype.updateActiveZoomFactors = function(scale) {
var updated = false;
for (var i = 0; i < this.zoomFactors.length; i++) {
var min = this.zoomFactors[i].minScale;
var max = (i < this.zoomFactors.length - 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 Response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function Response(req, options) {
options = options || {};
this.req = req;
this.xhr = this.req.xhr;
// responseText is accessible only if responseType is '' or 'text' and on older browsers
- 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 updateCommuter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
schema.methods.updateCommuter = function (commuter, callback) {
if (arguments.length === 1) {
callback = commuter
commuter = this._commuter
}
- 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 modelRouter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function modelRouter (opts, fn) {
var router = express.Router()
var middleware = opts.middleware || []
var Model = opts.model
var name = opts.name || Model.modelName
- 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 remove
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Scroll.prototype.remove = function (el, listener) {
var listeners = this._collection[el].listeners,
i = 0,
len = listeners.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 requestPlan
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.requestPlan = function (plan) {
if (config.r5 || process.env.TEST_R5_URL) {
const r5Url = config.r5 ? config.r5.url : process.env.TEST_R5_URL
const timezoneName = geoTz.tz(plan.from.lat, plan.from.lon)
if (!timezoneName) {
- 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
if ('string' == typeof key) return get(key);
Avoid too many return
statements within this function. Open
if (b.point && b.point.getType() === 'STOP') return 1;
Avoid too many return
statements within this function. Open
if (a.point && a.point.getType() === 'STOP') return -1;