chrispaskvan/destiny-ghost-api

View on GitHub

Showing 15 of 78 total issues

File user.service.spec.js has 531 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * User Service Tests
 */
import {
    afterEach, beforeEach, describe, expect, it, vi,
Severity: Major
Found in users/user.service.spec.js - About 1 day to fix

    File user.routes.spec.js has 458 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { EventEmitter } from 'events';
    import {
        beforeEach, describe, expect, it, vi,
    } from 'vitest';
    import { StatusCodes } from 'http-status-codes';
    Severity: Minor
    Found in users/user.routes.spec.js - About 7 hrs to fix

      Function startServer has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const startServer = async () => {
          const start = Date.now();
          const app = express();
      
          await loaders.init({ app });
      Severity: Minor
      Found in server.js - About 1 hr to fix

        Function updateManifest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            updateManifest(manifest) {
                const { directory: databaseDirectory } = this;
                const { mobileWorldContentPaths: { en: relativeUrl } } = manifest;
                const fileName = relativeUrl.substring(relativeUrl.lastIndexOf('/') + 1);
                const databasePath = `${databaseDirectory}/${fileName}`;
        Severity: Minor
        Found in helpers/world.js - About 1 hr to fix

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

              getQuery() {
                  const tableAlias = this.table ? this.table[0].toLowerCase() : 'r';
                  const fields = (this.fields.length ? `${tableAlias}.${this.fields.join(`, ${tableAlias}.`)}` : '*');
                  let childAlias;
                  const parameters = [];
          Severity: Minor
          Found in helpers/queryBuilder.js - About 1 hr to fix

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

                async getProfile(membershipId, membershipType, skipCache) {
                    let characters;
            
                    if (!skipCache) {
                        characters = await this.cacheService.getCharacters(membershipId);
            Severity: Minor
            Found in destiny2/destiny2.service.js - About 1 hr to fix

              Function startServer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const startServer = () => {
                  const packageDefinition = protoLoader.loadSync('./items.proto', {
                      keepCase: true,
                      longs: String,
                      enums: String,
              Severity: Minor
              Found in grpc.js - About 1 hr to fix

                Function getCharacters has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async getCharacters(displayName, membershipType) {
                        const currentUser = await this.users.getUserByDisplayName(displayName, membershipType);
                        const characters = await this.destiny
                            .getProfile(currentUser.membershipId, membershipType, true);
                
                
                Severity: Minor
                Found in destiny2/destiny2.controller.js - About 1 hr to fix

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

                      async getXur(membershipId, membershipType, characterId, accessToken) {
                          const vendor = await this.cacheService.getVendor(xurHash);
                  
                          log.info({
                              membershipId,
                  Severity: Minor
                  Found in destiny2/destiny2.service.js - About 1 hr to fix

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

                        async getHealth() {
                            failures = 0;
                    
                            const documents = await this.getDocumentCount()
                                .catch(err => HealthController.unhealthy(err)) || -1;
                    Severity: Minor
                    Found in health/health.controller.js - About 1 hr to fix

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

                          async getProfile(membershipId, membershipType, skipCache) {
                              let characters;
                      
                              if (!skipCache) {
                                  characters = await this.cacheService.getCharacters(membershipId);
                      Severity: Minor
                      Found in destiny2/destiny2.service.js - 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 select has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          select(selections) {
                              if (typeof selections === 'string') {
                                  // eslint-disable-next-line no-param-reassign
                                  selections = selections.trim();
                                  if (selections.length === 0) {
                      Severity: Minor
                      Found in helpers/queryBuilder.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

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

                          async setManifest({
                              lastModified,
                              manifest,
                              maxAge,
                          }) {
                      Severity: Minor
                      Found in destiny/destiny.cache.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 throttle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default async function throttle(tasks, concurrency, wait) {
                          const results = [];
                      
                          async function runTasks(tasksIterator) {
                              // eslint-disable-next-line no-restricted-syntax
                      Severity: Minor
                      Found in helpers/throttle.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

                      Function administrativeUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          async administrativeUser(req, res, next) {
                              try {
                                  const user = await this.authentication.authenticate(req);
                      
                                  if (user) {
                      Severity: Minor
                      Found in users/role.middleware.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

                      Severity
                      Category
                      Status
                      Source
                      Language