donmahallem/TrapezeClientNg

View on GitHub

Showing 13 of 40 total issues

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

    public ngAfterViewInit() {
        super.ngAfterViewInit();
        this.addMarker();
        this.startVehicleUpdater();
        const ourCustomControl = L.Control.extend({
Severity: Minor
Found in src/app/modules/main-map/main-map.directive.ts - About 1 hr to fix

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

        public addMarker(): void {
            this.updateObservable = this.vehicleLocationSubject
                .pipe(map((loc: ITimestampVehicleLocation) => loc.vehicle))
                .subscribe((location) => {
                    if (this.stopMarkerLayer) {
    Severity: Minor
    Found in src/app/modules/trip-passages/follow-bus-map.directive.ts - About 1 hr to fix

      Function setVehicles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public setVehicles(vehicles: IVehicleLocationList): void {
              if (this.vehicleMarkerLayer !== undefined) {
                  this.vehicleMarkerLayer.clearLayers();
              } else {
                  this.vehicleMarkerLayer = L.featureGroup();
      Severity: Minor
      Found in src/app/modules/main-map/main-map.directive.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 start has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public start(): void {
              if (this.subscription && !this.subscription.closed) {
                  return;
              }
              this.subscription = this.updateSubject
      Severity: Minor
      Found in src/app/modules/main-map/main-map-route-display-handler.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 ngAfterViewInit has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public ngAfterViewInit(): void {
              this.mTimerObservable = timer(this.tickInterval, this.tickInterval);
              this.mTimerObservable.subscribe((tick: number) => {
                  const ticksLeft: number = this.ticksToRefresh - (tick % this.ticksToRefresh);
                  const diff: number = Math.round((ticksLeft * this.tickInterval) / 1000);
      Severity: Minor
      Found in src/app/modules/stop/stop-info.component.ts - About 1 hr to fix

        Function onAdd has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    onAdd: () => {
                        const container = L.DomUtil.create('i', 'material-icons leaflet-bar leaflet-control leaflet-control-custom');
                        container.style.backgroundColor = 'white';
                        container.style.width = '42px';
                        container.style.height = '42px';
        Severity: Minor
        Found in src/app/modules/main-map/main-map.directive.ts - About 1 hr to fix

          Function startUpdater has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public startUpdater(): void {
                  if (this.updateSubscription) {
                      return;
                  }
                  this.updateSubscription = this.stopLocationSubject
          Severity: Minor
          Found in src/app/modules/stop/stop-map.directive.ts - About 1 hr to fix

            Function addMarker has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public addMarker() {
                    this.stopService.stopLocationsObservable
                        .subscribe((stops: IStopLocation[]) => {
                            const stopList: L.Marker[] = [];
                            for (const stop of stops) {
            Severity: Minor
            Found in src/app/modules/main-map/main-map.directive.ts - About 1 hr to fix

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

              module.exports = function (config) {
                config.set({
                  basePath: '',
                  frameworks: ['jasmine', '@angular-devkit/build-angular'],
                  plugins: [
              Severity: Minor
              Found in src/karma.conf.js - About 1 hr to fix

                Function calculateDelay has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public calculateDelay(data: IDeparture): false | number {
                        if (data && data.actualTime && data.plannedTime) {
                            if (data.actualTime !== data.plannedTime) {
                                const actual: moment.Moment = moment(data.actualTime, 'HH:mm');
                                const planned: moment.Moment = moment(data.plannedTime, 'HH:mm');
                Severity: Minor
                Found in src/app/modules/stop/departure-list-item.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

                Function handleHttpErrorResponse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public handleHttpErrorResponse(errorResponse: HttpErrorResponse, notificationService: AppNotificationService): void {
                        // Server or connection error happened
                        if (this.isClientOffline()) {
                            // Handle offline error
                            return notificationService.notify({
                Severity: Minor
                Found in src/app/app-error-handler.ts - 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 handleError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    private handleError(err?: any): Observable<any> {
                        let status: UpdateStatus = UpdateStatus.ERROR;
                        if (err.status) {
                            // Http Error
                            const statusCode: number = err.status;
                Severity: Minor
                Found in src/app/modules/trip-passages/trip-passages.component.ts - 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 startUpdater has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public startUpdater(): void {
                        if (this.updateSubscription) {
                            return;
                        }
                        this.updateSubscription = this.stopLocationSubject
                Severity: Minor
                Found in src/app/modules/stop/stop-map.directive.ts - About 25 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