conveyal/modeify

View on GitHub

Showing 301 of 580 total issues

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

function encode (address, magicKey, callback) {
  if (!callback) {
    callback = magicKey
    magicKey = undefined
  }
Severity: Minor
Found in lib/geocode.js - About 1 hr to fix

    Function getModeStyles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    Styler.prototype.getModeStyles = function(mode, display) {
      var modeStyles = {};
    
      // simulate a segment w/ the specified style
      var segment = {
    Severity: Minor
    Found in client/components/conveyal/transitive.js/master/lib/styler/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 itinerary has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    View.prototype.itinerary = function () {
      var access = this.model.access()[0]
      var egress = this.model.egress()
      var segments = this.model.transit()
      var length = segments.length
    Severity: Minor
    Found in client/route-directions-table/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 showAnnouncements has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function showAnnouncements (ctx, next) {
      var autoshow = arguments.length === 0
      var announcements = config.announcements ? config.announcements() : false
      var modal
      var profile = session.commuter().profile()
    Severity: Minor
    Found in client/announcements/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 showQuery has a Cognitive Complexity of 13 (exceeds 5 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

    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 generateErrorMessage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function generateErrorMessage (plan, response) {
      var msg = 'No results! '
      var responseText = response ? response.text : ''
    
      if (responseText.indexOf('VertexNotFoundException') !== -1) {
    Severity: Minor
    Found in client/plan/update-routes.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 Display has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function Display(transitive) {
      this.transitive = transitive;
      var el = this.el = transitive.el;
      this.width = el.clientWidth;
      this.height = el.clientHeight;

    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 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(points) {
      var newPoints, i, r;
    
      // determine if we need to resample the path (i.e. place new points at a regular
      // interval for marker-based styling) based on styler settings

      Function seedrandom has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function seedrandom(seed, options, callback) {
        var key = [];
        options = (options == true) ? { entropy: true } : (options || {});
      
        // Flatten the seed string or build one from local entropy if needed.
      Severity: Minor
      Found in client/components/davidbau/seedrandom/2.4.0/seedrandom.js - About 1 hr to fix

        Function filterExcessiveTransitOptions has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function filterExcessiveTransitOptions (opts) {
          var comparator = function (a, b) {
            return b.score - a.score
          }
          var bikeToTransitOpts = new PriorityQueue(comparator)
        Severity: Minor
        Found in lib/plan/profile-filter.js - About 1 hr to fix

          Function request has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const request = module.exports.request = function request (url) {
            return new Promise((resolve, reject) => {
              const options = {
                host: otp.host,
                method: 'GET',
          Severity: Minor
          Found in lib/otp/index.js - About 1 hr to fix

            Function continue has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Modal.prototype.continue = function (e) {
              e.preventDefault()
              var selections = {
                commuterId: this.find('.commuter-id-select').value,
                email: this.find('.email-select').value,
            Severity: Minor
            Found in client/location-page/commuter-upload-modal.js - About 1 hr to fix

              Function Label has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var Label = augment(Object, function() {
              
                this.constructor = function(parent) {
                  this.parent = parent;
                  this.sortableType = 'LABEL';

                Function updateTable has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                View.prototype.updateTable = function () {
                  var users = this.users || []
                
                  var fromDate = moment(this.fromDatePicker.getDate())
                  var toDate = moment(this.toDatePicker.getDate())
                Severity: Minor
                Found in client/user-activity-page/index.js - About 1 hr to fix

                  Function downloadMatches has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  View.prototype.downloadMatches = function () {
                    let csvContent = 'data:text/csv;charset=utf-8,'
                    csvContent += 'commuter1_first,commuter1_last,commuter1_email,commuter1_internalId,commuter2_first,commuter2_last,commuter2_email,commuter2_internalId,distance\n'
                  
                    const matchedKeys = []
                  Severity: Minor
                  Found in client/location-page/index.js - About 1 hr to fix

                    Function show has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      Modal.prototype.show = function (fn) {
                        log('showing modal')
                    
                        var modal = this.modal = createModal(this.el).overlay()
                        var el = modal.el
                    Severity: Minor
                    Found in client/modal/index.js - About 1 hr to fix

                      Function modeDescriptor has 36 lines of code (exceeds 25 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

                        Function intersect has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        RenderedEdge.prototype.intersect = function(rEdge) {
                        
                          // do no intersect adjacent edges of unequal bundle size
                          if (this.graphEdge.renderedEdges.length !== rEdge.graphEdge.renderedEdges.length) return;
                        
                        

                          Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Legend.prototype.render = function(legendSegments) {
                          
                            d3.select(this.el).selectAll(':not(.doNotEmpty)').remove();
                          
                            this.x = this.spacing;

                            Function generate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            schema.statics.generate = function (data, callback) {
                              if (!data.locations || !data.locations.length || data.locations.length < 2) {
                                return callback(new Error('Journey requires 2 or more locations.'))
                              }
                            
                            
                            Severity: Minor
                            Found in lib/journey/model.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language