Code Quality Challenge - Week 3
Third week of the Code Quality Challenge, half way! We’re not counting the weekend days, so we jump to Day 15.
Day 15 - Improve one name
Improve one name today. Any name.
It can be a class name, a method name, a variable name, a constant name, a filename, anything.
I was working on a component that’s primary purpose had changed, so this was perfect timing. Nice easy challenge to ease us into the week 😀
Day 16 - Audit your dependencies
Crack open your Gemfile, package.json, setup.py, or whatever file your language/dependency manager uses.
Give it a slow scan. Ask yourself:
Do you still need everything in there?
Does anything need to be updated?
Can you reduce a production dependency to a development/test one?
An easy check for vulnerabilities is npm audit:
$ npm audit found 0 vulnerabilities
All good there 😀
Now lets take a look at the the package.json...
npm remove @fortawesome/fontawesome-svg-core @fortawesome/free-regular-svg-icons @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome
Nice, I enjoy removing dependencies as much as deleting code.
Day 17 - Tidy your PRs/Issues
Let's go extra meta today.
Please spend 20 minutes tidying up your PRs/issues/tickets/whatever.
If something is irrelevant, close or delete it.
Lets take at look at Git...
0 Pull requests 0 Issues 0 Tickets
Not much to do there, I'll try some backlog clean up instead.
I managed to find one old bug that had been fixed but not updated so I set that for Review.
Ben Orenstein offers a tip here that did come in useful:
I recommend working from oldest to newest.
As always, remember that the point isn't to clean up all the things, it's to spend 20 minutes chipping away at them.
Day 18 - Investigate long parameter lists
Do a search through your project for long parameter lists, where long is defined as more than three parameters.
Ben offers a naive regex to find single-line method calls with at least four parameters:
This was useful for finding long parameter lists in the code.
The long parameter list code I did find was mostly library calls which I couldn't do much about so not much success today. I put this down to not liking long parameter lists so its not something I tend to do.
Day 19 - Automate a repetitive action
Please spend 20 minutes automating/systematizing some action that you perform repetitively.
Our current deploy to production process is a very manual process. It involves logging into GitLab, merging branches and creating Tags to kick off the deploy. I'd love to automate it, this is going to be a worthwhile challenge!
I didn't get the whole process automated in the 20 minutes but I did research the creation of Tags from the git command line which is going to allow me to automate the deploy.
I'll continue this challenge during our next deploy that will allow me to automate the tag creation scripts.
Week 3 done ✓
My favourite task this week was Day 19 - Automate a repetitive action, automated deploy is going to be a great time saver 😀