Showing 30 of 114 total issues
Function ngOnInit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async ngOnInit() {
this.inventoryUuid = this.route.snapshot.params.inventoryUuid;
this.thingUuid = this.route.snapshot.params.thingUuid;
await this.is.ready;
Function getCurrentUser
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getCurrentUser(): Promise<GetStatusResponse> {
let response: GetStatusResponse;
try {
// Try to get the data from the API
Function ngOnInit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async ngOnInit(): Promise<void> {
this.inventoryUuid = this.route.snapshot.params.inventoryUuid;
this.thingUuid = this.route.snapshot.params.thingUuid;
await this.is.ready;
Function updateUsersProjection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static updateUsersProjection(event: UserEvent) {
const index = Authentication.usersProjection.findIndex(
(user: User) => user.uuid === event.data.userUuid,
);
- 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 checkEventLegitimacy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public checkEventLegitimacy(
event: InventoryEvent,
userUuid: string,
): boolean {
try {
- 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
Consider simplifying this complex logical expression. Open
if (process.env.EDM_SSL === "true") {
// Use SSL
/**
* The private key for SSL
Function loadUser
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async loadUser(): Promise<void> {
try {
this.user = ((await this.as.getCurrentUser()).user as unknown) as User; // TODO FixMe
console.log(this.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"
Further reading
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return (
Authorization.inventoriesProjection[event.inventoryUuid].ownerUuid ===
userUuid ||
Authorization.inventoriesProjection[
event.inventoryUuid
Function fetchInventoryEvents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private async fetchInventoryEvents() {
// Initialize the inventory projection dictionary
InventoryService.inventoriesProjection = {};
// Wait for EventSourcingService to be ready
- 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"