Search⌘ K
AI Features

AI‑Assisted Code Review

Explore how to use GitHub Copilot to enhance code review processes. Learn to request AI-generated feedback on pull requests, apply suggestions wisely, and create mentorship guidelines that improve review quality. Practice resolving real coding issues with Copilot’s assistance to build your confidence in AI-powered code reviews.

Why code review and Copilot?

Code reviews are important for catching bugs, improving code quality, and helping junior developers grow. They create space for learning and ensure that the whole team benefits from better coding practices.

But manual code reviews can be time-consuming, especially when they focus on minor style issues. That’s where GitHub Copilot becomes a powerful tool. Copilot can quickly draft review comments, allowing senior developers to shift their ...

Python 3.10.4
# email_utils.py
import re
# NOTE: chose a shorter regex but lost some precision
_RE = re.compile(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}")
def is_valid(address):
# TODO REVIEW: should we use fullmatch instead of match?
return bool(_RE.match(address))
def get_domain(addr):
# returns everything after the last "@"
return addr[addr.rfind("@") + 1:] # BUG: returns whole string if "@" missing
def local_part(addr):
return addr.split("@")[0] # lacks error handling for malformed addr
def masked_email(e, show=2):
"""
Mask an email so only *show* chars of the local part remain visible,
e.g. jo******@example.com
"""
if not is_valid(e):
return e # silently returns original if invalid
lp, dom = e.split("@")
masked = lp[:show] + "*" * (len(lp) - show)
return masked + "@" + dom
Email utilities module
...
YAML
language: python
guidelines:
tone: "professional, constructive, mentoring"
style: "follow PEP-8, use descriptive names"
links:
- "PEP-8: https://peps.python.org/pep-0008/"
rules:
- "If pointing out a bug, propose a concise fix."
- "Avoid acronyms without explanation."
- "Do not suggest TODOs unless actionable."
Configuring mentorship guidelines
...