Speed up reviews with autocomplete snippets

When reviewing themes for the WordPress.org theme directory, you will find that there are mistakes that are more common than others. This means that we often use the same type of messages in different tickets and reviews.

We can use this fact to make our reviews faster. I have done so many reviews that many of the texts are in my muscle memory, but I still save some of my reviews with the purpose of being able to copy paste them into other reviews later.

But we can improve on this further by using the code editor of our choice to add the most common texts for us.

I use VS code, and I followed these instructions to create my own review specific snippets:

In VS Code, go to File, Preferences, and select user Snippets

Now you can choose to create a snippet for a specific language, or a global snippet file. I write my reviews in a simple .txt file so I created a global file.

Documentation for how to create a new snippet is included in the file header of the new file, which made it very easy.

Place your global snippets here.
Each snippet is defined under a snippet name and has a scope, prefix, body and description. 
Add comma separated ids of the languages where the snippet is applicable in the scope field. 
If scope is left empty or omitted, the snippet gets applied to all languages. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. 
Possible variables are: 
$1, $2 for tab stops, $0 for the final cursor position, 
and ${1:label}, ${2:another} for placeholders. 
Placeholders with the same ids are connected.

Example:
"Print to console": {
	"scope": "javascript,typescript",
 	"prefix": "log",
 	"body": [
 		"console.log('$1');",
 		"$2"
 	],
 	"description": "Log output to console"
 }

I decided not to use a scope, here is an example of one of my custom snippets:

"Missing license": {
	"prefix": "missing license",
	"body": [
	"Themes are required to be 100% GPL compatible.",
	"Reviewers can not confirm that a theme is GPL compatible unless all the license information is included in the theme.",
	"Missing license information for:",
	"(Placeholder: include additional information like a script name or image used in screenshot)",
        "$0",
	],
	"description": "Missing license information for included assets."
},

So when I write my review, all I need to do to add the information about the missing license is to start typing “license” or “missing” and press enter.

Here is the first iteration of the file: Download.

Things to consider when using underscores

I use underscores as a base for my WordPress themes, and many -if not most -themes submitted to the WordPress.org’s theme directory are based on it as well.

But there are some typical mistakes that we see frequently in underscores based themes:

Using old versions
Don’t use old versions of underscores, since they may contain references and fall backs for older functions. Always use a fresh copy.

Forgetting to update the readme files
Underscores comes with two readme files, one .txt and one markdown.
Depending on where you downloaded it from and whether or not you used the advanced option on underscores.me, you need to update these files.
Otherwise your readme files will not be about your theme, and they will read something like:
Contributors: automattic
_s
===
Hi. I'm a starter theme called `_s`, or `underscores`, if you like. I'm a theme meant for hacking so don't use me as a Parent Theme. Instead try turning me into the next, most awesome, WordPress theme out there. That's what I'm here for.

Imagine the users surprise when they open the readme and find instrutction on how to
1. Search for `'_s'` (inside single quotations) to capture the text domain.

Removing the credit
Some authors remove the credit that says that the theme is based on underscores. Please keep this in the theme. Be fair to other theme authors who has shared their work with you.
Theme name is based on Underscores http://underscores.me/, (C) 2012-2016 Automattic, Inc.
Underscores is distributed under the terms of the GNU GPL v2 or later.

and
== Credits ==
* Based on Underscores http://underscores.me/, (C) 2012-2017 Automattic, Inc., [GPLv2 or later](https://www.gnu.org/licenses/gpl-2.0.html)
* normalize.css http://necolas.github.io/normalize.css/, (C) 2012-2016 Nicolas Gallagher and Jonathan Neal, [MIT](http://opensource.org/licenses/MIT)

Forgetting to update the theme and author URI
I can only imagine that the author was in a bit of a hurry here, but it is not uncommon that authors forget to update the links in style.css and in the footer credit.

Forgetting to update the language file
Authors often add new text strings to their theme but forget to update the language file.
Besides updating the strings, you also need to update the following file information:

# Copyright (C) 2017 Automattic
# This file is distributed under the GNU General Public License v2 or later.
"Project-Id-Version: _s 1.0.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/tags/_s\n"

-If you also choose to include an .mo file, make sure to rename it to the locale.
https://developer.wordpress.org/themes/functionality/localization/

Forgetting to update the text domain or prefix
Sometimes authors who use the search and replace method to change the text domain and prefix of the theme misses a couple of places.

 

 

You don’t need searchform.php

Searchform.php is only needed if you are actually making changes to the default search form.

While reviewing themes submitted to WordPress.org, I often notice that authors are including searchform.php without making any changes compared to the default form.

Other authors are using

add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );

But replacing the search form with a non html5 form. This is unneccesary.

The Developer Code reference on WordPress.org explains how get_search_form() first attempts to locate the searchform.php file in either the child or the parent theme, then load it. If it doesn’t exist, then the default search form will be displayed.

get_search_form()