diff --git a/.claude/rules/code-conventions.md b/.claude/rules/code-conventions.md index 7124ef6..4a7e869 100644 --- a/.claude/rules/code-conventions.md +++ b/.claude/rules/code-conventions.md @@ -5,6 +5,10 @@ paths: # Code Conventions +## Indentation + +All source files should be indented with 2 spaces. Continuation indents should be 4 spaces. + ## Acronym Naming Always use full uppercase for acronyms in Java identifiers — class names, method names, field names, local variables. Do NOT use title-case (camelCase-with-only-the-first-letter-uppercase) for acronyms. If a field or method name starts with an acronym, lowercase the entire acronym. @@ -82,7 +86,7 @@ module org.lattejava.web { ## Blank lines -Remove blank lines between fields. +Ensure there is one blank line between class members including fields, methods, and inner classes, interfaces, enums, records, etc. ### Example @@ -101,6 +105,8 @@ public class Example { } ``` +Add blank lines between logical groups of operations in methods. + ## Imports Prefer module imports over class imports. If a class is using class imports, attempt to replace as many as possible with module imports. @@ -119,7 +125,7 @@ import module java.base; Add a blank line between import groups. -## Order inside classes +## Order inside classes and interfaces (not records) Inside a class, the order should always be: @@ -134,4 +140,10 @@ Inside a class, the order should always be: ## Javadoc -When Javadoc is written, use sentence structure, punctuation, and capitalization of common American English publications. This rule applies to @param, @return, @throws, and the main comment block. \ No newline at end of file +When Javadoc is written, use sentence structure, punctuation, and capitalization of common American English publications. This rule applies to @param, @return, @throws, and the main comment block. + +## Line length and wrapping + +120 characters is the target line length. *DO NOT* wrap lines before 120 characters. If a line is longer than 120 characters, but keeping it on one line makes it easier to read, do not wrap it. + +When wrapping lines, break on logical boundaries and avoid excessive wrapping. If breaking in an if-statement, break after the logical operator (`&&` or `||`). If breaking on chained method calls, break before the dot and align the dots with the dot of the previous line. \ No newline at end of file diff --git a/.claude/rules/git.md b/.claude/rules/git.md new file mode 100644 index 0000000..4d4ace0 --- /dev/null +++ b/.claude/rules/git.md @@ -0,0 +1,37 @@ +--- +paths: + - "**/*" +--- + +# Git + +When using Git for the project, follow these guidelines. + +## Branching + +Never commit directly to `main`. All work happens on a feature branch created from `main`; `main` only ever receives changes through a squash merge. This is a standard to follow by reading this file — it is intentionally not enforced by a hook. + +Branch names should be descriptive and follow the format `/`. The `type` is the conventional commit type for the work, usually `feat`, `fix`, or `chore`. + +## Squash merges + +Always squash merge feature branches into `main`, so each unit of work lands as a single commit. Feature branches may be merged into other feature branches with a standard (non-squash) merge. + +## Branch deletion + +Always delete feature branches after merging them into another branch. + +## Commit messages + +Commit messages must follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/): `[optional scope][!]: `. + +- Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. +- Mark a breaking change with `!` after the type/scope (e.g. `feat!: …`) and/or a `BREAKING CHANGE:` footer. +- Because feature branches are squashed, the **squash commit message** is what lands on `main` and must itself be a single well-formed Conventional Commit. The per-commit messages on a feature branch must also follow the format (the `commit-msg` hook validates every commit). +- Trailers such as `Co-Authored-By:` are allowed; only the subject line is validated. + +## Enforcement + +Only the Conventional Commit format is hook-enforced, via a `commit-msg` hook in `.githooks/`. The `build` target points git at that directory automatically (`git config core.hooksPath .githooks`), so a single `latte build` activates it — no manual setup per clone. To activate it by hand without building: `git config core.hooksPath .githooks`. + +The branching and squash-merge standards above are not hook-enforced; follow them by reading this file. diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 6a043f4..8213774 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -9,6 +9,7 @@