MitocGroup/deep-framework

View on GitHub
src/deep-security/lib/Token.js

Summary

Maintainability
D
1 day
Test Coverage

File Token.js has 384 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Created by mgoria on 6/23/15.
 */

'use strict';
Severity: Minor
Found in src/deep-security/lib/Token.js - About 5 hrs to fix

    Token has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class Token {
      /**
       * @returns {number}
       */
      static get MAX_RETRIES() {
    Severity: Minor
    Found in src/deep-security/lib/Token.js - About 5 hrs to fix

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

        loadCredentials(callback = () => {}, authScope = null) {
          let scopeKey = authScope ? authScope.toString() : 'default';
      
          let event = {
            service: 'deep-security',
      Severity: Major
      Found in src/deep-security/lib/Token.js - About 2 hrs to fix

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

          loadLambdaCredentials() {
            return new Promise(
              (resolve, reject) => {
                this._cacheService.get('credentialsCache', (error, credentialsCache) => {
                  if (error && error.name !== 'MissingCacheException') {
        Severity: Minor
        Found in src/deep-security/lib/Token.js - About 1 hr to fix

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

            getUser(callback) {
              // @todo: backward compatibility hook, remove on next major release
              let argsHandler = (error, user) => {
                if (callback.length === 1) {
                  if (error) {
          Severity: Minor
          Found in src/deep-security/lib/Token.js - 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 identityId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            get identityId() {
              let identityId = null;
              let credentials = this.credentialsManager.systemCredentials;
          
              if (this.lambdaContext) {
          Severity: Minor
          Found in src/deep-security/lib/Token.js - 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

          There are no issues that match your filters.

          Category
          Status