Le guide est inspiré par Playbook pour la réussite des systèmes d'ingénierie (ESSP) de GitHub, qui recommande des stratégies et des indicateurs pour améliorer les systèmes d'ingénierie.
Si vous démarrez un déploiement de Copilot, nous vous recommandons de définir vos objectifs, de planifier votre déploiement en conséquence et de communiquer clairement les objectifs au personnel. Consultez Atteindre les objectifs d’ingénierie de votre entreprise avec GitHub Copilot.
1. Identify barriers to success
La première étape recommandée par l’ESSP consiste à développer une compréhension claire des obstacles empêchant les améliorations de votre entreprise. En comprenant votre situation actuelle, vos objectifs futurs et les obstacles qui vous empêchent de progresser, vous pouvez garantir que les changements apportés seront ciblés et efficaces.
Teams often experience delays in merging pull requests due to lengthy review cycles. These delays often stem from:
- Complex code changes that are difficult to understand
- Inconsistent code formatting that makes reviews challenging
- A general lack of context provided with the changes
- Social factors that contribute to slow or hard-to-address reviews
Reviewers can also easily miss small errors that may lead to production issues.
This leads to bottlenecks in the development process and slows down the overall delivery and quality of features.
2. Evaluate your options
L’étape suivante consiste à évaluer et à accepter des solutions pour résoudre les obstacles que vous avez identifiés à l’étape 1. Dans ce guide, nous allons nous concentrer sur l’impact que GitHub Copilot peut avoir sur l’objectif que vous avez identifié. N’oubliez pas que les lancements réussis d’un nouvel outil nécessitent également des modifications apportées à la culture et aux processus.
Vous allez exécuter des essais de nouveaux outils et processus avec des groupes pilotes pour recueillir des commentaires et mesurer le succès. Pour les ressources de formation et les indicateurs de performance à utiliser pendant les essais, vous pouvez consulter le 3. Sections Implémentez les modifications et Indicateurs de performance à surveiller.
How Copilot can help
GitHub Copilot offers a suite of features designed to accelerate the pull request review process, enhance code quality, and improve collaboration, ultimately leading to faster merge times.
By leveraging Copilot's capabilities, teams can streamline their workflows, reduce friction, and ensure consistent, high-quality code.
Generates complete and helpful PR summaries
Copilot can automatically generate clear and concise PR summaries, saving developers time and ensuring that the purpose and changes of the PR are easily understood by reviewers. This reduces the likelihood of misunderstandings and speeds up the review process.
Assists reviewers during their review process
GitHub Copilot can be used as a powerful PR review companion.
- Copilot can help explain complex code changes so that reviewers more quickly understand what the PR is contributing.
- Copilot can provide repository-wide, context-aware suggestions and potential code improvements directly within the pull request review interface on GitHub, helping reviewers catch potential issues and offer constructive feedback more efficiently.
- Copilot can help reviewers draft and write clear, consistent, and effective review comments.
Reviews based on organization guidelines
- Copilot can review code changes in your IDE before opening a pull request, or be assigned as reviewer to a pull request.
- With rulesets, you can set up Copilot to systematically review pull requests based on custom criteria.
- With coding guidelines for reviews (Copilot Enterprise only), Copilot can enforce organizational coding standards and best practices, automatically flagging potential violations and suggesting fixes.
These features ensure consistency across the codebase and help you catch errors early in the development process, reducing the need for manual code reviews and saving time for developers and reviewers.
Suggests code fixes
Based on a pull request review comment, Copilot can help pull request authors quickly implement the required code changes to resolve the review.
Cultural considerations
En plus de votre déploiement de GitHub Copilot, vous devez également traiter tous les facteurs sociaux ou culturels qui pourraient vous empêcher d’atteindre vos objectifs.
Les exemples suivants sont tirés de la section « Anti-modèles » de l’ESSP.
- Teams might wait too long to release, deploying large batches of code at once. This could be caused by a fear of destabilization with frequent releases, a lack of CI/CD pipeline maturity, or strict compliance requirements.
- Developers might spend too long perfecting code or adding unnecessary features. This could be caused by a culture of perfectionism or a lack of effective prioritization.
- Developers might build overly complex solutions for simple problems. This could be caused by a desire to future-proof unnecessarily, or pressure to add value through complexity.
3. Implement changes
When you've identified the right approach to overcome your barriers, you will scale the solutions you identified. For a successful rollout of a new tool or process, it's important to assign ownership to each part of the rollout, communicate transparently about your goals, provide effective training, and measure your outcomes.
This section provides example scenarios, best practices, and resources for developers. We recommend using this section to plan communications and training sessions to help employees use Copilot in a way that aligns with your goal.
- Create helpful pull request summaries
- Use Copilot as a review assistant
- Add Copilot as a reviewer
- Get help implementing review comments
- Best practices for developers
- Resources
Create helpful pull request summaries
- When creating a pull request, click the Copilot icon in the "Add a description" field, then click Summary.
- Copilot will scan through the pull request and provide an overview of the changes made in prose, as well as a bulleted list of changes with the files that they impact.
- Check you're happy with Copilot's description.
- When reviewers come to your pull request, they'll have all the context they need to leave a review.
Use Copilot as a review assistant
When jumping into a pull request as a reviewer, you can use Copilot to speed up your review.
-
Use Copilot to understand the changes in the pull request.
-
Ask Copilot to summarize the changes made to a file, particularly helpful for longer diffs. You can pick a specific file from the diff by clicking on the top-right corner of the file.
-
For changes in specific lines, highlight the lines you want to better understand and ask Copilot to explain the changes to you. You can highlight a set of lines by clicking on the uppermost line number first, holding your SHIFT key, and then clicking on the lowermost line of the diff.
-
-
Collaborate on your PR review with Copilot. Don't forget to attach the specific file diffs to the conversation before prompting Copilot.
-
You can ask Copilot for its own opinion on the PR changes by asking:
Provide your judgement as a PR Reviewer, both for functional and non-functional aspects that these changes bring
. Note how this prompt asks Copilot to consider both functional and non-functional aspects of the code. -
For your own PR review comments, ask Copilot for a second opinion:
As my peer reviewer on this pull request, give me your feedback on my own review: YOUR-REVIEW-COMMENT. Do you think it's pertinent? Am I missing something?
-
-
Collaborate with Copilot to draft and refine your review comments.
- After planning the review with Copilot, you can ask to list the comments that you should provide:
Make a list of review comments to add to the PR and tell me exactly in which file diff and lines each comment should be added
. - You can also ask Copilot to create a first draft of a review comment you have in mind or refine a comment before you post it:
Help me draft review comments as discussed
orRefine this review comment to make it clear, concise, and actionable
.
- After planning the review with Copilot, you can ask to list the comments that you should provide:
Add Copilot as a reviewer
To reduce review times and merge pull requests faster, use Copilot code reviews systematically: first in the IDE before opening the pull request, then on the PR in GitHub.
Using Copilot code review does not replace the need for human code review. However, following the steps above can help humans complete their reviews faster.
- Developers should request a review of all their changes using Copilot code review before opening a pull request.
- Administrators should set up repository or organization rulesets to automatically add Copilot as a reviewer on any pull request targeting protected branches.
- Team leads should capture their team's standard style and rules and set them as coding guidelines for the organization so that Copilot can leverage them in reviews.
- Ensure your coding guidelines capture a minimum set of styling recommendations that make code more readable, which will help during the pull request review process.
- To reduce the amount of PR review comments due to styling issues, set the same recommendations in Copilot instructions at the repository and organization level. This way, the code generated by Copilot will conform to these guidelines.
Get help implementing review comments
Pull request authors can speed up resolution of PR review comments by quickly implementing fixes with Copilot's assistance.
- For any review comments left by Copilot itself, either commit the proposed fix directly, or edit it in Copilot Workspace before committing.
- For any review comments left by peers, navigate to the file diff related to the PR review comment and attach the diff to a Copilot Chat conversation. Then, copy paste the review comment with a prompt like this:
Suggest a fix for this review comment:
- If you are using VS Code, ask GitHub Copilot in agent mode to implement the required changes from the review comment.
Best practices for developers
Developers should:
- Request Copilot's review in your IDE before pushing to catch and resolve issues early.
- Use Copilot to plan and refine your own PR review comments to help PR authors understand and resolve issues.
- Attach relevant diff context, including specific lines of code, to your conversations with Copilot.
Developers should not:
- Apply Copilot's suggestions without testing.
- Rely solely on Copilot for reviews.
- Neglect code readability.
Resources
- Création d’un résumé de demande de tirage avec GitHub Copilot
- Utiliser la revue de code GitHub Copilot
- Configuration des règles de codage pour la revue de code GitHub Copilot
- Configuration de la revue automatique par Copilot
- Ajout d’instructions personnalisées de l’organisation pour GitHub Copilot
Metrics to watch
Pour évaluer les essais de nouveaux outils et vous assurer que vos déploiements complets offrent des améliorations cohérentes, vous devez surveiller les résultats et apporter des ajustements si nécessaire. En général, nous recommandons de prendre en compte les domaines clés que sont la qualité, la rapidité et la satisfaction des développeurs, ainsi que la manière dont ces domaines contribuent ensemble aux résultats commerciaux.
Voici quelques métriques que nous vous recommandons d’examiner pour évaluer l’impact de Copilot' sur cet objectif spécifique.
- Developer satisfaction: Use developer surveys to measure satisfaction with engineering tooling.
- Pull requests merged per developer: You can use GitHub's
pull request
webhook, ensuringaction
isclosed
and themerged
property insidepull request
object istrue
. - Pull requests lead time: Measure the average length of time between PR creation and merge.