Skip to content

Commit 8295e91

Browse files
authored
Update copilot-instructions.md
1 parent 4fbdb6e commit 8295e91

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

.github/copilot-instructions.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,37 @@ The repository enforces several checks before code integration:
176176
- Recording issues: Ensure proper test isolation
177177
- Coverage issues: Use `azdev cmdcov` to identify gaps
178178

179+
## Specific Coding Guidelines for PR review
180+
181+
### 1. Rule of help messages
182+
---
183+
applyTo: "src/azure-cli/azure/cli/command_modules/**/_params.py"
184+
---
185+
Firstly, find the help messages, their format is `...help='{help_message}'...` or `....help="{help_message}"...`, {help_message} is the placeholder
186+
Next, you need to review the format of the found help messages according to the following rules:
187+
1. If the help message does not start with a verb, skip this check. Otherwise, check the verb at the beginning of help message
188+
2. Confirm if the verb is in the first person voice, such as the third person voice of 'Enables......' is not compliant
189+
3. Confirm if the verb is in the active voice, such as the passive voice 'Enabled......' is not compliant
190+
191+
### 2. Confirmation for dangerous commands
192+
---
193+
applyTo: "src/azure-cli/azure/cli/command_modules/**/commands.py"
194+
---
195+
Firstly, find the command signature, their format is `... g.custom_command('{command_signature}', ...)...` or `... g.command('{command_signature}', ...)...`, {command_signature} is the command signature
196+
Next, you need to determine whether the command signature is a dangerous operation, such as `delete`, `remove`, `stop` operation which will break or remove resources. If so, You need to suggest adding the flag `confirmation=True`, such as `g.custom_command('{command_signature}', ..., )...`
197+
198+
### 3. Common code best practices
199+
- ​​Use 4 spaces for indentation​​, never mix tabs and spaces
200+
​​- Naming:
201+
(1) Variables/functions: snake_case
202+
(2) Classes: CamelCase
203+
(3) Constants: UPPER_CASE_WITH_UNDERSCORES
204+
- ​​Surround operators with spaces​​ (x = y + 1), except in function parameters
205+
- ​​Avoid extraneous whitespace​​ in brackets, before commas/colons
206+
- ​​Handle exceptions explicitly​​ using try-except blocks
207+
- ​​Break long expressions​​ using parentheses alignment or hanging indents
208+
​​- Use blank lines​​: two between top-level definitions, one between methods
209+
179210
## Important Notes for Agents
180211

181212
1. **ALWAYS use azdev**: Never use the deprecated `dev_setup.py` script
@@ -186,4 +217,4 @@ The repository enforces several checks before code integration:
186217
6. **Incremental testing**: Use module-specific tests during development, not full suite
187218
7. **Network resilience**: Be prepared for pip timeout issues and retry with longer timeouts
188219

189-
This repository has complex build requirements but following these instructions will minimize exploration time and avoid common pitfalls. The development workflow is well-established through azdev tooling.
220+
This repository has complex build requirements but following these instructions will minimize exploration time and avoid common pitfalls. The development workflow is well-established through azdev tooling.

0 commit comments

Comments
 (0)