Skip to content

Make Your Code Pretty

Posted on:August 30, 2013code3 min read

All too often I'll see code that'll make me gag.

There's inconsistent indentation, no linting, and trailing white space run amok. It won't effect how your code is executed but it makes for an unwholesome experience for whoever reads your code.

I won't place the blame for these types of code 'errors' on the programmer. If you don't have the proper software installed they are extremely hard to track. I don't expect anyone to be hand-combing through their code, looking for any extraneous white-space or instances where they forgot to remove a trailing function argument that is no longer used.

What I expect is for programmers to install the proper tools into their code/text editors to do it for them.

In the instance of Sublime Text there is a holy marriage of two packages that will ensure that every piece of code you write is beautiful.


trailing-spaces Just like shining a black light into dusty corners, Trailing Spaces will highlight every instance of extraneous whitespace. In glorious neon pink, you'll see all your old code come alive in ways you never thought possible.

After you install this package you'll understand why I get so upset when I see trailing white spaces left in code. Whereas they are invisible without this package, they are a hideous eye sore with it. Lighting ablaze every offender in its neon pink glare.


linting Instantaneous linting is a friend you wish you had years ago. Keeping you honest with each line of code you write, SublimeLinter will continuously check your code to see if it is staying inline with best coding practices. For Python that's PEP8, for JavaScript that's JSHint. Along with best practices it'll also point out when you're doing something wrong.

It's a loving whisper that alerts you that you left a trailing argument in a function you wrote. You needed that argument parameter before, but after a quick refactor it became unused. SublimeLinter is there to kindly point these things out.


A machine doesn't care if your code is ugly. It doesn't care if there's a bunch of extra whitespace littered throughout the code (unless it's a code sensitive language ;)). It'll read it and execute it the same way.

The person who cares is the one reading your code. They are the one who must hold your code up against an engineer's standard. If that person has their code editor wired up so that every trailing white space comes ablaze in neon pink they're gonna have a bad time.

Keeping code pretty reflects directly on the programmer. It shows if they care about what they write. You're in this gig because you want to be and you care about what you do. So you should do the same for every piece of code that you write.