umts/pvta-multiplatform

View on GitHub
src/providers/route.service.ts

Summary

Maintainability
A
1 hr
Test Coverage

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

    Identifier 'routeId' is never reassigned; use 'const' instead of 'let'.
    Open

        for (let routeId of routeIds) {
    Severity: Minor
    Found in src/providers/route.service.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    import with explicit side-effect
    Open

    import 'rxjs/add/operator/toPromise';
    Severity: Minor
    Found in src/providers/route.service.ts by tslint

    Rule: no-import-side-effect

    Avoid import statements with side-effect.

    Rationale

    Imports with side effects may have behavior which is hard for static verification.

    Config

    One argument may be optionally provided:

    • ignore-module allows to specify a regex and ignore modules which it matches.
    Examples
    "no-import-side-effect": true
    "no-import-side-effect": true,[object Object]
    Schema
    {
      "items": {
        "properties": {
          "ignore-module": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "maxLength": 1,
      "minLength": 0,
      "type": "array"
    }

    For more information see this page.

    Identifier 'diff' is never reassigned; use 'const' instead of 'let'.
    Open

              let diff = now.diff(routes.time, 'days');
    Severity: Minor
    Found in src/providers/route.service.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'promises' is never reassigned; use 'const' instead of 'let'.
    Open

        let promises = [];
    Severity: Minor
    Found in src/providers/route.service.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    Identifier 'now' is never reassigned; use 'const' instead of 'let'.
    Open

              let now = moment();
    Severity: Minor
    Found in src/providers/route.service.ts by tslint

    Rule: prefer-const

    Requires that variable declarations use const instead of let and var if possible.

    If a variable is only assigned to once when it is declared, it should be declared using 'const'

    Notes
    • Has Fix

    Config

    An optional object containing the property "destructuring" with two possible values:

    • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
    • "all" - Only warns if all variables in destructuring can be const.
    Examples
    "prefer-const": true
    "prefer-const": true,[object Object]
    Schema
    {
      "type": "object",
      "properties": {
        "destructuring": {
          "type": "string",
          "enum": [
            "all",
            "any"
          ]
        }
      }
    }

    For more information see this page.

    There are no issues that match your filters.

    Category
    Status