DEV Community

Cover image for Meet Betty, The C code linter
Dave Mcsavvy
Dave Mcsavvy

Posted on

Meet Betty, The C code linter

I need to make this clear - "betty frustrates me!".

Over the time though, I've learnt to avoid her and I'll tell you how, but first...

Who Is Betty

Betty is actually a very real person 🤯, according to Wikipedia...

Frances Elizabeth Holberton was an American computer scientist who was one of the six original programmers of the first general-purpose electronic digital computer, ENIAC. The other five ENIAC programmers were Jean Bartik, Ruth Teitelbaum, Kathleen Antonelli, Marlyn Meltzer, and Frances Spence.

But seriously, this isn't the Betty we'll be talking about today.
Betty is a Holberton-style C code checker written in perl.

Now there's some explanation needed for the above sentence, so I'll start with...

Holberton

Holberton is a computer science school founded in silicon valley (that's all you get 😴)

Code Checker

Also known as linter.
Lint, or a linter, is a static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious constructs.

This means that Betty does not have to run or compile your C code before she detects potential errors and wrong styles.

Perl

It's just another programming language like C.
Hold on! So Betty is basically a program in one language trying to detect errors in another language 🤦🏾‍♂️


Now that you know Betty, how do you use Betty?

I'm assuming you already have Betty installed. If you don't, checkout the installation guide here

How to summon Betty

The usage is basically just

betty FILE...
Enter fullscreen mode Exit fullscreen mode

Where FILE... means 1 file or more.
Once you run Betty like this, Betty would enter each file you specified and do a series of checks. Here is a list of the things Betty checks for

  • Indentation

  • Length of each line

  • Placement of braces {}

  • Placement of spaces

  • Naming of variables, functions, structs...

  • Length of functions 🤨

  • Commenting

  • Macros & Enums

  • Header files

You can find exhaustive information on Holberton-style code here, so you don't fall a victim of Betty as I did 😂😭

Top comments (1)

Collapse
 
jerm014 profile image
jerm014

Holberton School was founded in 2015 in San Francisco. The Betty linter was originally written decades before the school was started. They likely chose the name for the school after writing the curriculum and deciding to use the Betty package as a style and documentation checker.