Squire

Anyone familiar with developing a large code base knows it is a daunting process. No matter how vigilant you and your team may be, the problem quickly becomes intractable. However, we have found that some of these issues can be easily identified and repaired with the help of a few modest utilities.

Squire is a simple tool built to help us maintain consistency and quality across hundreds of thousands of lines of code by serves as a framework to run intelligent queries on our C++ code base.

Squire

Design Decisions

Squire functions as a reporter — it does not automatically “fix” anything it finds. This simplifies its job immensely. We found this to be the best approach since writing robust code to employ automatic fixes around numerous possible edge cases is extremely difficult. As such, all source code edits are ultimately left up to a developer.

Queries

Duplicate Includes and Forward Declares

Duplicate header includes and forward declares are most likely the result of either a bad merge or programmer error. Thankfully, they are easy to detect and report.

Source Statistics

It’s nice to have a utility to compute the numbers about your code base. Squire can count files, lines, unit tests, and testers. Every so often we like to run this to gauge our progress.