Skip to content

Commit 78a1b5f

Browse files
Copilotzccrs
andauthored
docs: Add organization-wide GitHub Copilot instructions (#773)
* Initial plan * docs: Add organization-wide GitHub Copilot instructions Co-authored-by: zccrs <13449038+zccrs@users.noreply.github.com> * docs: Convert to Chinese-only and use generic year references Co-authored-by: zccrs <13449038+zccrs@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: zccrs <13449038+zccrs@users.noreply.github.com>
1 parent f8e3fd8 commit 78a1b5f

1 file changed

Lines changed: 203 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
<!-- SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
2+
SPDX-License-Identifier: GPL-3.0-or-later -->
3+
4+
# linuxdeepin 组织的 GitHub Copilot 指导
5+
6+
> **注意**: 这些是适用于 linuxdeepin 组织所有仓库的组织级默认指导。各个仓库可以使用特定仓库的指令来补充这些指导。
7+
8+
---
9+
10+
## 1. 双语代码审查评论
11+
12+
**要求**: 所有代码审查评论必须同时提供中英文双语版本。绝不能只使用英文。
13+
14+
### 格式模板
15+
16+
```
17+
[English comment describing the issue or suggestion]
18+
19+
[Chinese comment - 对问题或建议的中文描述]
20+
```
21+
22+
### 示例
23+
24+
```
25+
This function should handle null inputs to prevent potential crashes.
26+
27+
此函数应处理空输入以防止潜在的崩溃。
28+
```
29+
30+
---
31+
32+
## 2. SPDX 版权头验证
33+
34+
**要求**: 在审查代码更改时,自动检查 SPDX 版权头的日期格式是否正确。
35+
36+
### 所需格式
37+
38+
```cpp
39+
// SPDX-FileCopyrightText: YYYY[-YYYY] UnionTech Software Technology Co., Ltd.
40+
// SPDX-License-Identifier: <appropriate-license>
41+
```
42+
43+
对于其他文件类型(如 CMake、Python、Shell 脚本):
44+
45+
```cmake
46+
# SPDX-FileCopyrightText: YYYY[-YYYY] UnionTech Software Technology Co., Ltd.
47+
# SPDX-License-Identifier: <appropriate-license>
48+
```
49+
50+
### 验证规则
51+
52+
#### 对于新文件
53+
54+
- **必须**包含带有当前年份的 SPDX 头
55+
56+
**示例:**
57+
```cpp
58+
// SPDX-FileCopyrightText: <当前年份> UnionTech Software Technology Co., Ltd.
59+
// SPDX-License-Identifier: GPL-3.0-or-later
60+
```
61+
62+
#### 对于修改的文件
63+
64+
**情况 1**: 文件在与修改相同的年份创建 → 使用单年份格式
65+
66+
```cpp
67+
// SPDX-FileCopyrightText: <当前年份> UnionTech Software Technology Co., Ltd.
68+
```
69+
70+
**情况 2**: 文件在更早的年份创建 → 使用年份范围格式 (YYYY-YYYY)
71+
72+
- 第一个 YYYY = 文件创建年份
73+
- 第二个 YYYY = 最后修改年份
74+
75+
```cpp
76+
// SPDX-FileCopyrightText: 2023-<当前年份> UnionTech Software Technology Co., Ltd.
77+
```
78+
79+
**重要**: 只有当年份不同时才使用范围格式 (YYYY-YYYY)。如果年份相同,使用单年份格式。
80+
81+
### 检查内容
82+
83+
提醒开发者如果:
84+
85+
1. ❌ 新文件缺少 SPDX 头
86+
87+
2. ❌ 新文件的年份不正确(不是当前年份)
88+
89+
3. ❌ 修改的文件未将年份更新为当前年份
90+
91+
### 审查评论示例
92+
93+
```
94+
Please update the SPDX copyright header to include the current year. Since this file
95+
was created in 2023 and is being modified now, it should use the year range format:
96+
// SPDX-FileCopyrightText: 2023-<当前年份> UnionTech Software Technology Co., Ltd.
97+
98+
请更新 SPDX 版权头以包含当前年份。由于此文件创建于 2023 年并在当前被修改,
99+
应使用年份范围格式:
100+
// SPDX-FileCopyrightText: 2023-<当前年份> UnionTech Software Technology Co., Ltd.
101+
```
102+
103+
---
104+
105+
## 3. 双语提交消息格式
106+
107+
**要求**: 所有由 Copilot 生成的提交消息都必须遵循以下双语格式。
108+
109+
### 模板
110+
111+
```
112+
<type>: <English summary>
113+
114+
<English detailed description>
115+
- Key change 1
116+
- Key change 2
117+
118+
Influence:
119+
1. <Impact point 1>
120+
2. <Impact point 2>
121+
3. <Testing recommendation>
122+
123+
<type>: <中文摘要>
124+
125+
<中文详细描述>
126+
- 关键变更 1
127+
- 关键变更 2
128+
129+
Influence:
130+
1. <影响点 1>
131+
2. <影响点 2>
132+
3. <测试建议>
133+
```
134+
135+
### 提交类型
136+
137+
| Type | 描述 |
138+
|------|------|
139+
| `feat` | 新功能 |
140+
| `fix` | 问题修复 |
141+
| `docs` | 文档更改 |
142+
| `style` | 代码风格/格式化 |
143+
| `refactor` | 代码重构 |
144+
| `perf` | 性能优化 |
145+
| `test` | 测试添加/修改 |
146+
| `chore` | 构建/工具变更 |
147+
148+
### 完整示例
149+
150+
参考来自 linuxdeepin/treeland 仓库:
151+
152+
```
153+
fix: Correct typo in variable name from wpModle to wpModel
154+
155+
Fixed variable name typo throughout the codebase where "wpModle"
156+
was incorrectly spelled instead of "wpModel". This change ensures
157+
consistency in variable naming and improves code readability.
158+
Additionally, temporarily disabled the smart cascaded placement
159+
functionality by adding an early return statement for further
160+
development.
161+
162+
The typo correction affects multiple workspace-related functions
163+
including surface placement, preview management, and active surface
164+
tracking. While the variable name change is purely cosmetic, the early
165+
return in placeSmartCascaded indicates this feature is being reworked.
166+
167+
Influence:
168+
1. Verify workspace surface management functions work correctly after
169+
variable name changes
170+
2. Test surface placement and preview functionality
171+
3. Check that active surface tracking operates as expected
172+
4. Confirm no regression in workspace model operations
173+
174+
fix: 修正变量名拼写错误,将wpModle改为wpModel
175+
176+
修复了整个代码库中变量名拼写错误,"wpModle"被错误地拼写为"wpModel"。此更
177+
改确保了变量命名的一致性并提高了代码可读性。此外,通过添加早期返回语句暂
178+
时禁用了智能级联放置功能以便进一步开发。
179+
180+
拼写更正影响了多个工作区相关功能,包括表面放置、预览管理和活动表面跟踪。
181+
虽然变量名称更改是纯外观上的,但placeSmartCascaded中的早期返回表明此功能
182+
正在重新开发。
183+
184+
Influence:
185+
1. 验证变量名称更改后工作区表面管理功能是否正常工作
186+
2. 测试表面放置和预览功能
187+
3. 检查活动表面跟踪是否按预期运行
188+
4. 确认工作区模型操作没有回归
189+
```
190+
191+
---
192+
193+
## 总结
194+
195+
这些指导确保:
196+
197+
1. ✅ 所有代码审查对英语和中文使用者都易于理解
198+
199+
2. ✅ 版权头得到正确维护并保持最新
200+
201+
3. ✅ 提交消息以两种语言提供全面的上下文
202+
203+
通过遵循这些指导,我们在所有 linuxdeepin 项目中保持一致性和清晰度。

0 commit comments

Comments
 (0)