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).
Delete commented-out code instead of committing it
Don't merge dead/commented code; remove it and rely on version control for history.
Bad example
| 1 | const response = await fetchWrap(url, { |
| 2 | headers: { |
| 3 | token: token.accessToken, |
| 4 | // accept: 'application/json', |
| 5 | }, |
| 6 | }); |
Explanation (EN)
Commented-out lines add noise and leave readers guessing whether the code is intentionally disabled or forgotten.
Objašnjenje (HR)
Zakomentirane linije dodaju sum i ostavljaju citatelja da naga je li kod namjerno onemogucen ili zaboravljen.
Good example
| 1 | const response = await fetchWrap(url, { |
| 2 | headers: { |
| 3 | token: token.accessToken, |
| 4 | }, |
| 5 | }); |
Explanation (EN)
Removing the dead line keeps the code clean; git history recovers it if it is ever needed again.
Objašnjenje (HR)
Uklanjanje mrtve linije cuva kod cistim; git povijest ga vraca ako ikad ponovno zatreba.
Exceptions / Tradeoffs (EN)
A brief commented example paired with an explanatory note (e.g. documenting why an option is intentionally omitted) can be acceptable, but bare commented code is not.
Iznimke / Tradeoffi (HR)
Kratak zakomentirani primjer uz pojasnjavajucu biljesku (npr. zasto je opcija namjerno izostavljena) moze biti prihvatljiv, ali goli zakomentirani kod nije.