conductor-install 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +81 -0
- package/dist/conductor/.github/workflows/release-please.yml +47 -0
- package/dist/conductor/.release-please-manifest.json +3 -0
- package/dist/conductor/CHANGELOG.md +39 -0
- package/dist/conductor/CONTRIBUTING.md +33 -0
- package/dist/conductor/GEMINI.md +41 -0
- package/dist/conductor/LICENSE +202 -0
- package/dist/conductor/README.md +128 -0
- package/dist/conductor/commands/conductor/implement.toml +179 -0
- package/dist/conductor/commands/conductor/newTrack.toml +154 -0
- package/dist/conductor/commands/conductor/revert.toml +130 -0
- package/dist/conductor/commands/conductor/review.toml +158 -0
- package/dist/conductor/commands/conductor/setup.toml +456 -0
- package/dist/conductor/commands/conductor/status.toml +57 -0
- package/dist/conductor/conductor/.github/workflows/release-please.yml +47 -0
- package/dist/conductor/conductor/.release-please-manifest.json +3 -0
- package/dist/conductor/conductor/CHANGELOG.md +39 -0
- package/dist/conductor/conductor/CONTRIBUTING.md +33 -0
- package/dist/conductor/conductor/GEMINI.md +41 -0
- package/dist/conductor/conductor/LICENSE +202 -0
- package/dist/conductor/conductor/README.md +128 -0
- package/dist/conductor/conductor/commands/conductor/implement.toml +179 -0
- package/dist/conductor/conductor/commands/conductor/newTrack.toml +154 -0
- package/dist/conductor/conductor/commands/conductor/revert.toml +130 -0
- package/dist/conductor/conductor/commands/conductor/review.toml +158 -0
- package/dist/conductor/conductor/commands/conductor/setup.toml +456 -0
- package/dist/conductor/conductor/commands/conductor/status.toml +57 -0
- package/dist/conductor/conductor/gemini-extension.json +5 -0
- package/dist/conductor/conductor/release-please-config.json +11 -0
- package/dist/conductor/conductor/templates/code_styleguides/cpp.md +113 -0
- package/dist/conductor/conductor/templates/code_styleguides/csharp.md +115 -0
- package/dist/conductor/conductor/templates/code_styleguides/dart.md +238 -0
- package/dist/conductor/conductor/templates/code_styleguides/general.md +23 -0
- package/dist/conductor/conductor/templates/code_styleguides/go.md +48 -0
- package/dist/conductor/conductor/templates/code_styleguides/html-css.md +49 -0
- package/dist/conductor/conductor/templates/code_styleguides/javascript.md +51 -0
- package/dist/conductor/conductor/templates/code_styleguides/python.md +37 -0
- package/dist/conductor/conductor/templates/code_styleguides/typescript.md +43 -0
- package/dist/conductor/conductor/templates/workflow.md +333 -0
- package/dist/conductor/gemini-extension.json +5 -0
- package/dist/conductor/release-please-config.json +11 -0
- package/dist/conductor/templates/code_styleguides/cpp.md +113 -0
- package/dist/conductor/templates/code_styleguides/csharp.md +115 -0
- package/dist/conductor/templates/code_styleguides/dart.md +238 -0
- package/dist/conductor/templates/code_styleguides/general.md +23 -0
- package/dist/conductor/templates/code_styleguides/go.md +48 -0
- package/dist/conductor/templates/code_styleguides/html-css.md +49 -0
- package/dist/conductor/templates/code_styleguides/javascript.md +51 -0
- package/dist/conductor/templates/code_styleguides/python.md +37 -0
- package/dist/conductor/templates/code_styleguides/typescript.md +43 -0
- package/dist/conductor/templates/workflow.md +333 -0
- package/dist/conductor-install.cjs +779 -0
- package/dist/conductor-install.js +752 -0
- package/dist/index.cjs +776 -0
- package/dist/index.js +749 -0
- package/dist/templates/.github/workflows/release-please.yml +47 -0
- package/dist/templates/.release-please-manifest.json +3 -0
- package/dist/templates/templates/.github/workflows/release-please.yml +47 -0
- package/dist/templates/templates/.release-please-manifest.json +3 -0
- package/package.json +53 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Google Python Style Guide Summary
|
|
2
|
+
|
|
3
|
+
This document summarizes key rules and best practices from the Google Python Style Guide.
|
|
4
|
+
|
|
5
|
+
## 1. Python Language Rules
|
|
6
|
+
- **Linting:** Run `pylint` on your code to catch bugs and style issues.
|
|
7
|
+
- **Imports:** Use `import x` for packages/modules. Use `from x import y` only when `y` is a submodule.
|
|
8
|
+
- **Exceptions:** Use built-in exception classes. Do not use bare `except:` clauses.
|
|
9
|
+
- **Global State:** Avoid mutable global state. Module-level constants are okay and should be `ALL_CAPS_WITH_UNDERSCORES`.
|
|
10
|
+
- **Comprehensions:** Use for simple cases. Avoid for complex logic where a full loop is more readable.
|
|
11
|
+
- **Default Argument Values:** Do not use mutable objects (like `[]` or `{}`) as default values.
|
|
12
|
+
- **True/False Evaluations:** Use implicit false (e.g., `if not my_list:`). Use `if foo is None:` to check for `None`.
|
|
13
|
+
- **Type Annotations:** Strongly encouraged for all public APIs.
|
|
14
|
+
|
|
15
|
+
## 2. Python Style Rules
|
|
16
|
+
- **Line Length:** Maximum 80 characters.
|
|
17
|
+
- **Indentation:** 4 spaces per indentation level. Never use tabs.
|
|
18
|
+
- **Blank Lines:** Two blank lines between top-level definitions (classes, functions). One blank line between method definitions.
|
|
19
|
+
- **Whitespace:** Avoid extraneous whitespace. Surround binary operators with single spaces.
|
|
20
|
+
- **Docstrings:** Use `"""triple double quotes"""`. Every public module, function, class, and method must have a docstring.
|
|
21
|
+
- **Format:** Start with a one-line summary. Include `Args:`, `Returns:`, and `Raises:` sections.
|
|
22
|
+
- **Strings:** Use f-strings for formatting. Be consistent with single (`'`) or double (`"`) quotes.
|
|
23
|
+
- **`TODO` Comments:** Use `TODO(username): Fix this.` format.
|
|
24
|
+
- **Imports Formatting:** Imports should be on separate lines and grouped: standard library, third-party, and your own application's imports.
|
|
25
|
+
|
|
26
|
+
## 3. Naming
|
|
27
|
+
- **General:** `snake_case` for modules, functions, methods, and variables.
|
|
28
|
+
- **Classes:** `PascalCase`.
|
|
29
|
+
- **Constants:** `ALL_CAPS_WITH_UNDERSCORES`.
|
|
30
|
+
- **Internal Use:** Use a single leading underscore (`_internal_variable`) for internal module/class members.
|
|
31
|
+
|
|
32
|
+
## 4. Main
|
|
33
|
+
- All executable files should have a `main()` function that contains the main logic, called from a `if __name__ == '__main__':` block.
|
|
34
|
+
|
|
35
|
+
**BE CONSISTENT.** When editing code, match the existing style.
|
|
36
|
+
|
|
37
|
+
*Source: [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)*
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Google TypeScript Style Guide Summary
|
|
2
|
+
|
|
3
|
+
This document summarizes key rules and best practices from the Google TypeScript Style Guide, which is enforced by the `gts` tool.
|
|
4
|
+
|
|
5
|
+
## 1. Language Features
|
|
6
|
+
- **Variable Declarations:** Always use `const` or `let`. **`var` is forbidden.** Use `const` by default.
|
|
7
|
+
- **Modules:** Use ES6 modules (`import`/`export`). **Do not use `namespace`.**
|
|
8
|
+
- **Exports:** Use named exports (`export {MyClass};`). **Do not use default exports.**
|
|
9
|
+
- **Classes:**
|
|
10
|
+
- **Do not use `#private` fields.** Use TypeScript's `private` visibility modifier.
|
|
11
|
+
- Mark properties never reassigned outside the constructor with `readonly`.
|
|
12
|
+
- **Never use the `public` modifier** (it's the default). Restrict visibility with `private` or `protected` where possible.
|
|
13
|
+
- **Functions:** Prefer function declarations for named functions. Use arrow functions for anonymous functions/callbacks.
|
|
14
|
+
- **String Literals:** Use single quotes (`'`). Use template literals (`` ` ``) for interpolation and multi-line strings.
|
|
15
|
+
- **Equality Checks:** Always use triple equals (`===`) and not equals (`!==`).
|
|
16
|
+
- **Type Assertions:** **Avoid type assertions (`x as SomeType`) and non-nullability assertions (`y!`)**. If you must use them, provide a clear justification.
|
|
17
|
+
|
|
18
|
+
## 2. Disallowed Features
|
|
19
|
+
- **`any` Type:** **Avoid `any`**. Prefer `unknown` or a more specific type.
|
|
20
|
+
- **Wrapper Objects:** Do not instantiate `String`, `Boolean`, or `Number` wrapper classes.
|
|
21
|
+
- **Automatic Semicolon Insertion (ASI):** Do not rely on it. **Explicitly end all statements with a semicolon.**
|
|
22
|
+
- **`const enum`:** Do not use `const enum`. Use plain `enum` instead.
|
|
23
|
+
- **`eval()` and `Function(...string)`:** Forbidden.
|
|
24
|
+
|
|
25
|
+
## 3. Naming
|
|
26
|
+
- **`UpperCamelCase`:** For classes, interfaces, types, enums, and decorators.
|
|
27
|
+
- **`lowerCamelCase`:** For variables, parameters, functions, methods, and properties.
|
|
28
|
+
- **`CONSTANT_CASE`:** For global constant values, including enum values.
|
|
29
|
+
- **`_` Prefix/Suffix:** **Do not use `_` as a prefix or suffix** for identifiers, including for private properties.
|
|
30
|
+
|
|
31
|
+
## 4. Type System
|
|
32
|
+
- **Type Inference:** Rely on type inference for simple, obvious types. Be explicit for complex types.
|
|
33
|
+
- **`undefined` and `null`:** Both are supported. Be consistent within your project.
|
|
34
|
+
- **Optional vs. `|undefined`:** Prefer optional parameters and fields (`?`) over adding `|undefined` to the type.
|
|
35
|
+
- **`Array<T>` Type:** Use `T[]` for simple types. Use `Array<T>` for more complex union types (e.g., `Array<string | number>`).
|
|
36
|
+
- **`{}` Type:** **Do not use `{}`**. Prefer `unknown`, `Record<string, unknown>`, or `object`.
|
|
37
|
+
|
|
38
|
+
## 5. Comments and Documentation
|
|
39
|
+
- **JSDoc:** Use `/** JSDoc */` for documentation, `//` for implementation comments.
|
|
40
|
+
- **Redundancy:** **Do not declare types in `@param` or `@return` blocks** (e.g., `/** @param {string} user */`). This is redundant in TypeScript.
|
|
41
|
+
- **Add Information:** Comments must add information, not just restate the code.
|
|
42
|
+
|
|
43
|
+
*Source: [Google TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html)*
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
# Project Workflow
|
|
2
|
+
|
|
3
|
+
## Guiding Principles
|
|
4
|
+
|
|
5
|
+
1. **The Plan is the Source of Truth:** All work must be tracked in `plan.md`
|
|
6
|
+
2. **The Tech Stack is Deliberate:** Changes to the tech stack must be documented in `tech-stack.md` *before* implementation
|
|
7
|
+
3. **Test-Driven Development:** Write unit tests before implementing functionality
|
|
8
|
+
4. **High Code Coverage:** Aim for >80% code coverage for all modules
|
|
9
|
+
5. **User Experience First:** Every decision should prioritize user experience
|
|
10
|
+
6. **Non-Interactive & CI-Aware:** Prefer non-interactive commands. Use `CI=true` for watch-mode tools (tests, linters) to ensure single execution.
|
|
11
|
+
|
|
12
|
+
## Task Workflow
|
|
13
|
+
|
|
14
|
+
All tasks follow a strict lifecycle:
|
|
15
|
+
|
|
16
|
+
### Standard Task Workflow
|
|
17
|
+
|
|
18
|
+
1. **Select Task:** Choose the next available task from `plan.md` in sequential order
|
|
19
|
+
|
|
20
|
+
2. **Mark In Progress:** Before beginning work, edit `plan.md` and change the task from `[ ]` to `[~]`
|
|
21
|
+
|
|
22
|
+
3. **Write Failing Tests (Red Phase):**
|
|
23
|
+
- Create a new test file for the feature or bug fix.
|
|
24
|
+
- Write one or more unit tests that clearly define the expected behavior and acceptance criteria for the task.
|
|
25
|
+
- **CRITICAL:** Run the tests and confirm that they fail as expected. This is the "Red" phase of TDD. Do not proceed until you have failing tests.
|
|
26
|
+
|
|
27
|
+
4. **Implement to Pass Tests (Green Phase):**
|
|
28
|
+
- Write the minimum amount of application code necessary to make the failing tests pass.
|
|
29
|
+
- Run the test suite again and confirm that all tests now pass. This is the "Green" phase.
|
|
30
|
+
|
|
31
|
+
5. **Refactor (Optional but Recommended):**
|
|
32
|
+
- With the safety of passing tests, refactor the implementation code and the test code to improve clarity, remove duplication, and enhance performance without changing the external behavior.
|
|
33
|
+
- Rerun tests to ensure they still pass after refactoring.
|
|
34
|
+
|
|
35
|
+
6. **Verify Coverage:** Run coverage reports using the project's chosen tools. For example, in a Python project, this might look like:
|
|
36
|
+
```bash
|
|
37
|
+
pytest --cov=app --cov-report=html
|
|
38
|
+
```
|
|
39
|
+
Target: >80% coverage for new code. The specific tools and commands will vary by language and framework.
|
|
40
|
+
|
|
41
|
+
7. **Document Deviations:** If implementation differs from tech stack:
|
|
42
|
+
- **STOP** implementation
|
|
43
|
+
- Update `tech-stack.md` with new design
|
|
44
|
+
- Add dated note explaining the change
|
|
45
|
+
- Resume implementation
|
|
46
|
+
|
|
47
|
+
8. **Commit Code Changes:**
|
|
48
|
+
- Stage all code changes related to the task.
|
|
49
|
+
- Propose a clear, concise commit message e.g, `feat(ui): Create basic HTML structure for calculator`.
|
|
50
|
+
- Perform the commit.
|
|
51
|
+
|
|
52
|
+
9. **Attach Task Summary with Git Notes:**
|
|
53
|
+
- **Step 9.1: Get Commit Hash:** Obtain the hash of the *just-completed commit* (`git log -1 --format="%H"`).
|
|
54
|
+
- **Step 9.2: Draft Note Content:** Create a detailed summary for the completed task. This should include the task name, a summary of changes, a list of all created/modified files, and the core "why" for the change.
|
|
55
|
+
- **Step 9.3: Attach Note:** Use the `git notes` command to attach the summary to the commit.
|
|
56
|
+
```bash
|
|
57
|
+
# The note content from the previous step is passed via the -m flag.
|
|
58
|
+
git notes add -m "<note content>" <commit_hash>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
10. **Get and Record Task Commit SHA:**
|
|
62
|
+
- **Step 10.1: Update Plan:** Read `plan.md`, find the line for the completed task, update its status from `[~]` to `[x]`, and append the first 7 characters of the *just-completed commit's* commit hash.
|
|
63
|
+
- **Step 10.2: Write Plan:** Write the updated content back to `plan.md`.
|
|
64
|
+
|
|
65
|
+
11. **Commit Plan Update:**
|
|
66
|
+
- **Action:** Stage the modified `plan.md` file.
|
|
67
|
+
- **Action:** Commit this change with a descriptive message (e.g., `conductor(plan): Mark task 'Create user model' as complete`).
|
|
68
|
+
|
|
69
|
+
### Phase Completion Verification and Checkpointing Protocol
|
|
70
|
+
|
|
71
|
+
**Trigger:** This protocol is executed immediately after a task is completed that also concludes a phase in `plan.md`.
|
|
72
|
+
|
|
73
|
+
1. **Announce Protocol Start:** Inform the user that the phase is complete and the verification and checkpointing protocol has begun.
|
|
74
|
+
|
|
75
|
+
2. **Ensure Test Coverage for Phase Changes:**
|
|
76
|
+
- **Step 2.1: Determine Phase Scope:** To identify the files changed in this phase, you must first find the starting point. Read `plan.md` to find the Git commit SHA of the *previous* phase's checkpoint. If no previous checkpoint exists, the scope is all changes since the first commit.
|
|
77
|
+
- **Step 2.2: List Changed Files:** Execute `git diff --name-only <previous_checkpoint_sha> HEAD` to get a precise list of all files modified during this phase.
|
|
78
|
+
- **Step 2.3: Verify and Create Tests:** For each file in the list:
|
|
79
|
+
- **CRITICAL:** First, check its extension. Exclude non-code files (e.g., `.json`, `.md`, `.yaml`).
|
|
80
|
+
- For each remaining code file, verify a corresponding test file exists.
|
|
81
|
+
- If a test file is missing, you **must** create one. Before writing the test, **first, analyze other test files in the repository to determine the correct naming convention and testing style.** The new tests **must** validate the functionality described in this phase's tasks (`plan.md`).
|
|
82
|
+
|
|
83
|
+
3. **Execute Automated Tests with Proactive Debugging:**
|
|
84
|
+
- Before execution, you **must** announce the exact shell command you will use to run the tests.
|
|
85
|
+
- **Example Announcement:** "I will now run the automated test suite to verify the phase. **Command:** `CI=true npm test`"
|
|
86
|
+
- Execute the announced command.
|
|
87
|
+
- If tests fail, you **must** inform the user and begin debugging. You may attempt to propose a fix a **maximum of two times**. If the tests still fail after your second proposed fix, you **must stop**, report the persistent failure, and ask the user for guidance.
|
|
88
|
+
|
|
89
|
+
4. **Propose a Detailed, Actionable Manual Verification Plan:**
|
|
90
|
+
- **CRITICAL:** To generate the plan, first analyze `product.md`, `product-guidelines.md`, and `plan.md` to determine the user-facing goals of the completed phase.
|
|
91
|
+
- You **must** generate a step-by-step plan that walks the user through the verification process, including any necessary commands and specific, expected outcomes.
|
|
92
|
+
- The plan you present to the user **must** follow this format:
|
|
93
|
+
|
|
94
|
+
**For a Frontend Change:**
|
|
95
|
+
```
|
|
96
|
+
The automated tests have passed. For manual verification, please follow these steps:
|
|
97
|
+
|
|
98
|
+
**Manual Verification Steps:**
|
|
99
|
+
1. **Start the development server with the command:** `npm run dev`
|
|
100
|
+
2. **Open your browser to:** `http://localhost:3000`
|
|
101
|
+
3. **Confirm that you see:** The new user profile page, with the user's name and email displayed correctly.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**For a Backend Change:**
|
|
105
|
+
```
|
|
106
|
+
The automated tests have passed. For manual verification, please follow these steps:
|
|
107
|
+
|
|
108
|
+
**Manual Verification Steps:**
|
|
109
|
+
1. **Ensure the server is running.**
|
|
110
|
+
2. **Execute the following command in your terminal:** `curl -X POST http://localhost:8080/api/v1/users -d '{"name": "test"}'`
|
|
111
|
+
3. **Confirm that you receive:** A JSON response with a status of `201 Created`.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
5. **Await Explicit User Feedback:**
|
|
115
|
+
- After presenting the detailed plan, ask the user for confirmation: "**Does this meet your expectations? Please confirm with yes or provide feedback on what needs to be changed.**"
|
|
116
|
+
- **PAUSE** and await the user's response. Do not proceed without an explicit yes or confirmation.
|
|
117
|
+
|
|
118
|
+
6. **Create Checkpoint Commit:**
|
|
119
|
+
- Stage all changes. If no changes occurred in this step, proceed with an empty commit.
|
|
120
|
+
- Perform the commit with a clear and concise message (e.g., `conductor(checkpoint): Checkpoint end of Phase X`).
|
|
121
|
+
|
|
122
|
+
7. **Attach Auditable Verification Report using Git Notes:**
|
|
123
|
+
- **Step 7.1: Draft Note Content:** Create a detailed verification report including the automated test command, the manual verification steps, and the user's confirmation.
|
|
124
|
+
- **Step 7.2: Attach Note:** Use the `git notes` command and the full commit hash from the previous step to attach the full report to the checkpoint commit.
|
|
125
|
+
|
|
126
|
+
8. **Get and Record Phase Checkpoint SHA:**
|
|
127
|
+
- **Step 8.1: Get Commit Hash:** Obtain the hash of the *just-created checkpoint commit* (`git log -1 --format="%H"`).
|
|
128
|
+
- **Step 8.2: Update Plan:** Read `plan.md`, find the heading for the completed phase, and append the first 7 characters of the commit hash in the format `[checkpoint: <sha>]`.
|
|
129
|
+
- **Step 8.3: Write Plan:** Write the updated content back to `plan.md`.
|
|
130
|
+
|
|
131
|
+
9. **Commit Plan Update:**
|
|
132
|
+
- **Action:** Stage the modified `plan.md` file.
|
|
133
|
+
- **Action:** Commit this change with a descriptive message following the format `conductor(plan): Mark phase '<PHASE NAME>' as complete`.
|
|
134
|
+
|
|
135
|
+
10. **Announce Completion:** Inform the user that the phase is complete and the checkpoint has been created, with the detailed verification report attached as a git note.
|
|
136
|
+
|
|
137
|
+
### Quality Gates
|
|
138
|
+
|
|
139
|
+
Before marking any task complete, verify:
|
|
140
|
+
|
|
141
|
+
- [ ] All tests pass
|
|
142
|
+
- [ ] Code coverage meets requirements (>80%)
|
|
143
|
+
- [ ] Code follows project's code style guidelines (as defined in `code_styleguides/`)
|
|
144
|
+
- [ ] All public functions/methods are documented (e.g., docstrings, JSDoc, GoDoc)
|
|
145
|
+
- [ ] Type safety is enforced (e.g., type hints, TypeScript types, Go types)
|
|
146
|
+
- [ ] No linting or static analysis errors (using the project's configured tools)
|
|
147
|
+
- [ ] Works correctly on mobile (if applicable)
|
|
148
|
+
- [ ] Documentation updated if needed
|
|
149
|
+
- [ ] No security vulnerabilities introduced
|
|
150
|
+
|
|
151
|
+
## Development Commands
|
|
152
|
+
|
|
153
|
+
**AI AGENT INSTRUCTION: This section should be adapted to the project's specific language, framework, and build tools.**
|
|
154
|
+
|
|
155
|
+
### Setup
|
|
156
|
+
```bash
|
|
157
|
+
# Example: Commands to set up the development environment (e.g., install dependencies, configure database)
|
|
158
|
+
# e.g., for a Node.js project: npm install
|
|
159
|
+
# e.g., for a Go project: go mod tidy
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Daily Development
|
|
163
|
+
```bash
|
|
164
|
+
# Example: Commands for common daily tasks (e.g., start dev server, run tests, lint, format)
|
|
165
|
+
# e.g., for a Node.js project: npm run dev, npm test, npm run lint
|
|
166
|
+
# e.g., for a Go project: go run main.go, go test ./..., go fmt ./...
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Before Committing
|
|
170
|
+
```bash
|
|
171
|
+
# Example: Commands to run all pre-commit checks (e.g., format, lint, type check, run tests)
|
|
172
|
+
# e.g., for a Node.js project: npm run check
|
|
173
|
+
# e.g., for a Go project: make check (if a Makefile exists)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Testing Requirements
|
|
177
|
+
|
|
178
|
+
### Unit Testing
|
|
179
|
+
- Every module must have corresponding tests.
|
|
180
|
+
- Use appropriate test setup/teardown mechanisms (e.g., fixtures, beforeEach/afterEach).
|
|
181
|
+
- Mock external dependencies.
|
|
182
|
+
- Test both success and failure cases.
|
|
183
|
+
|
|
184
|
+
### Integration Testing
|
|
185
|
+
- Test complete user flows
|
|
186
|
+
- Verify database transactions
|
|
187
|
+
- Test authentication and authorization
|
|
188
|
+
- Check form submissions
|
|
189
|
+
|
|
190
|
+
### Mobile Testing
|
|
191
|
+
- Test on actual iPhone when possible
|
|
192
|
+
- Use Safari developer tools
|
|
193
|
+
- Test touch interactions
|
|
194
|
+
- Verify responsive layouts
|
|
195
|
+
- Check performance on 3G/4G
|
|
196
|
+
|
|
197
|
+
## Code Review Process
|
|
198
|
+
|
|
199
|
+
### Self-Review Checklist
|
|
200
|
+
Before requesting review:
|
|
201
|
+
|
|
202
|
+
1. **Functionality**
|
|
203
|
+
- Feature works as specified
|
|
204
|
+
- Edge cases handled
|
|
205
|
+
- Error messages are user-friendly
|
|
206
|
+
|
|
207
|
+
2. **Code Quality**
|
|
208
|
+
- Follows style guide
|
|
209
|
+
- DRY principle applied
|
|
210
|
+
- Clear variable/function names
|
|
211
|
+
- Appropriate comments
|
|
212
|
+
|
|
213
|
+
3. **Testing**
|
|
214
|
+
- Unit tests comprehensive
|
|
215
|
+
- Integration tests pass
|
|
216
|
+
- Coverage adequate (>80%)
|
|
217
|
+
|
|
218
|
+
4. **Security**
|
|
219
|
+
- No hardcoded secrets
|
|
220
|
+
- Input validation present
|
|
221
|
+
- SQL injection prevented
|
|
222
|
+
- XSS protection in place
|
|
223
|
+
|
|
224
|
+
5. **Performance**
|
|
225
|
+
- Database queries optimized
|
|
226
|
+
- Images optimized
|
|
227
|
+
- Caching implemented where needed
|
|
228
|
+
|
|
229
|
+
6. **Mobile Experience**
|
|
230
|
+
- Touch targets adequate (44x44px)
|
|
231
|
+
- Text readable without zooming
|
|
232
|
+
- Performance acceptable on mobile
|
|
233
|
+
- Interactions feel native
|
|
234
|
+
|
|
235
|
+
## Commit Guidelines
|
|
236
|
+
|
|
237
|
+
### Message Format
|
|
238
|
+
```
|
|
239
|
+
<type>(<scope>): <description>
|
|
240
|
+
|
|
241
|
+
[optional body]
|
|
242
|
+
|
|
243
|
+
[optional footer]
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Types
|
|
247
|
+
- `feat`: New feature
|
|
248
|
+
- `fix`: Bug fix
|
|
249
|
+
- `docs`: Documentation only
|
|
250
|
+
- `style`: Formatting, missing semicolons, etc.
|
|
251
|
+
- `refactor`: Code change that neither fixes a bug nor adds a feature
|
|
252
|
+
- `test`: Adding missing tests
|
|
253
|
+
- `chore`: Maintenance tasks
|
|
254
|
+
|
|
255
|
+
### Examples
|
|
256
|
+
```bash
|
|
257
|
+
git commit -m "feat(auth): Add remember me functionality"
|
|
258
|
+
git commit -m "fix(posts): Correct excerpt generation for short posts"
|
|
259
|
+
git commit -m "test(comments): Add tests for emoji reaction limits"
|
|
260
|
+
git commit -m "style(mobile): Improve button touch targets"
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Definition of Done
|
|
264
|
+
|
|
265
|
+
A task is complete when:
|
|
266
|
+
|
|
267
|
+
1. All code implemented to specification
|
|
268
|
+
2. Unit tests written and passing
|
|
269
|
+
3. Code coverage meets project requirements
|
|
270
|
+
4. Documentation complete (if applicable)
|
|
271
|
+
5. Code passes all configured linting and static analysis checks
|
|
272
|
+
6. Works beautifully on mobile (if applicable)
|
|
273
|
+
7. Implementation notes added to `plan.md`
|
|
274
|
+
8. Changes committed with proper message
|
|
275
|
+
9. Git note with task summary attached to the commit
|
|
276
|
+
|
|
277
|
+
## Emergency Procedures
|
|
278
|
+
|
|
279
|
+
### Critical Bug in Production
|
|
280
|
+
1. Create hotfix branch from main
|
|
281
|
+
2. Write failing test for bug
|
|
282
|
+
3. Implement minimal fix
|
|
283
|
+
4. Test thoroughly including mobile
|
|
284
|
+
5. Deploy immediately
|
|
285
|
+
6. Document in plan.md
|
|
286
|
+
|
|
287
|
+
### Data Loss
|
|
288
|
+
1. Stop all write operations
|
|
289
|
+
2. Restore from latest backup
|
|
290
|
+
3. Verify data integrity
|
|
291
|
+
4. Document incident
|
|
292
|
+
5. Update backup procedures
|
|
293
|
+
|
|
294
|
+
### Security Breach
|
|
295
|
+
1. Rotate all secrets immediately
|
|
296
|
+
2. Review access logs
|
|
297
|
+
3. Patch vulnerability
|
|
298
|
+
4. Notify affected users (if any)
|
|
299
|
+
5. Document and update security procedures
|
|
300
|
+
|
|
301
|
+
## Deployment Workflow
|
|
302
|
+
|
|
303
|
+
### Pre-Deployment Checklist
|
|
304
|
+
- [ ] All tests passing
|
|
305
|
+
- [ ] Coverage >80%
|
|
306
|
+
- [ ] No linting errors
|
|
307
|
+
- [ ] Mobile testing complete
|
|
308
|
+
- [ ] Environment variables configured
|
|
309
|
+
- [ ] Database migrations ready
|
|
310
|
+
- [ ] Backup created
|
|
311
|
+
|
|
312
|
+
### Deployment Steps
|
|
313
|
+
1. Merge feature branch to main
|
|
314
|
+
2. Tag release with version
|
|
315
|
+
3. Push to deployment service
|
|
316
|
+
4. Run database migrations
|
|
317
|
+
5. Verify deployment
|
|
318
|
+
6. Test critical paths
|
|
319
|
+
7. Monitor for errors
|
|
320
|
+
|
|
321
|
+
### Post-Deployment
|
|
322
|
+
1. Monitor analytics
|
|
323
|
+
2. Check error logs
|
|
324
|
+
3. Gather user feedback
|
|
325
|
+
4. Plan next iteration
|
|
326
|
+
|
|
327
|
+
## Continuous Improvement
|
|
328
|
+
|
|
329
|
+
- Review workflow weekly
|
|
330
|
+
- Update based on pain points
|
|
331
|
+
- Document lessons learned
|
|
332
|
+
- Optimize for user happiness
|
|
333
|
+
- Keep things simple and maintainable
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Google C++ Style Guide Summary
|
|
2
|
+
|
|
3
|
+
## 1. Naming
|
|
4
|
+
- **General:** Optimize for readability. Be descriptive but concise. Use inclusive language.
|
|
5
|
+
- **Files:** `.h` (headers), `.cc` (source). Lowercase with underscores (`_`) or dashes (`-`). Be consistent.
|
|
6
|
+
- **Types:** PascalCase (`MyClass`, `MyEnum`). Use `int` by default; use `<cstdint>` (`int32_t`) if size matters.
|
|
7
|
+
- **Concepts:** PascalCase (`MyConcept`).
|
|
8
|
+
- **Variables:** snake_case (`my_var`). Class members end with underscore (`my_member_`), struct members do not.
|
|
9
|
+
- **Constants/Enumerators:** `k` + PascalCase (`kDays`, `kOk`).
|
|
10
|
+
- **Template Parameters:** PascalCase for types (`T`, `MyType`), snake_case/kPascalCase for non-types (`N`, `kLimit`).
|
|
11
|
+
- **Functions:** PascalCase (`GetValue()`).
|
|
12
|
+
- **Accessors/Mutators:** snake_case. `count()` (not `GetCount`), `set_count(v)`.
|
|
13
|
+
- **Namespaces:** lowercase (`web_search`).
|
|
14
|
+
- **Macros:** ALL_CAPS (`MY_MACRO`).
|
|
15
|
+
|
|
16
|
+
## 2. Header Files
|
|
17
|
+
- **General:** Every `.cc` usually has a `.h`. Headers must be self-contained.
|
|
18
|
+
- **Guards:** Use `#define <PROJECT>_<PATH>_<FILE>_H_`.
|
|
19
|
+
- **IWYU:** Direct includes only. Do not rely on transitive includes.
|
|
20
|
+
- **Forward Decls:** Avoid. Include headers instead. **Never** forward declare `std::` symbols.
|
|
21
|
+
- **Inline Definitions:** Only short functions (<10 lines) in headers. Must be ODR-safe (`inline` or templates).
|
|
22
|
+
- **Include Order:**
|
|
23
|
+
1. Related header (`foo.h`)
|
|
24
|
+
2. C system (`<unistd.h>`)
|
|
25
|
+
3. C++ standard (`<vector>`)
|
|
26
|
+
4. Other libraries (`<Python.h>`)
|
|
27
|
+
5. Project headers (`"base/logging.h"`)
|
|
28
|
+
*Separate groups with blank lines. Alphabetical within groups.*
|
|
29
|
+
|
|
30
|
+
## 3. Formatting
|
|
31
|
+
- **Indentation:** 2 spaces. **Line Length:** 80 chars.
|
|
32
|
+
- **Non-ASCII:** Rare, use UTF-8. Avoid `u8` prefix if possible.
|
|
33
|
+
- **Braces:** `if (cond) { ... }`. **Exception:** Function definition open brace goes on the **next line**.
|
|
34
|
+
- **Switch:** Always include `default`. Use `[[fallthrough]]` for explicit fallthrough.
|
|
35
|
+
- **Literals:** Floating-point must have radix point (`1.0f`).
|
|
36
|
+
- **Calls:** Wrap arguments at paren or 4-space indent.
|
|
37
|
+
- **Init Lists:** Colon on new line, indent 4 spaces.
|
|
38
|
+
- **Namespaces:** No indentation.
|
|
39
|
+
- **Vertical Whitespace:** Use sparingly. Separate related chunks, not code blocks.
|
|
40
|
+
- **Loops/Branching:** Use braces (optional if single line). No space after `(`, space before `{`.
|
|
41
|
+
- **Return:** No parens `return result;`.
|
|
42
|
+
- **Preprocessor:** `#` always at line start.
|
|
43
|
+
- **Pointers:** `char* c` (attached to type).
|
|
44
|
+
- **Templates:** No spaces inside `< >` (`vector<int>`).
|
|
45
|
+
- **Operators:** Space around assignment/binary, no space for unary.
|
|
46
|
+
- **Class Order:** `public`, `protected`, `private`.
|
|
47
|
+
- **Parameter Wrapping:** Wrap parameter lists that don't fit. Use 4-space indent for wrapped parameters.
|
|
48
|
+
|
|
49
|
+
## 4. Classes
|
|
50
|
+
- **Constructors:** `explicit` for single-arg and conversion operators. **Exception:** `std::initializer_list`. No virtual calls in ctors. Use factories for fallible init.
|
|
51
|
+
- **Structs:** Only for passive data. Prefer `struct` over `std::pair` or `std::tuple`.
|
|
52
|
+
- **Copy/Move:** Explicitly `= default` or `= delete`. **Rule of 5:** If defining one, declare all.
|
|
53
|
+
- **Inheritance:** `public` only. Composition > Inheritance. Use `override` (omit `virtual`). No multiple implementation inheritance.
|
|
54
|
+
- **Operator Overloading:** Judicious use only. Binary ops as non-members. Never overload `&&`, `||`, `,`, or unary `&`. No User-Defined Literals.
|
|
55
|
+
- **Access:** Data members `private` (except structs/constants).
|
|
56
|
+
- **Declaration Order:** `public` before `protected` before `private`. Within sections: Types, Constants, Factory, Constructors, Destructor, Methods, Data Members.
|
|
57
|
+
|
|
58
|
+
## 5. Functions
|
|
59
|
+
- **Params:** Inputs (`const T&`, `std::string_view`, `std::span` or value) first, then outputs. **Ordering:** Inputs before outputs.
|
|
60
|
+
- **Outputs:** Prefer return values/`std::optional`. For non-optional outputs, use references. For optional outputs, use pointers.
|
|
61
|
+
- **Optional Inputs:** Use `std::optional` for by-value, `const T*` for reference.
|
|
62
|
+
- **Nonmember vs Static:** Prefer nonmember functions in namespaces over static member functions.
|
|
63
|
+
- **Length:** Prefer small (<40 lines).
|
|
64
|
+
- **Overloading:** Use only when behavior is obvious. Document overload sets with a single umbrella comment.
|
|
65
|
+
- **Default Args:** Allowed on non-virtual functions only (value must be fixed/constant).
|
|
66
|
+
- **Trailing Return:** Only when necessary (lambdas).
|
|
67
|
+
|
|
68
|
+
## 6. Scoping
|
|
69
|
+
- **Namespaces:** No `using namespace`. Use `using std::string`. Never add to `namespace std`.
|
|
70
|
+
- **Internal:** Use anonymous namespaces or `static` in `.cc` files. Avoid in headers.
|
|
71
|
+
- **Locals:** Narrowest scope. Initialize at declaration. **Exception:** Declare complex objects outside loops.
|
|
72
|
+
- **Static/Global:** Must be **trivially destructible** (e.g., `constexpr`, raw pointers, arrays). No global `std::string`, `std::map`, smart pointers. Dynamic initialization allowed only for function-static variables.
|
|
73
|
+
- **Thread Local:** `thread_local` must be `constinit` if global. Prefer `thread_local` over other mechanisms.
|
|
74
|
+
|
|
75
|
+
## 7. Modern C++ Features
|
|
76
|
+
- **Version:** Target **C++20**. Do not use C++23. Consider portability for C++17/20 features. No non-standard extensions.
|
|
77
|
+
- **Modules:** Do not use C++20 Modules.
|
|
78
|
+
- **Coroutines:** Use approved libraries only. Do not roll your own promise or awaitable types.
|
|
79
|
+
- **Concepts:** Prefer C++20 Concepts (`requires`) over `std::enable_if`. Use `requires(Concept<T>)`, not `template<Concept T>`.
|
|
80
|
+
- **R-Value References:** Use only for move ctors/assignment, perfect forwarding, or consuming `*this`.
|
|
81
|
+
- **Smart Pointers:** `std::unique_ptr` (exclusive), `std::shared_ptr` (shared). No `std::auto_ptr`.
|
|
82
|
+
- **Auto:** Use when type is obvious (`make_unique`, iterators). Avoid for public APIs.
|
|
83
|
+
- **CTAD:** Use only if explicitly supported (deduction guides exist).
|
|
84
|
+
- **Structured Bindings:** Use for pairs/tuples. Comment aliased field names.
|
|
85
|
+
- **Nullptr:** Use `nullptr`, never `NULL` or `0`.
|
|
86
|
+
- **Constexpr:** Use `constexpr`/`consteval` for constants/functions whenever possible. Use `constinit` for static initialization.
|
|
87
|
+
- **Noexcept:** Specify when useful/correct. Prefer unconditional `noexcept` if exceptions are disabled.
|
|
88
|
+
- **Lambdas:** Prefer explicit captures (`[&x]`) if escaping scope. Avoid `std::bind`.
|
|
89
|
+
- **Initialization:** Prefer brace init. **Designated Initializers:** Allowed (C++20 ordered form only).
|
|
90
|
+
- **Casts:** Use C++ casts (`static_cast`). Use `std::bit_cast` for type punning.
|
|
91
|
+
- **Loops:** Prefer range-based `for`.
|
|
92
|
+
|
|
93
|
+
## 8. Best Practices
|
|
94
|
+
- **Const:** Mark methods/variables `const` whenever possible. `const` methods must be thread-safe.
|
|
95
|
+
- **Exceptions:** **Forbidden**.
|
|
96
|
+
- **RTTI:** Avoid `dynamic_cast`/`typeid`. Allowed in unit tests. Do not hand-implement workarounds.
|
|
97
|
+
- **Macros:** Avoid. Use `constexpr`/`inline`. If needed, define close to use and `#undef` immediately. Do not define in headers.
|
|
98
|
+
- **0 and nullptr:** Use `nullptr` for pointers, `\0` for chars, not `0`.
|
|
99
|
+
- **Streams:** Use streams primarily for logging. Prefer printf-style formatting or absl::StrCat.
|
|
100
|
+
- **Types:** Avoid `unsigned` for non-negativity. No `long double`.
|
|
101
|
+
- **Pre-increment:** Prefer `++i` over `i++`.
|
|
102
|
+
- **Sizeof:** Prefer `sizeof(varname)` over `sizeof(type)`.
|
|
103
|
+
- **Friends:** Allowed, usually defined in the same file.
|
|
104
|
+
- **Boost:** Use only approved libraries (e.g., Call Traits, Compressed Pair, BGL, Property Map, Iterator, etc.).
|
|
105
|
+
- **Aliases:** Use `using` instead of `typedef`. Public aliases must be documented.
|
|
106
|
+
- **Ownership:** Single fixed owner. Transfer via smart pointers.
|
|
107
|
+
- **Aliases:** Document intent. Don't use in public API for convenience. `using` > `typedef`.
|
|
108
|
+
- **Switch:** Always include `default`. Use `[[fallthrough]]` for explicit fallthrough.
|
|
109
|
+
- **Comments:** Document File, Class, Function (params/return). Use `//` or `/* */`. Implementation comments for tricky code. `TODO(user):` format.
|
|
110
|
+
|
|
111
|
+
**BE CONSISTENT.** Follow existing code style.
|
|
112
|
+
|
|
113
|
+
*Source: [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)*
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Google C# Style Guide Summary
|
|
2
|
+
|
|
3
|
+
This document summarizes key rules and best practices from the Google C# Style Guide.
|
|
4
|
+
|
|
5
|
+
## 1. Naming Conventions
|
|
6
|
+
- **PascalCase:** For class names, method names, constants, properties, namespaces, and public fields.
|
|
7
|
+
- Example: `MyClass`, `GetValue()`, `MaxValue`
|
|
8
|
+
- **_camelCase:** For private, internal, and protected fields (with leading underscore).
|
|
9
|
+
- Example: `_myField`, `_internalState`
|
|
10
|
+
- **camelCase:** For local variables and parameters.
|
|
11
|
+
- Example: `localVariable`, `methodParameter`
|
|
12
|
+
- **Interfaces:** Prefix with `I` (e.g., `IMyInterface`).
|
|
13
|
+
- **Type Parameters:** Use descriptive names prefixed with `T` (e.g., `TValue`, `TKey`), or just `T` for simple cases.
|
|
14
|
+
|
|
15
|
+
## 2. Formatting Rules
|
|
16
|
+
- **Indentation:** Use 2 spaces (never tabs).
|
|
17
|
+
- **Braces:** K&R style—no line break before the opening brace; keep `} else` on one line; braces required even when optional.
|
|
18
|
+
```csharp
|
|
19
|
+
if (condition) {
|
|
20
|
+
DoSomething();
|
|
21
|
+
} else {
|
|
22
|
+
DoSomethingElse();
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
- **Line Length:** Column limit 100.
|
|
26
|
+
- **One Statement Per Line:** Each statement on its own line.
|
|
27
|
+
|
|
28
|
+
## 3. Declaration Order
|
|
29
|
+
Class member ordering:
|
|
30
|
+
- Group members in this order:
|
|
31
|
+
1. Nested classes, enums, delegates, and events
|
|
32
|
+
2. Static, const, and readonly fields
|
|
33
|
+
3. Fields and properties
|
|
34
|
+
4. Constructors and finalizers
|
|
35
|
+
5. Methods
|
|
36
|
+
- Within each group, order by accessibility:
|
|
37
|
+
1. Public
|
|
38
|
+
2. Internal
|
|
39
|
+
3. Protected internal
|
|
40
|
+
4. Protected
|
|
41
|
+
5. Private
|
|
42
|
+
- Where possible, group interface implementations together.
|
|
43
|
+
|
|
44
|
+
## 4. Language Features
|
|
45
|
+
- **var:** Use of `var` is encouraged if it aids readability by avoiding type names that are noisy, obvious, or unimportant. Prefer explicit types when it improves clarity.
|
|
46
|
+
```csharp
|
|
47
|
+
var apple = new Apple(); // Good - type is obvious
|
|
48
|
+
bool success = true; // Preferred over var for basic types
|
|
49
|
+
```
|
|
50
|
+
- **Expression-bodied Members:** Use sparingly for simple properties and lambdas; don't use on method definitions.
|
|
51
|
+
```csharp
|
|
52
|
+
public int Age => _age;
|
|
53
|
+
// Methods: prefer block bodies.
|
|
54
|
+
```
|
|
55
|
+
- **String Interpolation:** In general, use whatever is easiest to read, particularly for logging and assert messages.
|
|
56
|
+
- Be aware that chained `operator+` concatenations can be slower and cause memory churn.
|
|
57
|
+
- If performance is a concern, `StringBuilder` can be faster for multiple concatenations.
|
|
58
|
+
```csharp
|
|
59
|
+
var message = $"Hello, {name}!";
|
|
60
|
+
```
|
|
61
|
+
- **Collection Initializers:** Use collection and object initializers when appropriate.
|
|
62
|
+
```csharp
|
|
63
|
+
var list = new List<int> { 1, 2, 3 };
|
|
64
|
+
```
|
|
65
|
+
- **Null-conditional Operators:** Use `?.` and `??` to simplify null checks.
|
|
66
|
+
```csharp
|
|
67
|
+
var length = text?.Length ?? 0;
|
|
68
|
+
```
|
|
69
|
+
- **Pattern Matching:** Use pattern matching for type checks and casts.
|
|
70
|
+
```csharp
|
|
71
|
+
if (obj is string str) { /* use str */ }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 5. Best Practices
|
|
75
|
+
- **Structs vs Classes**:
|
|
76
|
+
- Almost always use a class.
|
|
77
|
+
- Consider structs only for small, value-like types that are short-lived or frequently embedded.
|
|
78
|
+
- Performance considerations may justify deviations from this guidance.
|
|
79
|
+
- **Access Modifiers:** Always explicitly declare access modifiers (don't rely on defaults).
|
|
80
|
+
- **Ordering Modifiers:** Use standard order: `public protected internal private new abstract virtual override sealed static readonly extern unsafe volatile async`.
|
|
81
|
+
- **Namespace Imports:** Place `using` directives at the top of the file (outside namespaces); `System` first, then alphabetical.
|
|
82
|
+
- **Constants:** Always make variables `const` when possible; if not, use `readonly`. Prefer named constants over magic numbers.
|
|
83
|
+
- **IEnumerable vs IList vs IReadOnlyList:** When method inputs are intended to be immutable, prefer the most restrictive collection type possible (e.g., IEnumerable, IReadOnlyList); for return values, prefer IList when transferring ownership of a mutable collection, and otherwise prefer the most restrictive option.
|
|
84
|
+
- **Array vs List:** Prefer `List<>` for public variables, properties, and return types. Use arrays when size is fixed and known at construction time, or for multidimensional arrays.
|
|
85
|
+
- **Extension Methods:** Only use when the source is unavailable or changing it is infeasible. Only for core, general features. Be aware they obfuscate code.
|
|
86
|
+
- **LINQ:** Use LINQ for readability, but be mindful of performance in hot paths.
|
|
87
|
+
|
|
88
|
+
## 6. File Organization
|
|
89
|
+
- **One Class Per File:** Typically one class, interface, enum, or struct per file.
|
|
90
|
+
- **File Name:** Prefer the file name to match the name of the primary type it contains.
|
|
91
|
+
- **Folders and File Locations:**
|
|
92
|
+
- Be consistent within the project.
|
|
93
|
+
- Prefer a flat folder structure where possible.
|
|
94
|
+
- Don’t force file/folder layout to match namespaces.
|
|
95
|
+
- **Namespaces:**
|
|
96
|
+
- In general, namespaces should be no more than 2 levels deep.
|
|
97
|
+
- For shared library/module code, use namespaces.
|
|
98
|
+
- For leaf application code, namespaces are not necessary.
|
|
99
|
+
- New top-level namespace names must be globally unique and recognizable.
|
|
100
|
+
|
|
101
|
+
## 7. Parameters and Returns
|
|
102
|
+
- **out Parameters:** Permitted for output-only values; place `out` parameters after all other parameters. Prefer tuples or return types when they improve clarity.
|
|
103
|
+
- **Argument Clarity:** When argument meaning is nonobvious, use named constants, replace `bool` with `enum`, use named arguments, or create a configuration class/struct.
|
|
104
|
+
```csharp
|
|
105
|
+
// Bad
|
|
106
|
+
DecimalNumber product = CalculateProduct(values, 7, false, null);
|
|
107
|
+
|
|
108
|
+
// Good
|
|
109
|
+
var options = new ProductOptions { PrecisionDecimals = 7, UseCache = CacheUsage.DontUseCache };
|
|
110
|
+
DecimalNumber product = CalculateProduct(values, options, completionDelegate: null);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**BE CONSISTENT.** When editing code, follow the existing style in the codebase.
|
|
114
|
+
|
|
115
|
+
*Source: [Google C# Style Guide](https://google.github.io/styleguide/csharp-style.html)*
|