alientronics/fleetany-mobile

View on GitHub

Showing 15 of 43 total issues

File bluetooth.ts has 280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

import {Injectable, Inject} from '@angular/core';
import { UartService } from '../service';
import { UserData } from '../../../providers/user-data';
Severity: Minor
Found in src/providers/bluetooth.ts - About 2 hrs to fix

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

      gpsToggle(value) {
        if (this.userData.plate == null) {
          this.userData.showToast('Vehicle should be selected!', 'Error!', this.alertCtrl);
        } else {
          if (value) {
    Severity: Minor
    Found in src/providers/gps.ts - About 1 hr to fix

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

        setPostData(data, storage, urlApi) {
      
          var arrayData = [];
      
          if(data == null) {
      Severity: Minor
      Found in src/providers/gps.ts - About 1 hr to fix

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

          bledeviceChanged(value, positions, ask) {
        
              if (this.bledevice == value && ask) {
                if (confirm("Deseja sair?")) {
                  this.clearDevice();
        Severity: Minor
        Found in src/providers/bluetooth.ts - About 1 hr to fix

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

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

            Function processTireData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              processTireData(buffer: ArrayBuffer):any {
            
                var dataView = new DataView(buffer);
            
                if (dataView.getUint8(0) != 0xAA 
            Severity: Minor
            Found in src/providers/service.ts - About 1 hr to fix

              Function _printDataView has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _printDataView(dataView: DataView) {
                  //alert("tire data: " + this.uart._buffer2String(dataView.buffer));
              
                  if (dataView.byteLength > 4 && dataView.getUint8(3) == dataView.byteLength) {
                    var tire = this.uart.processTireData(dataView.buffer);
              Severity: Minor
              Found in src/providers/bluetooth.ts - About 1 hr to fix

                Function subscribeRepeater has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  subscribeRepeater() {
                    var thing = this;
                    BluetoothSerial.isConnected().then(
                      (result) => {
                        this.watcher = BluetoothSerial.subscribeRawData().subscribe(
                Severity: Minor
                Found in src/providers/bluetooth.ts - About 1 hr to fix

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

                    onSubmit(value: any): void { 
                        if(this.fuelForm.valid || value.valid) {
                            console.log('Submitted value: ', value);
                  
                            let params: any = {};
                  Severity: Minor
                  Found in src/pages/fuel/fuel.ts - About 1 hr to fix

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

                      _resetIfHasStart(cbPrint: (dataView: DataView) => void) {
                        var dataView = new DataView(this.buffer);
                    
                        for (let i = 1; i < dataView.byteLength; i++) { 
                          if (dataView.getUint8(i) == 0xAA && dataView.byteLength > (i + 2)) {
                    Severity: Minor
                    Found in src/providers/service.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 processTireData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      processTireData(buffer: ArrayBuffer):any {
                    
                        var dataView = new DataView(buffer);
                    
                        if (dataView.getUint8(0) != 0xAA 
                    Severity: Minor
                    Found in src/providers/service.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 gpsToggle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      gpsToggle(value) {
                        if (this.userData.plate == null) {
                          this.userData.showToast('Vehicle should be selected!', 'Error!', this.alertCtrl);
                        } else {
                          if (value) {
                    Severity: Minor
                    Found in src/providers/gps.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 bledeviceChanged has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      bledeviceChanged(value, positions, ask) {
                    
                          if (this.bledevice == value && ask) {
                            if (confirm("Deseja sair?")) {
                              this.clearDevice();
                    Severity: Minor
                    Found in src/providers/bluetooth.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 onSubmit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      onSubmit(value: any): void { 
                          if(this.fuelForm.valid || value.valid) {
                              console.log('Submitted value: ', value);
                    
                              let params: any = {};
                    Severity: Minor
                    Found in src/pages/fuel/fuel.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 setPostData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      setPostData(data, storage, urlApi) {
                    
                        var arrayData = [];
                    
                        if(data == null) {
                    Severity: Minor
                    Found in src/providers/gps.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