#code-quality

Code Review Guidelines for better code quality

As all of us know that there is no certain rules when it comes to code review. From my experience I have derived the below mentioned points for enhancing the code quality before the PR submission.

  1. Please follow the PSR standards for nomenclature. (https://www.php-fig.org/psr/)
  2. Please use clean code practices for writing a piece of logic (https://github.com/jupeter/clean-code-php)
  3. Though you will find this rule in PSR but still please use space before and after any operator.
  4. Don’t break indentation.
  5. Rules for declaring a function
  6. Small (not more than 20 lines).
  7. Do specifically one thing.
  8. Use descriptive names as per PSR.
  9. Prefer fewer arguments.
  10. Don’t use flag arguments. Split method into several independent methods that can be called from the client without the flag.
  11. Rules for Commenting
  12. Always try to explain yourself in code.
  13. Don’t be redundant.
  14. Don’t add obvious noise.
  15. Don’t comment out code. Just remove. If it is a working piece of code, please write a proper comment that this is working.
  16. Use as explanation of intent.
  17. Use as clarification of code.
  18. Use as warning of consequences.
  19. Declare variables close to their usage.
  20. Dependent functions should be close.
  21. Similar functions should be close.
  22. Place functions in the downward direction but if it’s a relation please make it on the top of the model file.
  23. Keep lines short.
  24. Return on Negative conditions. Instead of writing the entire section of code in a if condition, return on “!if” condition.
  25. In case of a merge conflict please put a message in the group asking the individuals worked on the same files.
  26. Try to optimize code before creating a PR
  27. Reduce no. of lines of code
  28. Reduce unnecessary variable declaration
  29. If possible break in reusable functions
  30. Below are mentioned the parameters for the code review.
  31. make sure that there are no conflicts
  32. there must not be any debug function open in the updated code.
  33. no (non-usable) commented code
  34. check for non-significant variable name declaration
  35. check for unused parameters in the function declarations.
  36. Check for unused parameters in a function call.
  37. check for unwanted functions declarations
  38. check for PSR rule violations
  39. Always try and search for existing functions before creating a new one.
  40. All the changes are to be made via Git. Under no circumstances FTP is to be used for making required changes.

Most Viewed Posts


Must Read


January 28, 2022

#AppImage #linux

How to Add AppImage Application to Menu in Ubuntu (Linux)

AppImages are the most easiest to run compared.The challenging task is to make the AppImage accessible globally through he system like an installed application (in the menu)

Reading time: less than a minute
How to Add Laravel Pint to VS Code Formatter
June 24, 2022

#code-quality #vscode #laravel-pint #laravel

How to Add Laravel Pint to VS Code Formatter

I have been using the unsatisfactory formatters from a long time. All of them have one thing but lack other. Laravel Pint is one who has it all, combining it with vscode is like proving you laravel project a super power.

Reading time: 2 minutes
March 24, 2021

#express js #node #node js #sequelize #mysql

How to create model association in Sequelize - express JS / Node JS

In the very initial days of my work in Node JS if faced this issue. Though Sequelize provide a great ORM for MySQL but the association within the models is a bit tricky.

Reading time: 2 minutes
December 14, 2021

#database #javascript #sequelize #npx

Sequelize CLI Commands

list of Sequelize CLI commands which comes handy, while working on a project.

Reading time: 1 minute
How to create a progressive web app (PWA) in laravel 5.* and above
July 07, 2019

#functionality #pwa #javascript #laravel

How to create a progressive web app (PWA) in laravel 5.* and above

The progressive web app is the new trend as well as the need for the present time. I hope before getting in the “HOW” part you know what is exactly a PWA

Reading time: 4 minutes
How to Add Laravel Pint to VS Code Formatter
June 24, 2022

#code-quality #vscode #laravel-pint #laravel

How to Add Laravel Pint to VS Code Formatter

I have been using the unsatisfactory formatters from a long time. All of them have one thing but lack other. Laravel Pint is one who has it all, combining it with vscode is like proving you laravel project a super power.

Reading time: 2 minutes
mohammed-samgan-khan

Hi, I am Samgan, I know the adds are bit annoying but i hope you understand. Talking about me, I excel at solving complex problems involving logic and step by step breakdown of the problem. Besides, to develop complex algorithms, I specialize in problem framing, systems design, and product development strategy. Sometimes I also enjoy public speaking.