You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,9 @@ This is a crowdfunding platform for games with a developer theme. The applicatio
13
13
- When adding new functionality, make sure you update the README
14
14
- Make sure all guidance in the Copilot Instructions file is updated with any relevant changes, including to project structure and scripts, and programming guidance
15
15
16
-
### Global language guidance
16
+
### Code formatting requirements
17
17
18
-
-Use type hints for function parameters and return values for all languages which support them
18
+
-When writing Python, you must use type hints for return values and function parameters.s- Every function should have docstrings or the language equivalent- Before imports or any code, add a comment block that explains the purpose of the file.
Copy file name to clipboardExpand all lines: docs/3-custom-instructions.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,12 +80,12 @@ As highlighted previously, **copilot-instructions.md** is designed to provide pr
80
80
1. Return to your codespace.
81
81
2. Open **.github/copilot-instructions.md**.
82
82
3. Explore the file, noting the brief description of the project and sections for **Code standards**, **Scripts** and **GitHub Actions Workflows**. These are applicable to any interactions we'd have with Copilot, are robust, and provide clear guidance on what we're doing and how we want to accomplish it.
83
-
4. Locate the **Global language guidance** section, which should be around like 16. Note how it contains a note to use type hints. That's why we saw those in the code generated previously.
83
+
4. Locate the **Code formatting requirements** section, which should be around like 16. Note how it contains a note to use type hints. That's why we saw those in the code generated previously.
84
84
5. Add the following lines of markdown right below the note about type hints to instruct Copilot to add comment headers to files and docstrings:
85
85
86
86
```markdown
87
-
- Include a comment block at the top of each new file to describe what it does
88
87
- Every function should have docstrings or the language equivalent
88
+
- Before imports or any code, add a comment block that explains the purpose of the file.
89
89
```
90
90
91
91
6. Close **copilot-instructions.md**.
@@ -121,6 +121,7 @@ As highlighted previously, **copilot-instructions.md** is designed to provide pr
121
121
```
122
122
123
123
10. Also note how the existing code isn't updated, but of course we could ask Copilot to perform that operation if we so desired!
124
+
124
125
11.**Don't implement the suggested changes**, as we will be doing that in the next section.
125
126
126
127
From this section, you explored how the custom instructions file has provided Copilot with the context it needs to generate code that follows the established guidelines.
@@ -172,6 +173,10 @@ We want to create a new endpoint to list all publishers, and to follow the same
172
173

173
174
174
175
15. Copilot generates the files. Notice how it generates updates across multiple files, like **publishers.py** and **test_publishers.py**
176
+
177
+
> ![NOTE]
178
+
> Note that the code generated may diverge from some of the standards we set. AI tools like Copilot are non-deterministic, and may not always provide the same result. The other files in our codebase do not contain docstrings or comment headers, which could lead Copilot in another direction. Consistency is key, so making sure that your code follows the established patterns is important. You can always follow-up in chat and ask Copilot to follow your coding standards, which will help guide it in the right direction.
179
+
175
180
16. After reviewing the code, select **Keep** in Copilot Chat to accept the changes.
176
181
17. Open a terminal window by selecting <kbd>Ctl</kbd>+<kbd>\`</kbd>.
177
182
18. Run the tests by running the script with the following command:
0 commit comments