Showing 9 of 9 total issues
Function plainToPrismaNestedQuery
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function plainToPrismaNestedQuery(
objectToPersist: any,
currentPersistedObject: any,
allowedJoinSet: Set<string>,
idPropertyName: string,
Function deleteObjectProperties
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function deleteObjectProperties(
object: any,
blacklistedPropertyPaths?: Array<string | RegExp>,
whitelistedPropertyPaths?: Array<string | RegExp>,
ignoreArrayIndexes = false,
Function findMany
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async findMany(opts: CrudMethodOpts) {
const fullOpts = this.getFullCrudOpts(opts);
const repo = this.getRepo(fullOpts);
const parsedCrudQuery = this.prismaQueryBuilder.parseCrudQuery(fullOpts.crudQuery);
Function RBAC
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const RBAC = <T extends AllowedRolesId = AllowedRolesId>(
allowedRoles: AllowedRoles<T>,
authData: any,
moduleRef: ModuleRef,
): PolicyMethod => (_: ExecutionContext) => {
- 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 RBAC
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
): PolicyMethod => (_: ExecutionContext) => {
if (allowedRoles === 'everyone') {
return;
}
Function validateNestedWhere
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function validateNestedWhere(
whereObject: any,
allowedJoinsSet: Set<string>,
// TODO: Document that below keywords should be forbidden in all models
Function transformJoinsToInclude
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function transformJoinsToInclude(joins: string[]) {
if (!joins.length) {
return {};
}
- 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 MustMatchAuthAttribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const MustMatchAuthAttribute = (
modelAttributePath: string,
authDataAttributePath: string,
): PolicyMethod => (ctx: ExecutionContext, authData: any, _moduleRef: ModuleRef) => {
const request = ctx.switchToHttp().getRequest();
- 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 findMany
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public async findMany(opts: CrudMethodOpts) {
const fullOpts = this.getFullCrudOpts(opts);
const repo = this.getRepo(fullOpts);
const parsedCrudQuery = this.prismaQueryBuilder.parseCrudQuery(fullOpts.crudQuery);
- 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"