intranet/static/js/bus-afternoon.js

Summary

Maintainability
F
5 days
Test Coverage

File bus-afternoon.js has 636 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { getSocket } from "./bus-shared.js";

/* globals Messenger */
var bus = {};

Severity: Major
Found in intranet/static/js/bus-afternoon.js - About 1 day to fix

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

            render: function () {
                if (enableBusDriver && this.busDriver) {
    
                    return this;
                }
    Severity: Major
    Found in intranet/static/js/bus-afternoon.js - About 3 hrs to fix

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

              renderSearchView: function (routeList, action) {
                  var container = this.$el,
                      renderedContent = this.searchTemplate();
                  container.addClass('search-widget');
                  container.html(renderedContent);
      Severity: Minor
      Found in intranet/static/js/bus-afternoon.js - About 1 hr to fix

        Function handleBusSelect has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                handleBusSelect: function (e) {
                    if (this.clicked === false) {
                        return;
                    }
                    if (!isAdmin && this.busDriver) {
        Severity: Minor
        Found in intranet/static/js/bus-afternoon.js - About 1 hr to fix

          Function vroom has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  vroom: function () {
                      // Initializes busdriver
                      //console.log('Hi');
                      if (enableBusDriver) {
                          this.busDriver = true;
          Severity: Minor
          Found in intranet/static/js/bus-afternoon.js - About 1 hr to fix

            Function animateBus has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    animateBus: function (time) {
                        if (document.hidden || time - this.busDriver.lastFrame > 2000) {
                            this.busDriverBus.lastFrame = time;
                            return;
                        }
            Severity: Minor
            Found in intranet/static/js/bus-afternoon.js - About 1 hr to fix

              Function handleAction has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      handleAction: function () {
                          if (this.clicked) {
                              return;
                          }
                          switch (this.action) {
              Severity: Minor
              Found in intranet/static/js/bus-afternoon.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                                                    if(route.attributes.route_name.length > 5) {
                                                        text.node.classList.add("extra-small");
                                                    }
                Severity: Major
                Found in intranet/static/js/bus-afternoon.js - About 45 mins to fix

                  FIXME found
                  Open

                              // FIXME: hacky solution to reset action button.
                  Severity: Minor
                  Found in intranet/static/js/bus-afternoon.js by fixme

                  TODO found
                  Open

                  /*  TODO: flip bus map to be horizontal
                  Severity: Minor
                  Found in intranet/static/js/bus-afternoon.js by fixme

                  TODO found
                  Open

                                                              // TODO: less hacky deep copy
                  Severity: Minor
                  Found in intranet/static/js/bus-afternoon.js by fixme

                  TODO found
                  Open

                              //         // TODO: Auto-focus the input field again and get the virtual keyboard to show up.
                  Severity: Minor
                  Found in intranet/static/js/bus-afternoon.js by fixme

                  TODO found
                  Open

                                  // TODO: this is also super hacky
                  Severity: Minor
                  Found in intranet/static/js/bus-afternoon.js by fixme

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                                                  if(tbox.width > tbox.height) {
                                                      dimenDiff = sbox.width - tbox.width;
                                                      offset = tbox.x - sbox.x;
                                                  }
                                                  else {
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 1 other location - About 3 hrs to fix
                  intranet/static/js/bus-afternoon.js on lines 390..397

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 99.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                                                  if(tbox.width > tbox.height) {
                                                      dimenDiff = sbox.width - tbox.width;
                                                      offset = tbox.x - sbox.x;
                                                  }
                                                  else {
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 1 other location - About 3 hrs to fix
                  intranet/static/js/bus-afternoon.js on lines 364..371

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 99.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if (!window.isAdmin) {
                                  this.icon = 'fas fa-search';
                                  this.text = '   Search for a bus';
                                  this.action = 'Search for a bus';
                              } else {
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 1 other location - About 2 hrs to fix
                  intranet/static/js/bus-afternoon.js on lines 51..59

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 83.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if (!window.isAdmin) {
                                  this.icon = 'fas fa-search';
                                  this.text = '   Search for a bus';
                                  this.action = 'Search for a bus';
                              } else {
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 1 other location - About 2 hrs to fix
                  intranet/static/js/bus-afternoon.js on lines 288..296

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 83.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if (e.keyCode === 37 || e.keyCode === 65) {
                                  this.busDriverBus.direction -= this.busDriverBus.speed * Math.PI / 180;
                                  this.busDriverBus.pressed = true;
                              }
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 1 other location - About 2 hrs to fix
                  intranet/static/js/bus-afternoon.js on lines 518..521

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 77.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if (e.keyCode === 39 || e.keyCode === 68) {
                                  this.busDriverBus.direction += this.busDriverBus.speed * Math.PI / 180;
                                  this.busDriverBus.pressed = true;
                              }
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 1 other location - About 2 hrs to fix
                  intranet/static/js/bus-afternoon.js on lines 514..517

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 77.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if (!isAdmin && enableBusDriver) {
                                  this.icon = 'fas fa-bus';
                                  this.text = 'skrt skrt';
                                  this.action = 'vroom';
                                  this.selected = space;
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 1 other location - About 1 hr to fix
                  intranet/static/js/bus-afternoon.js on lines 267..273

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 67.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                              if (!isAdmin && enableBusDriver) {
                                  this.icon = 'fas fa-bus';
                                  this.text = 'skrt skrt';
                                  this.action = 'vroom';
                                  this.selected = space;
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 1 other location - About 1 hr to fix
                  intranet/static/js/bus-afternoon.js on lines 253..259

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 67.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          initialize: function () {
                              _.bindAll(this, 'render');
                              this.template = _.template($('#status-group-view').html());
                          },
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 3 other locations - About 50 mins to fix
                  intranet/static/js/eighth/signup.js on lines 36..39
                  intranet/static/js/bus-afternoon.js on lines 31..34
                  intranet/static/js/bus-afternoon.js on lines 602..605

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          initialize: function() {
                              _.bindAll(this, 'render');
                              this.template = _.template($('#personal-status').html());
                          },
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 3 other locations - About 50 mins to fix
                  intranet/static/js/eighth/signup.js on lines 36..39
                  intranet/static/js/bus-afternoon.js on lines 602..605
                  intranet/static/js/bus-afternoon.js on lines 627..630

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                          initialize: function () {
                              _.bindAll(this, 'render');
                              this.template = _.template($('#route-view').html());
                          },
                  Severity: Major
                  Found in intranet/static/js/bus-afternoon.js and 3 other locations - About 50 mins to fix
                  intranet/static/js/eighth/signup.js on lines 36..39
                  intranet/static/js/bus-afternoon.js on lines 31..34
                  intranet/static/js/bus-afternoon.js on lines 627..630

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status