conveyal/modeify

View on GitHub

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')
Severity: Minor
Found in client/options-view/index.js - About 35 mins to fix

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;

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]) {
Severity: Minor
Found in client/components/conveyal/transitive.js/master/lib/styler/index.js - About 35 mins to fix

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()

Severity: Minor
Found in client/route-summary-segments/index.js - About 35 mins to fix

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
Severity: Minor
Found in client/plan/index.js - About 35 mins to fix

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) {
Severity: Minor
Found in client/plan/update-routes.js - About 35 mins to fix

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
Severity: Minor
Found in client/route-directions-table/index.js - About 35 mins to fix

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')
Severity: Minor
Found in client/planner-page/index.js - About 35 mins to fix

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]) {
Severity: Minor
Found in client/components/conveyal/transitive.js/master/lib/styler/index.js - About 35 mins to fix

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: [],
Severity: Minor
Found in client/components/conveyal/otp-profiler/master/index.js - About 35 mins to fix

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) {
Severity: Minor
Found in client/commuter-form/index.js - About 35 mins to fix

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) ?
Severity: Minor
Found in client/components/conveyal/transitive.js/master/lib/display/index.js - About 35 mins to fix

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
Severity: Minor
Found in client/components/visionmedia/superagent/v1.1.0/lib/client.js - About 35 mins to fix

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
  }
Severity: Minor
Found in lib/email/model.js - About 35 mins to fix

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
Severity: Minor
Found in lib/model-router.js - About 35 mins to fix

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;

Severity: Minor
Found in client/components/pazguille/scrolling/0.1.0/index.js - About 35 mins to fix

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) {
Severity: Minor
Found in lib/r5.js - About 35 mins to fix

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);
Severity: Major
Found in client/components/yields/store/master/index.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        if (b.point && b.point.getType() === 'STOP') return 1;
    Severity: Major
    Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          if (a.point && a.point.getType() === 'STOP') return -1;
      Severity: Major
      Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 30 mins to fix
        Severity
        Category
        Status
        Source
        Language