Code review notes

learning the ropes

As always there is a TLDR section highlighted in bold.
These are just my personal notes and some tips and tricks I have picked up from my peers in my current job and naturally very open to any feedback on my topics I post.

Code Reviews


Now, I would normally use the prettier formatter to organize my code, but at my job I was advised not to do that due to some of the code being in a layout that is easier to read and work with. My auto formatter happens to mess it up, so I started to check my code format by eye, which is far from efficient and takes a bit of time ..sometimes. I just felt I had to share why I cannot just use a auto formatter.

Check list

TLDR

  • Use your editor search for console logs and remove ’em
  • Also removed unused code/imports to your project
  • use ESLint and make sure it passes (this is my next post trying to set it up now)
  • Run your unit tests, I’ve had my review approved and be denied by unit tests failing
  • Important make sure your naming conventions make sense so other developers can follow
  • Personally I think it is perfectly fine to leave commented notes on certain methods that are helpful! Such as // This section cleans up the goods and returns so and so
  • Create the PR ( Peer Review/ Merge Request..etc) and go through the comparison. The layout shows exactly where changes have been made and I tend to catch a lot of my syntactical errors at this point.

That’s all I have for now, these tips came from my colleagues and also through my own experiences. Checking is good but checking only once is even better.
Good luck and I hope to hear some comments on this one.

How to merge the latest dev code to your branch

Hello and welcome back there is a TLDR section with steps below…

Ever been working hard on a feature to only realise that there have been some major updates on the Develop branch or even worse depend on a completed feature that is currently on the dev branch (well that is just worse for me in any case)

So you are working on Feat/01 branch which you have branched off develop (a while ago) , but then as you try to merge your code…boomy you get a merge conflict. This does tend to get a bit tricky depending on what sections or components of the app you are working on.

So you need to get your branch up to date with the dev code cause you need it to finish the feature..or you’ll hit some merge conflicts.
To Merge the updated code into your feat/01 branch, how you do that?

Well, via the command terminal. Here are my steps that I would take.

TLDR

// Currently on feat/01 branch
// Step one
git fetch origin // This will get the latest code from the repo
// Step two
git checkout develop // or switch to the branch with the latest code
// Step three
git pull // This will pull the latest code that is on the develop branch
// Step four
git checkout feat/01 // check into the branch you want to merge to
// Step five
git merge develop 

// this will merge develop's latest changes INTO feat/01 branch

There will also probably be some merge conflicts which should be simple to tackle depending on what tools you are using. To resolve merge conflicts I normally use the Visual Studio code text editor to sort out incoming changes(incoming from origin) and current changes(changes from your local) or git tortoise which has a whole ui for merge and resolving conflicts(I know that there are many others for sure). Just go through each conflict step by step and there you have it. you are more or less inline with Develop and you have included all your changes so you can keep on cracking forward.