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,
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';
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 });
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}`;
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 = [];
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);
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,
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);
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,
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;
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);
- Read upRead up
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) {
- Read upRead up
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,
}) {
- Read upRead up
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
- Read upRead up
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) {
- Read upRead up
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"