I don’t normally do retrospectives for each year for products, posts, work, or anything.
Given that I didn’t write as much as I have in years passed, I thought I’d share what the most popular articles I’ve shared over the last year in hopes of both of surfacing some older content but also setting the tone for the coming year.
TL;DR: There are a few PHP Code Sniffer extensions for Visual Studio Code. The one I prefer is PHP Sniffer & Beautifier by Samuel Hilson. Here’s where to get it and how to configure it.
Though this isn’t directly related to the material I’m writing about in my series on Ray on WordPress, it’s relevant enough to share at this point because:
- the series is only going to include more code and i use this extension for writing said code,
- over the last few months, I’ve found this extension to be really good in comparison to others that are available.
There are some other ones out that that are really good, and I’ve used them, but this is the one I’ve settled on using.
A few years ago, I wrote a post about Setting Up PHP CodeSniffer in Visual Studio Code (and I’ve recently updated it, too).
But it’s been four years since that post was originally written and, in that time, a lot can change in terms of how we write code.
Four years is roughly an Internet Age, isn’t it?
Anyway, the basic points of that article still stand, but if you’re working on a variety of projects and some of them require different configurations, settings, and standards, then the way you go about installing and configuring PHP CodeSniffer may be different than how you configure it on a system-level.
So if you’re in that position, here’s how you can configure PHP CodeSniffer on a per project basis using Visual Studio Code.
In previous posts, I’ve talked a bit about Visual Studio Code, and though I’ve tried a variety of other editors, I keep coming back to this particular IDE.
If you use any linters, though, you’ll find that one of the things each will talk about is the amount of whitespace that should exist before a given line of code.
So if you’re using Visual Studio Code, these are the extensions and the settings I recommend for making sure your code is up to par with whatever code quality tools you’re using.
I’m obviously a big fan of using coding standards whenever you’re writing server-side code (regardless of it being WordPress, PSR2, or whatever else – as long as you’re using something, I think it’s a good thing).
In this post, I’ll walk through the process of getting it setup in Visual Studio Code.