Skip to content

Commit c12fb3a

Browse files
committed
chore: add .editorconfig (attributes on their own line) + code-style rules
Shared Rider/ReSharper formatting via .editorconfig — resharper_place_attribute_on_same_line=never so attributes never pack onto the member or onto each other. CONTRIBUTING documents the comment convention (XML / WHY: / TODO: / HACK:, strip obvious what-comments) and a before-you-commit checklist: reformat, tests, changelog, lockstep version bump.
1 parent 45524ce commit c12fb3a

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

.editorconfig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
trim_trailing_whitespace = true
6+
insert_final_newline = true
7+
8+
[*.cs]
9+
indent_style = space
10+
indent_size = 4
11+
12+
# ReSharper / Rider formatting shared with the whole team.
13+
# Attributes ALWAYS on their own line — never packed onto the member or onto each other
14+
# (e.g. never `[SerializeField] private int x;` or `[Tooltip("...")] [SerializeField]`).
15+
resharper_place_attribute_on_same_line = never
16+
resharper_csharp_place_attribute_on_same_line = never
17+
resharper_max_attribute_length_for_same_line = 0
18+
19+
# Keep other members from being collapsed onto one line.
20+
resharper_place_accessorholder_attribute_on_same_line = never
21+
resharper_place_field_attribute_on_same_line = never
22+
resharper_place_type_attribute_on_same_line = never
23+
resharper_place_method_attribute_on_same_line = never
24+
25+
[*.{json,uxml,uss,md,yml,yaml}]
26+
indent_style = space
27+
indent_size = 2
28+
29+
# Unity-generated files: do not fight Unity's own formatting.
30+
[*.{meta,asset,prefab,unity,asmdef,mat}]
31+
trim_trailing_whitespace = false
32+
insert_final_newline = false

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,30 @@ secrets: `UNITY_LICENSE`, `UNITY_EMAIL`, `UNITY_PASSWORD`.
3838

3939
New Lua-dependent test files must be wrapped in `#if !COREAI_NO_LUA` so the
4040
`no-lua` job compiles.
41+
42+
## Code style
43+
44+
Formatting is shared through the repo `.editorconfig` (Rider/ReSharper read it directly). Run
45+
**Rider → Code → Reformat & Cleanup Code** before committing so a diff never mixes logic with style.
46+
Notably: **every attribute goes on its own line** — never `[SerializeField] private int x;` and never
47+
`[Tooltip("...")] [SerializeField]` packed together.
48+
49+
### Comments
50+
51+
Keep only comments that carry information the code cannot. Label the intentional kinds with an explicit
52+
prefix and delete everything else:
53+
54+
- `/// <summary>` — XML docs on public/protected API.
55+
- `// WHY:` — rationale, non-obvious invariants, ordering constraints, workarounds, external-format notes.
56+
- `// TODO:` — deferred work.
57+
- `// HACK:` — deliberate shortcuts worth flagging.
58+
59+
Remove obvious "what" comments that merely restate the next line, step-number narration (`// 1. Create…`),
60+
and section-divider banners.
61+
62+
## Before you commit (checklist)
63+
64+
1. **Reformat** — Rider *Reformat & Cleanup Code* (applies `.editorconfig`, incl. attribute-per-line).
65+
2. **Tests** — run the EditMode gate green (CI runs `lua` + `no-lua`; run locally in batchmode for a fast pre-push check).
66+
3. **Changelog** — add an entry under `[Unreleased]` (or the release section) in the affected package `CHANGELOG.md`.
67+
4. **Version** — for a release, bump **all five** `package.json` files in lockstep to the same version.

0 commit comments

Comments
 (0)