conveyal/modeify

View on GitHub

Showing 301 of 580 total issues

Function Place has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

var Place = augment(Point, function(base) {

  /**
   *  the constructor
   */
Severity: Minor
Found in client/components/conveyal/transitive.js/master/lib/point/place.js - About 1 hr 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 modeDescriptor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

Route.prototype.modeDescriptor = function () {
  var modeStr = ''
  var accessMode = this.access()[0].mode.toLowerCase()
  var egressMode = this.egress() ? this.egress()[0].mode.toLowerCase() : false

Severity: Minor
Found in client/route/index.js - About 1 hr 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 createView has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function createView (template, fn) {
  if (!template) throw new Error('template required');

  /**
   * Initialize a new `View` with an optional `model`, `el` and `options`.
Severity: Minor
Found in client/components/trevorgerhardt/view/0.4.1/lib/index.js - About 1 hr 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 getAccounts has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports.getAccounts = function (params, callback) {
  function getUsers () {
    fetch(`https://${process.env.AUTH0_DOMAIN}/api/v2/users?${qs.stringify(params)}`, {
      headers: {
        authorization: `Bearer ${managementAPIAccessToken}`,
Severity: Minor
Found in lib/auth0.js - About 1 hr to fix

    Function populateGraphEdges has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Network.prototype.populateGraphEdges = function() {
      var self = this;
      // vertex associated with the last vertex point we passed in this sequence
      var lastVertex = null;
    
    
    Severity: Minor
    Found in client/components/conveyal/transitive.js/master/lib/core/network.js - About 1 hr to fix

      Function exports has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function (el) {
        try {
          // create the map
          var map = L.map(el, {
            attributionControl: {
      Severity: Minor
      Found in client/map-view/index.js - About 1 hr to fix

        Function showQuery has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function showQuery (query) {
          var plan = session.plan()
          // If no querystring, see if we have them in the plan already
        
          var from, to
        Severity: Minor
        Found in client/planner-page/index.js - About 1 hr to fix

          Function exports has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (Model) {
            Model
              .attr('coordinate')
              .attr('address')
              .attr('original_address')
          Severity: Minor
          Found in client/model-geo/index.js - About 1 hr to fix

            Function save has 42 lines of code (exceeds 25 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 1 hr to fix

              Function walkthrough has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function walkthrough () {
                var intro = introJs()
              
                intro.onbeforechange(function (el) {
                  if (el.classList.contains('option')) {
              Severity: Minor
              Found in client/planner-walkthrough/index.js - About 1 hr to fix

                Function splitEdgeAtInternalPoints has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                NetworkGraph.prototype.splitEdgeAtInternalPoints = function(edge, points) {
                  var subEdgePoints = [],
                    newEdge, newEdgeInfoArr = [];
                  var fromVertex = edge.fromVertex;
                  each(edge.pointArray, function(point) {
                Severity: Minor
                Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 1 hr to fix

                  Function formatDepartureTimes has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function formatDepartureTimes (times) {
                    var hours = {}
                    var maxPerHour = 0
                    var text = ''
                  
                  
                  Severity: Minor
                  Found in client/route-directions-table/index.js - About 1 hr to fix

                    Function refreshRenderData has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    RenderedEdge.prototype.refreshRenderData = function(display) {
                      if (this.graphEdge.fromVertex.x === this.graphEdge.toVertex.x &&
                        this.graphEdge.fromVertex.y === this.graphEdge.toVertex.y) {
                        this.renderData = [];
                        return;

                      Function debug has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function debug(namespace) {
                      
                        // define the `disabled` version
                        function disabled() {
                        }
                      Severity: Minor
                      Found in client/components/visionmedia/debug/2.1.3/debug.js - About 1 hr to fix

                        Function createOrRetrieveAccount has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function createOrRetrieveAccount (application, directory, data) {
                          return new Promise((resolve, reject) => {
                            directory.createAccount(data, {
                              registrationWorkflowEnabled: false
                            }, (err, account) => {
                        Severity: Minor
                        Found in lib/user/index.js - About 1 hr to fix

                          Function refresh has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Modal.prototype.refresh = function (e) {
                            if (e) e.preventDefault()
                            log('refreshing')
                          
                            primaryFilter = this.primaryFilter.value
                          Severity: Minor
                          Found in client/help-me-choose-view/index.js - About 1 hr to fix

                            Function submit has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            Modal.prototype.submit = function (e) {
                              e.preventDefault()
                              var alerts = this.find('.alerts')
                              var button = this.find('button')
                              var textarea = this.find('textarea')
                            Severity: Minor
                            Found in client/feedback-modal/index.js - About 1 hr to fix

                              Function initComparisons has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              NetworkGraph.prototype.initComparisons = function() {
                              
                                this.bundleComparisons = {};
                              
                                each(this.vertices, function(vertex) {
                              Severity: Minor
                              Found in client/components/conveyal/transitive.js/master/lib/graph/index.js - About 1 hr to fix

                                Function sendEmail has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                schema.methods.sendEmail = function (template, options) {
                                  const name = `${this.givenName} ${this.surname}`
                                
                                  return new Promise((resolve, reject) => {
                                    const opts = Object.assign({}, {
                                Severity: Minor
                                Found in lib/commuter/model.js - About 1 hr to fix

                                  Function parse has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function parse(str) {
                                    var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
                                    if (!match) return;
                                    var n = parseFloat(match[1]);
                                    var type = (match[2] || 'ms').toLowerCase();
                                  Severity: Minor
                                  Found in client/components/rauchg/ms.js/0.7.0/index.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language