Skip to content

Code review

Joel B edited this page May 12, 2026 · 1 revision

This page explains how code reviews work on Pynventory. At least one other contributor must review your pull request before it can be merged. Reviews catch bugs, improve code quality, and help everyone learn.

Step-by-step review workflow

  1. Read the PR description and linked issue - Understand what the change is supposed to do and why.
  2. Check out the branch locally and test it - Don't just read the diff. Run the code and verify the feature or fix works as described. See Testing a PR locally below.
  3. Review the code on GitHub - Use GitHub's web interface to leave line-specific comments. See Using GitHub's review UI below.
  4. Submit your review - Choose one of three options:
    • Approve - The code looks good and is ready to merge.
    • Comment - You have questions or minor suggestions but no blockers.
    • Request changes - You found issues that must be addressed before merging.

Testing a PR locally

You should always test a pull request on your own machine before approving it.

Using the GitHub CLI (recommended):

gh pr checkout <pr-number>

This fetches the branch and switches to it in one step. Run gh pr list to see open PRs and their numbers.

Using Git directly:

git fetch origin <branch-name>
git checkout -b <branch-name> origin/<branch-name>

Once you have the branch checked out:

  1. Run the app: python -m pynventory.main
  2. Test the feature or fix described in the PR
  3. Run the linter and tests if applicable
  4. When done, switch back to master: git checkout master

Using GitHub's review UI

GitHub lets you highlight specific lines of code and leave comments on them.

  1. Open the pull request on GitHub and click the Files changed tab.
  2. Hover over a line number. A blue + button will appear. Click it to highlight that single line, or click and drag to highlight a range of lines.
  3. A comment box will appear. Write your feedback and click Start a review.
  4. Repeat for any other lines you want to comment on. All your comments are grouped together until you submit.
  5. When you are done, click the Review changes button in the top right. Write a short summary, select Approve, Comment, or Request changes, then click Submit review.

Tips:

  • Use inline comments for specific code questions.
  • Use the summary for overall impressions.
  • If you are unsure about something, ask a question instead of making a statement.

Review checklist

Before submitting your review, ask yourself:

  • Does the app start without errors on this branch?
  • Does the feature or fix work as described in the issue?
  • Are there any obvious bugs, typos, or edge cases?
  • Is the code readable and consistent with the Code style guide?
  • Are variable and function names clear?
  • Is the code well documented where needed?
  • Does the PR only contain changes relevant to the issue?

Who can merge

After approval, the pull request author merges their own pull request unless the team agrees otherwise.

Constructive feedback

Code reviews are about the code, not the person.

  • Be kind and specific in your feedback.
  • Ask questions if something is unclear.
  • Accept feedback graciously.

We are all here to learn and build something useful.

Clone this wiki locally