Bernd-L/exDateMan

View on GitHub

Showing 114 of 114 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

async addAdmin(event: MatChipInputEvent): Promise<void> {
const input: HTMLInputElement = event.input;
const value: string = event.value;
 
// Add the admin
frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 322..342
frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 353..373

Similar blocks of code found in 3 locations. Consider refactoring.
Open

async addWritable(event: MatChipInputEvent): Promise<void> {
const input: HTMLInputElement = event.input;
const value: string = event.value;
 
// Add our fruit
frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 291..311
frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 353..373

Similar blocks of code found in 3 locations. Consider refactoring.
Open

async addReadable(event: MatChipInputEvent): Promise<void> {
const input: HTMLInputElement = event.input;
const value: string = event.value;
 
// Add our fruit
frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 291..311
frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 322..342

Similar blocks of code found in 2 locations. Consider refactoring.
Open

switch (event.data.crudType) {
case crudType.CREATE:
// Assign a new inventory to the dictionary
InventoryService.inventoriesProjection[
event.inventoryUuid
Severity: Major
Found in frontend/src/app/services/inventory/inventory.service.ts and 1 other location - About 7 hrs to fix
backend/src/app/authorization.ts on lines 195..228

Similar blocks of code found in 2 locations. Consider refactoring.
Open

switch (event.data.crudType) {
case crudType.CREATE:
// Assign a new inventory to the dictionary
Authorization.inventoriesProjection[event.inventoryUuid] = newInventory;
 
 
Severity: Major
Found in backend/src/app/authorization.ts and 1 other location - About 7 hrs to fix
frontend/src/app/services/inventory/inventory.service.ts on lines 118..153

Similar blocks of code found in 2 locations. Consider refactoring.
Open

private handleResolveEmail(req: Request, res: Response): void {
/**
* This constant holds the copy of the found value
*/
const result: User | undefined =
Severity: Major
Found in backend/src/app/authentication.ts and 1 other location - About 6 hrs to fix
backend/src/app/authentication.ts on lines 106..132

Similar blocks of code found in 2 locations. Consider refactoring.
Open

private handleGetUser(req: Request, res: Response): void {
/**
* This constant holds the copy of the found value
*/
const result: User | undefined =
Severity: Major
Found in backend/src/app/authentication.ts and 1 other location - About 6 hrs to fix
backend/src/app/authentication.ts on lines 75..101

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const newInventory = {
uuid: event.data.uuid,
name: event.data.inventoryData.name,
createdOn: event.data.inventoryData.createdOn,
ownerUuid: event.data.inventoryData.ownerUuid,
Severity: Major
Found in backend/src/app/authorization.ts and 1 other location - About 4 hrs to fix
frontend/src/app/services/inventory/inventory.service.ts on lines 107..115

Similar blocks of code found in 2 locations. Consider refactoring.
Open

const newInventory = {
uuid: event.data.uuid,
name: event.data.inventoryData.name,
createdOn: event.data.inventoryData.createdOn,
ownerUuid: event.data.inventoryData.ownerUuid,
Severity: Major
Found in frontend/src/app/services/inventory/inventory.service.ts and 1 other location - About 4 hrs to fix
backend/src/app/authorization.ts on lines 184..192

Similar blocks of code found in 2 locations. Consider refactoring.
Open

constructor(
private is: InventoryService,
private ess: EventSourcingService,
private as: AuthService
) {
Severity: Major
Found in frontend/src/app/services/thing/thing.service.ts and 1 other location - About 4 hrs to fix
frontend/src/app/services/category/category.service.ts on lines 44..61

Similar blocks of code found in 2 locations. Consider refactoring.
Open

constructor(
private is: InventoryService,
private ess: EventSourcingService,
private as: AuthService
) {
Severity: Major
Found in frontend/src/app/services/category/category.service.ts and 1 other location - About 4 hrs to fix
frontend/src/app/services/thing/thing.service.ts on lines 35..52

Similar blocks of code found in 2 locations. Consider refactoring.
Open

for (const inventoryEvents of EventSourcingService.events) {
// Iterate over the Events of the Inventory
for (const event of inventoryEvents.events) {
// But only if when the Event is a CategoryEvent
if (event.data.itemType === itemType.CATEGORY) {
Severity: Major
Found in frontend/src/app/services/category/category.service.ts and 1 other location - About 2 hrs to fix
frontend/src/app/services/stock/stock.service.ts on lines 103..116

Similar blocks of code found in 2 locations. Consider refactoring.
Open

for (const inventoryEvents of EventSourcingService.events) {
// Iterate over the Events of the Inventory
for (const event of inventoryEvents.events) {
// But only if when the Event is a StockEvent
if (event.data.itemType === itemType.STOCK) {
Severity: Major
Found in frontend/src/app/services/stock/stock.service.ts and 1 other location - About 2 hrs to fix
frontend/src/app/services/category/category.service.ts on lines 83..96

Identical blocks of code found in 2 locations. Consider refactoring.
Open

interface Inventory {
/**
* The uuid of this inventory
*
* This is also the uuid of its event log.
Severity: Major
Found in backend/src/app/authorization.ts and 1 other location - About 2 hrs to fix
frontend/src/app/models/inventory/inventory.ts on lines 1..38

Identical blocks of code found in 2 locations. Consider refactoring.
Open

export interface Inventory {
/**
* The uuid of this inventory
*
* This is also the uuid of its event log.
Severity: Major
Found in frontend/src/app/models/inventory/inventory.ts and 1 other location - About 2 hrs to fix
backend/src/app/authorization.ts on lines 260..297

File authentication.ts has 271 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Router, Request, Response } from "express";
import { readFileSync } from "fs";
import * as jwt from "jsonwebtoken";
import { ServerEvents, UserEvent } from "./server-events";
import { compareSync, hashSync } from "bcrypt";
Severity: Minor
Found in backend/src/app/authentication.ts - About 2 hrs to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    inventoryData?: {
    /**
    * The name of this inventory
    */
    name?: string;
    backend/src/app/client-events.ts on lines 306..338

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    inventoryData?: {
    /**
    * The name of this inventory
    */
    name?: string;
    Severity: Major
    Found in backend/src/app/client-events.ts and 1 other location - About 2 hrs to fix
    frontend/src/app/services/EventSourcing/event-sourcing.service.ts on lines 304..336

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    removeAdmin(admin: User): void {
    const index: number = this.inventory.adminUuids.indexOf(admin.uuid);
     
    if (index >= 0) {
    this.inventory.adminUuids.splice(index, 1);
    frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 344..350

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    removeWritable(writable: User): void {
    const index: number = this.inventory.writableUuids.indexOf(writable.uuid);
     
    if (index >= 0) {
    this.inventory.writableUuids.splice(index, 1);
    frontend/src/app/components/edit-inventory/edit-inventory.component.ts on lines 313..319
    Severity
    Category
    Status
    Source
    Language