Questions to ask myself before creating a pull request

As a developer I work on different products, in different teams. In nearly every team, the workflow involves using pull requests. New or updated functionality is added to the product only after it has been published in a pull request, reviewed, and approved.

To ensure the quality of my work, I've created a list of questions to ask myself before marking my changes as 'Ready' and creating a pull request. These questions help me deliver better code changes and (hopefully) reduce the amount of feedback when a colleague reviews my work.

Code

  • Is the code readable?
  • Is the code maintainable?
  • Is there duplicate code or logic?
  • Have I implemented code changes in the appropriate classes?
  • When the code contains comments, are they helpfull or should I remove it?
  • Do the new or updated classes and methods have a single responsibility?
  • How is the size of the methods? Is any method too large, and can I split it into smaller, more manageable methods?
  • Have I used appropriate names for classes, methods, and variables? Are the names consistent with the naming conventions used elsewhere?
  • When I updated some code, did other functionality that depended on it still work?
  • When I worked with a regex, is it strict enough? Does the regex help to test all the correct cases?
  • When I added logging to the code, are the log messages clear enough. Does every log message have a correct type (error, warning, info, ...)?
  • Did I use magic numbers (= a value with no clear meaning)? If so, remove it.
  • Did I remove all unused imports?
  • Are all unused classes, methods and variables removed?
  • Did I add null checks in the appropriate places?
  • Did I format the code correctly, according to the code standard of the team?

Tests

  • Is the new or updated code supported by working (unit) tests?
  • Is there enough testcoverage?
  • Are the new or updated tests small and clear to understand?

Frontend

  • Is the view responsive? Does it work and look good on every screen size?
  • Is the view optimized for usability on smaller screens? For example are buttons large enough to be touchable?
  • Are the correct labels and other texts (translations) visible in the view?
  • Is the tab order of the input fields in a form logical?
  • When the product is a public website, did I apply the correct SEO techniques?

Performance

  • Are my changes going to make a bad impact on performance, for example when it must handle a large amount of data?
  • When a frontend client application makes an HTTP request, could a timeout occur, and what would be the consequences?

Security

  • When could an (exception) error be visible to the user? Does it contain any information that could be exploited by a user with malicious intent?
  • When the product is a web application with API, are the correct (validation) checks in place in both the frontend and backend?
  • Do all input fields, in the frontend, have the correct (validation) checks and are they clear for the user?
  • Are the correct permission checks in place to ensure that a user without the necessary permissions cannot access the functionality?
  • Have I taken all necessary steps to ensure that incorrect data cannot be added to the database in any way through the web application?