Showing 33 of 317 total issues
Function getRequestOptions
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
public getRequestOptions(
target: ReflectionTargetOrHandler,
handler: ReflectionTargetOrHandler,
): CrudOptions & { model: CrudModelOptionsInterface } {
return {
Function applyApiResponse
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
export function applyApiResponse(
action: CrudActions,
options: ApiResponseOptions = {},
): MethodDecorator {
return (target: DecoratorTargetObject, ...rest) => {
Function AuthGuard
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export const AuthGuard = (
strategyName: string,
options: AuthGuardOptions = { canDisable: false },
) => {
// TODO: Add logic to get this information dynamically
- 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 createUserRepository
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createUserRepository(dataSource: DataSource) {
/**
* Fake user "database"
*/
const users: UserEntity[] = [
Function catch
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
catch(exception: ExceptionInterface, host: ArgumentsHost): void {
const { httpAdapter } = this.httpAdapterHost;
const ctx = host.switchToHttp();
// error code is UNKNOWN unless it gets overridden
- 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 CrudInitApiQuery
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
(...args: Parameters<ClassDecorator>) => {
// get the args
const [classTarget] = args;
const reflectionService = new CrudReflectionService();
Function forFeature
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
static forFeature(
entityOptions: Record<string, TypeOrmExtEntityOptionInterface>,
): DynamicModule {
const dataSources: Record<string, TypeOrmExtDataSourceToken> = {};
Function createRoleRepositoriesProviders
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createRoleRepositoriesProviders(
options: RoleEntitiesOptionsInterface,
): Provider[] {
const { entities } = options;
Function catch
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
catch(exception: ExceptionInterface, host: ArgumentsHost): void {
const { httpAdapter } = this.httpAdapterHost;
const ctx = host.switchToHttp();
// error code is UNKNOWN unless it gets overridden
Function createOneCustom
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
@CrudCreateOne()
@AccessControlCreateOne(InvitationResource.One)
@ApiOperation({
summary: 'Create one invitation.',
})
Function checkAccessQueries
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected async checkAccessQueries(
context: ExecutionContext,
queriesPermitted: IQueryInfo[],
): Promise<boolean> {
const targets = [context.getClass(), context.getHandler()];
Function accept
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async accept(
invitationDto: InvitationDto,
passcode: string,
payload?: LiteralObject,
queryOptions?: QueryOptionsInterface,
Function setJoin
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected setJoin(
cond: QueryJoin,
joinOptions: JoinOptions,
builder: SelectQueryBuilder<T>,
): ReturnType<xTypeOrmCrudService<T>['setJoin']> {
Function setJoin
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected setJoin(
cond: QueryJoin,
joinOptions: JoinOptions,
builder: SelectQueryBuilder<T>,
): ReturnType<xTypeOrmCrudService<T>['setJoin']> {
- 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 updatePassword
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async updatePassword(
passcode: string,
newPassword: string,
queryOptions?: QueryOptionsInterface,
): Promise<ReferenceIdInterface | null> {
Function CrudInitApiParams
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
(...args: Parameters<ClassDecorator>) => {
// get the args
const [classTarget] = args;
const reflectionService = new CrudReflectionService();
Function checkAccessGrants
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
protected async checkAccessGrants(
context: ExecutionContext,
): Promise<boolean> {
const rules = this.settings.rules;
Function checkAccessQueries
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected async checkAccessQueries(
context: ExecutionContext,
queriesPermitted: IQueryInfo[],
): Promise<boolean> {
const targets = [context.getClass(), context.getHandler()];
- 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 checkAccessGrants
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected async checkAccessGrants(
context: ExecutionContext,
): Promise<boolean> {
const rules = this.settings.rules;
- 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 getOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
protected getOptions(
context: ExecutionContext,
): CrudSerializationOptionsInterface {
// get serialization options
const options =