umts/pvta-multiplatform

View on GitHub

Showing 225 of 225 total issues

File plan-trip.component.ts has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Component, ViewChild, ElementRef } from '@angular/core';
import { Geolocation } from '@ionic-native/geolocation';
import { NavController, LoadingController, AlertController, NavParams } from 'ionic-angular';
import { StopService } from '../../providers/stop.service';
import { MapService } from '../../providers/map.service';
Severity: Minor
Found in src/pages/plan-trip/plan-trip.component.ts - About 4 hrs to fix

    Function getRoute has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

       getRoute(): void {
         if (this.originDestToast) {
           this.toastSvc.noOriginOrDestinationToast();
         }
        // We need an origin and destination
    Severity: Major
    Found in src/pages/plan-trip/plan-trip.component.ts - About 3 hrs to fix

      File routes-and-stops.component.ts has 273 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Component } from '@angular/core';
      import { NavController, LoadingController, AlertController } from 'ionic-angular';
      import { Storage } from '@ionic/storage';
      import { Geolocation } from '@ionic-native/geolocation';
      import { RouteService } from '../../providers/route.service';
      Severity: Minor
      Found in src/pages/routes-and-stops/routes-and-stops.component.ts - About 2 hrs to fix

        Function constructMap has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructMap(): void {
            var mapOptions = {
              zoom: 15,
              mapTypeControl: false,
              mapTypeId: google.maps.MapTypeId.ROADMAP,
        Severity: Major
        Found in src/pages/plan-trip/plan-trip.component.ts - About 2 hrs to fix

          File stop.component.ts has 262 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Component, ChangeDetectorRef } from '@angular/core';
          
          import { NavController, NavParams, LoadingController, AlertController } from 'ionic-angular';
          import { Storage } from '@ionic/storage';
          import { StopDeparture } from '../../models/stop-departure.model';
          Severity: Minor
          Found in src/pages/stop/stop.component.ts - About 2 hrs to fix

            Function toggleOrdering has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              toggleOrdering(): void {
                this.onSearchQueryChanged(this.searchQuery);
                var routeOrderings = ['favorites', 'name'];
                var stopOrderings = ['favorites', 'distance'];
                let primarySort: string;
            Severity: Major
            Found in src/pages/routes-and-stops/routes-and-stops.component.ts - About 2 hrs to fix

              Function sort has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                sort (directions): any {
                  this.departuresByTime = [];
                  this.departuresByDirection = [];
                  // Avail returns an array of RouteDirections. We must deal
                  // with the Departures for each Direction.
              Severity: Minor
              Found in src/pages/stop/stop.component.ts - 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 getRoute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                 getRoute(): void {
                   if (this.originDestToast) {
                     this.toastSvc.noOriginOrDestinationToast();
                   }
                  // We need an origin and destination
              Severity: Minor
              Found in src/pages/plan-trip/plan-trip.component.ts - 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 toggleOrdering has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                toggleOrdering(): void {
                  this.onSearchQueryChanged(this.searchQuery);
                  var routeOrderings = ['favorites', 'name'];
                  var stopOrderings = ['favorites', 'distance'];
                  let primarySort: string;
              Severity: Minor
              Found in src/pages/routes-and-stops/routes-and-stops.component.ts - 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 ionViewWillEnter has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                ionViewWillEnter() {
                  this.getAlerts();
                  this.favoriteStopSvc.contains(this.stopId, (liked) => {
                    this.liked = liked;
                  });
              Severity: Minor
              Found in src/pages/stop/stop.component.ts - About 1 hr to fix

                Function loadLocation has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  loadLocation(): void {
                    let options = {timeout: 5000, enableHighAccuracy: true};
                    this.geolocation.getCurrentPosition(options).then(position => {
                      // Geocode current position to retrieve its corresponding Google Maps ID
                      new google.maps.Geocoder().geocode(
                Severity: Minor
                Found in src/pages/plan-trip/plan-trip.component.ts - About 1 hr to fix

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

                    placeVehicles (isVehicleRefresh) {
                      // Places every vehicle on said route on the map
                        this.mapSvc.removeAllMarkers();
                        if (!this.vehicles) {
                          return;
                  Severity: Minor
                  Found in src/pages/route-map/route-map.component.ts - About 1 hr to fix

                    Function reload has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      reload(loadedTrip): void {
                        // @TODO Scroll to input area first
                        this.constructMap();
                        this.noLocation = false;
                        // If we loaded a trip (user came via
                    Severity: Minor
                    Found in src/pages/plan-trip/plan-trip.component.ts - About 1 hr to fix

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

                        sort (directions): any {
                          this.departuresByTime = [];
                          this.departuresByDirection = [];
                          // Avail returns an array of RouteDirections. We must deal
                          // with the Departures for each Direction.
                      Severity: Minor
                      Found in src/pages/stop/stop.component.ts - About 1 hr to fix

                        Function saveTrip has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          saveTrip(): void {
                            console.log('saving trip yo');
                             this.alertCtrl.create({
                               title: 'Save Trip',
                               message: 'Give this trip a name',
                        Severity: Minor
                        Found in src/pages/plan-trip/plan-trip.component.ts - About 1 hr to fix

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

                            getRouteList(): Promise<any> {
                              console.log('getroutelist top');
                              return this.storage.ready().then(() => {
                                console.log('getroutelist storage ready');
                                return this.storage.get('routes').then((routes) => {
                          Severity: Minor
                          Found in src/providers/route.service.ts - About 1 hr to fix

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

                              getDepartures(refresher?: any): void {
                                this.stopDepartureSvc.getStopDeparture(this.stopId)
                                  .then(directions => {
                                    this.sort(directions[0]);
                                    let routeIds = _.uniq(_.map(directions[0].RouteDirections, 'RouteId'));
                            Severity: Minor
                            Found in src/pages/stop/stop.component.ts - About 1 hr to fix

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

                                calculateStopDistances(position?): void {
                                  if (position) {
                                    var currentPosition = {
                                      latitude: position.coords.latitude,
                                      longitude: position.coords.longitude
                              Severity: Minor
                              Found in src/pages/routes-and-stops/routes-and-stops.component.ts - About 1 hr to fix

                                Function reload has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  reload(loadedTrip): void {
                                    // @TODO Scroll to input area first
                                    this.constructMap();
                                    this.noLocation = false;
                                    // If we loaded a trip (user came via
                                Severity: Minor
                                Found in src/pages/plan-trip/plan-trip.component.ts - About 55 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 calculateStopDistances has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  calculateStopDistances(position?): void {
                                    if (position) {
                                      var currentPosition = {
                                        latitude: position.coords.latitude,
                                        longitude: position.coords.longitude
                                Severity: Minor
                                Found in src/pages/routes-and-stops/routes-and-stops.component.ts - About 45 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

                                Severity
                                Category
                                Status
                                Source
                                Language