Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Introducing colobot-lint
For the last two weeks, I've been working on a static analysis tool based on Clang's libtooling that would help us in refactoring Colobot code. The project, which I named colobot-lint, is now pretty much complete in how I envisioned it, and stable enough, so the time has come to officially introduce it.

Colobot-lint uses Clang's extensive API to perform a range of checks on C++ code, compiled to AST (abstract syntax tree). Based on information contained in AST and associated contextual data, it can detect things such as:
 - uninitialized local variables
 - uninitialized fields in structs/classes
 - uses of new/delete operators
 - functions written in legacy C style (variable declarations only at the beginning of function)
 - occurences of TODO comments
 - style checks (variable/function/class naming, etc.)

Project repository is here:
Full list of checks performed is documented here:

For the time being, I have set up my own Jenkins CI server at with jobs running colobot-lint on current Colobot code (dev branch). Later, we can move these jobs to our main Jenkins server.

There are two jobs listed in Main page:
 - colobot-lint-build builds colobot-lint tool itself
 - colobot-lint-run runs colobot-lint on latest dev branch of Colobot

The results are visualized using cppcheck plugin in a form of graph ( and list of issues ( You can click on link in "Line" column to see source code location, for example:

As you can see, there is currently quite a lot of detected issues, but the point is not to fix them all at once. Instead, as in every refactoring effort, we should try to lower the number of issues step by step, and not introduce new issues. Each issue is also marked with category like error, warning or style, based on what I felt are most important issues.

Some improvements are still needed, for example better way to display results, as the Jenkins cppcheck plugin is quite limited. I've listed some ideas for improvement as issues here: You are welcome to report any bugs or your propositions for improvements.

Now I think the tool can be safely described as finished, at least unless we find more rules to add to it.

For some time now, the tool has been running on our main Jenkins server: My old server now serves as slave to run the colobot-lint jobs.

I also moved the repository on github from my account to our organization:, as I think it should be included there along with other tools that we have developed.

Forum Jump:

Users browsing this thread: 1 Guest(s)