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).
Write comments in sentence case, not ad-hoc all-caps emphasis
Avoid shouty all-caps emphasis prefixes (CRITICAL, IMPORTANT, RESET) in comments; use sentence case and reserve all-caps for conventional tokens like TODO/FIXME.
Bad example
| 1 | // CRITICAL: Prevent duplicate handling from error+close events |
| 2 | if (state.isDisconnecting) return; |
| 3 |
|
| 4 | state.attempts = 0; // RESET counter on success |
Explanation (EN)
Arbitrary all-caps prefixes shout for attention, are inconsistent across a codebase, and add no information the sentence itself doesn't already convey. They also dilute the meaning of genuine machine-readable markers.
Objašnjenje (HR)
Proizvoljni prefiksi velikim slovima viču za pažnju, nedosljedni su u bazi koda i ne dodaju informaciju koju sama rečenica već ne prenosi. Također razvodnjavaju značenje stvarnih strojno čitljivih oznaka.
Good example
| 1 | // Prevent duplicate handling from error+close events |
| 2 | if (state.isDisconnecting) return; |
| 3 |
|
| 4 | state.attempts = 0; // Reset counter on success |
Explanation (EN)
Sentence-case comments read consistently with the rest of the codebase and convey the same intent without visual noise.
Objašnjenje (HR)
Komentari u obliku rečenice čitaju se dosljedno s ostatkom baze koda i prenose istu namjeru bez vizualnog šuma.
Notes (EN)
If a comment truly needs emphasis, improve the wording or extract the concern into a clearly named function rather than shouting.
Bilješke (HR)
Ako komentar stvarno treba naglasak, poboljšajte formulaciju ili izdvojite logiku u jasno imenovanu funkciju umjesto vikanja.
Exceptions / Tradeoffs (EN)
Conventional all-caps tokens that tooling or team convention recognizes (TODO, FIXME, HACK, NOTE, XXX) are fine and should keep their standard form.
Iznimke / Tradeoffi (HR)
Uobičajene oznake velikim slovima koje alati ili timski dogovor prepoznaju (TODO, FIXME, HACK, NOTE, XXX) su u redu i trebaju zadržati svoj standardni oblik.