|
| 1 | +# AI coding assistant guidelines: Firebase Admin Java SDK |
| 2 | + |
| 3 | +This document defines repository-wide expectations, code styles, and Checkstyle compliance metrics that every autonomous AI coding agent or pair programming assistant must strictly follow when introducing or modifying code in this repository. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🎨 Code Style & Checkstyle Compliance |
| 8 | + |
| 9 | +This repository enforces standard **Google Java Style** guidelines validated through automated Maven checkstyle executions (`checkstyle.xml`). Any compilation or pull request build will fail if these constraints are violated. |
| 10 | + |
| 11 | +### 1. Strict 100-Character Line Limit |
| 12 | +* **Rule:** No line of code, comments, Javadoc documentation entries, or inline string literal concatenations may exceed **100 characters** under any circumstances. |
| 13 | +* **Remediation:** |
| 14 | + * Break long method parameters, array initializations, and logic comparisons onto separate lines. |
| 15 | + * Wrap long `assertThrows` statements or lambda chains across multiple contiguous lines. |
| 16 | + * Format long log messages, exception messages, or assertion string explanations using standard string block concatenation broken across separate lines. |
| 17 | + |
| 18 | +### 2. Import Ordering & Grouping |
| 19 | +* **Rule:** Imports must be grouped and arranged alphabetically to avoid validation noise. |
| 20 | +* **Remediation:** |
| 21 | + 1. Static imports placed first, grouped, and alphabetically arranged. |
| 22 | + 2. Non-static imports grouped alphabetically by package tier. |
| 23 | + 3. Avoid utilizing wildcard (`*`) imports. Every import declaration must be explicit. |
| 24 | + |
| 25 | +### 3. Javadoc Completeness & Formatting |
| 26 | +* **Rule:** Every public class, package-private component interface, constructor, and public method signature must include fully formed Javadoc documentation blocks. |
| 27 | +* **Remediation:** |
| 28 | + * Document all arguments via `@param`, explain error flows via `@throws`, and clear return constraints via `@return`. |
| 29 | + * Wrap documentation description text explicitly so that no single javadoc documentation line passes the 100 characters limit. |
| 30 | + |
| 31 | +### 4. Indentation & Spacing |
| 32 | +* **Rule:** Standard indentation uses exactly **2 spaces** per block indentation level. **4 spaces** are used explicitly for wrapped line continuation indentation. |
| 33 | +* **Remediation:** Never utilize tab characters. Ensure block braces follow the Google K&R opening line placement convention. |
0 commit comments