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).
Prefer the upstream-recommended setup over config that only works by luck
Don't depend on a leaner build/CI configuration that merely happens to work; follow the tool's documented robust setup, since moving versions will eventually break incidental behavior.
Bad example
| 1 | { |
| 2 | "scripts": { |
| 3 | // Drops the documented dependency install to save time. |
| 4 | // Works today only because the current runner image and tool |
| 5 | // version happen to ship the needed system libraries. |
| 6 | "test:setup:ci": "toolkit install --only-shell chromium" |
| 7 | } |
| 8 | } |
Explanation (EN)
The lean variant works only because the current environment incidentally provides what the omitted step would install. When the runner image, the tool, or the browser version drifts, the missing system dependencies cause a hard-to-diagnose CI failure.
Objašnjenje (HR)
Skraćena varijanta radi samo zato što trenutno okruženje slučajno pruža ono što bi izostavljeni korak inače instalirao. Kad se slika runnera, alat ili verzija preglednika promijene, nedostajuće sustavske ovisnosti uzrokuju teško dijagnosticirajući kvar u CI-ju.
Good example
| 1 | { |
| 2 | "scripts": { |
| 3 | // Use the setup the tool's own docs recommend so dependencies |
| 4 | // are installed explicitly and the pipeline stays robust across |
| 5 | // distro / tool / browser version changes. |
| 6 | "test:setup:ci": "toolkit install --with-deps chromium" |
| 7 | } |
| 8 | } |
Explanation (EN)
Following the upstream-documented setup installs required dependencies explicitly, so the pipeline stays correct as versions evolve instead of relying on the current environment by chance.
Objašnjenje (HR)
Slijeđenje postavki preporučenih u službenoj dokumentaciji eksplicitno instalira potrebne ovisnosti, pa pipeline ostaje ispravan kako se verzije mijenjaju, umjesto da se slučajno oslanja na trenutno okruženje.
Notes (EN)
The decisive question is not 'does it work right now' but 'why will it keep working'. If the answer is 'because the current environment happens to provide it', that is a fragility signal, not a justification.
Bilješke (HR)
Odlučujuće pitanje nije 'radi li sada' nego 'zašto će nastaviti raditi'. Ako je odgovor 'jer trenutno okruženje to slučajno pruža', to je znak krhkosti, a ne opravdanje.
Exceptions / Tradeoffs (EN)
If the leaner path is genuinely required for a hard constraint (e.g. it must run without elevated privileges) and you can clearly justify why it stays correct, document that reasoning inline and accept the tradeoff knowingly.
Iznimke / Tradeoffi (HR)
Ako je skraćeni put stvarno nužan zbog tvrdog ograničenja (npr. mora se izvoditi bez povišenih ovlasti) i možeš jasno obrazložiti zašto ostaje ispravan, dokumentiraj to obrazloženje u kodu i svjesno prihvati kompromis.