Showing 5 of 35 total issues

Function testRBAC has 214 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function testRBAC(storage, storageType) {
  describe(`RBAC ${storageType}`, () => {
    let rbac;
    let response;

Severity: Major
Found in src/RBAC.test.js - About 1 day to fix

    RBAC has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class RBAC {
      /**
       * Convert Array of permissions to permission name
       * @function getPermissionNames
       * @memberof RBAC
    Severity: Minor
    Found in src/RBAC.js - About 3 hrs to fix

      File RBAC.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // @flow
      import isPlainObject from 'lodash/isPlainObject';
      import Base from './Base';
      import Role from './Role';
      import Permission from './Permission';
      Severity: Minor
      Found in src/RBAC.js - About 2 hrs to fix

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

        module.exports = function (api) {
          api.cache(false);
        
          return {
            "presets": [
        Severity: Minor
        Found in babel.config.js - About 1 hr to fix

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

            async traverseGrants(roleName: string, cb: Function, next: String[] = [roleName], used: Object = {}): any {
              const actualRole = next.shift();
              used[actualRole] = true;
          
              const grants = await this.storage.getGrants(actualRole);
          Severity: Minor
          Found in src/RBAC.js - 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