Skip to content

Commit dbd6d9b

Browse files
committed
chore: add trailing newline rule
Signed-off-by: Oleksii Kurinnyi <[email protected]>
1 parent 32599b7 commit dbd6d9b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

.gemini/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"context": {
33
"fileName": ["AGENTS.md", "redhat-compliance-and-responsible-ai.md"]
44
}
5-
}
5+
}

AGENTS.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,24 @@ import (
167167
- `controllerv1alpha1` - Controller API types
168168
- `wkspConfig` - Workspace configuration package
169169

170+
### File Formatting
171+
172+
**AI Agent Note**: ALWAYS ensure every file (except generated files) ends with a trailing newline.
173+
174+
All source files MUST end with a single trailing newline character (POSIX standard).
175+
176+
-**DO** ensure files end with `\n` (newline character)
177+
-**DO** verify this when creating or editing files
178+
-**DON'T** add trailing newlines to generated files (e.g., `zz_generated.*`, CRD manifests)
179+
-**DON'T** add multiple trailing newlines (only one)
180+
181+
**Why**: Trailing newlines are part of the POSIX definition of a text file and help with:
182+
- Version control diffs (Git shows "No newline at end of file" warnings without it)
183+
- File concatenation and text processing tools
184+
- Standard compliance and editor compatibility
185+
186+
**Note**: Most modern editors handle this automatically, but when using Write or Edit tools, always ensure the final character is `\n`.
187+
170188
### Naming Conventions
171189

172190
- **Packages**: lowercase, descriptive (`workspace`, `library`, `provision`)
@@ -488,6 +506,7 @@ if err := r.Update(ctx, workspaceCopy); err != nil {
488506
- ❌ Don't modify objects from cache directly (always DeepCopy first)
489507
- ❌ Don't perform long-running operations in reconcile - keep reconciliation fast
490508
- ❌ Don't save state between reconciles - always read from cluster
509+
- ❌ Don't forget to add trailing newline at end of files (except generated files)
491510
492511
### Error Handling
493512
@@ -672,4 +691,4 @@ kubectl patch dw <name> --type merge -p "{\"metadata\": {\"annotations\": {\"for
672691

673692
---
674693

675-
**Last Updated**: 2025-12-11
694+
**Last Updated**: 2025-12-24

0 commit comments

Comments
 (0)