Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Remove hardcoded placeholder responses from request handlers before merging
Don't leave stub/mock return values in controllers or handlers; wire them to the real service or remove the endpoint.
Bad example
| 1 | @Get('/orders') |
| 2 | async getOrders(@Query() query: OrderQueryDto) { |
| 3 | return [{ foo: 'bar', id: query.id, type: query.type }]; |
| 4 | } |
Explanation (EN)
The handler returns a fabricated object instead of delegating to a service, so the endpoint silently serves fake data.
Objašnjenje (HR)
Handler vraca izmisljeni objekt umjesto da delegira servisu, pa endpoint tiho posluzuje lazne podatke.
Good example
| 1 | @Get('/orders') |
| 2 | async getOrders(@Query() query: OrderQueryDto) { |
| 3 | return this.orderService.getOrders(query); |
| 4 | } |
Explanation (EN)
The handler delegates to the service that produces real data, so there's no temporary code left to leak into production.
Objašnjenje (HR)
Handler delegira servisu koji proizvodi prave podatke, pa nema privremenog koda koji bi procurio u produkciju.