5 Feb 2021ยท5 min read

Code Quality Challenge - Week 1

#code #quality

Week 1 journal of our Code Quality Challenge.

Day 1 - Clean up your README

Free swag! Ben Orenstein is very kindly offering free stuff for all participants:

For a little extra motivation, I am offering a free swag item from Tuple to all participants who complete the challenge!

As well as the offer of free swag, there are some great tips to help complete the challenge:

  • Much of the time, you will not be able to fully complete a challenge in the time allotted. This is okay.
  • I strongly recommend you attempt each exercise as the first thing you do in your work day.
  • Set a timer for 20 minutes and get to it!

My personal favourite is time boxing 20 minutes. I find time boxing to be a great way to get things done, especially mini tasks like these daily challenges. My plan here is to setup a Pomodoro timer for the daily challenges.

Todays Challenge

Spend 20 minutes improving your README.

Our frontend project README was more or less the stock generated file by Create React App. I updated the README with build, test and deploy instructions. This felt like a worth while challenge and great way to kick off the week ๐Ÿ˜€

Day 2 - Nuke TODO comments

The challenge today is to remove any TODO comments in the code base.

Why do this? Because code is a lousy place to track todos. When a todo lives in your code, it can't be prioritized or scheduled, and tends to get forgotten.

I agree with Ben Orenstein here, there really are better places to track TODO's, your backlog for instance?

I found two TODO comments in the code base, the first outdated and was a simple delete. The second required a small code update that was quicker to fix than add to the backlog.

Thankfully the code base was not full of TODO comments so easy challenge today ๐Ÿ™‚

Day 3 - Get rid of a warning

Today's exercise: get rid of a warning you've gotten used to ignoring.

Easy challenge today, I have a very low tolerance for warning messages, I like to clean them up as I go. The only warning I could find (it was more of an information message) was that a newer version of Storybook was available. I upgraded to the latest version and no conflicts. Happy days.

Day 4 - Excise some unused code

Let's track down some code that's not actually in use (and delete it, naturally).

I see dead code! I'm using Typescript so my editor is pretty good at highlighting dead code, so not a lot of dead code to be found. I did find the odd unused reference and type so still a useful challenge. Deleting code is so satisfying even if its not as much code as I would like ๐Ÿ™‚

Day 5 - Trim your branches

The challenge today is to clean up old tracking branches that have been left in your local git repo.

You can list old branches with:

git branch -r

You can then delete the old branches with:

git remote prune origin --dry-run

If you're happy with the results remove the --dry-run switch to run the actual delete.

I found this to be a useful challenge, I hadn't realised how many old branches I had lying around. It's much easier now to list and switch between branches.

Week 1 done

It's been a useful week of mini challenges and a great way to start the day. I've found all the challenges useful but my favourite was Day 3 - Get rid of a warning, I do enjoy deleting code.

Looking forward to next week, see you then!