Commit 09caa742 authored by Doug Barrett's avatar Doug Barrett
Browse files

fix: address Duo review feedback on shell and error guidelines

- POSIX strict mode: use portable 'set -eu' instead of 'set -o errexit'
- Bash conditionals: prefer [[ ]] but allow [ ] for POSIX compatibility
- Error strings: focus on Go conventions (no capitals, no trailing
  punctuation, add context) rather than banning specific words
parent 78bedbdc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ instructions:
      15. Named components in errors and logs. Undifferentiated errors are not actionable at scale.
      16. Use fmt.Errorf with %w to wrap errors with context before returning.
      17. Sentinel errors should be named ErrXxx; error types should be named XxxError.
      18. Error strings should explain what failed, not include "failed", "error", or "didn't".
      18. Error strings should not start with a capital letter or end with punctuation. Add actionable context via fmt.Errorf wrapping rather than repeating "failed" or "error".

      **Dependency Management:**
      19. Minimize dependencies. New dependencies should be justified in the MR.
@@ -119,10 +119,10 @@ instructions:

      **Strict Mode:**
      4. All bash scripts must include strict mode: set -euo pipefail.
      5. POSIX shell scripts should use: set -o errexit, set -o nounset.
      5. POSIX shell scripts should use: set -eu.

      **Best Practices:**
      6. Use [[ ]] for test conditionals in bash scripts (never [ ] in bash).
      6. Prefer [[ ]] for test conditionals in bash scripts when using bash-specific features; use [ ] when POSIX compatibility is needed.
      7. Always quote variables to prevent word splitting ("$var" not $var).
      8. Use long-form arguments over short form for self-documenting code when both are available.
      9. Scripts exceeding 100 lines are a code smell. Consider whether the logic belongs elsewhere.