Getting kdev-clang-tidy into public consumption

Friedrich W. H. Kossebau kossebau at
Mon Aug 6 15:52:31 BST 2018


tl;dr  I adopted kdev-clang-tidy and will do some often-and-early releases 
before proposing inclusion in kdevelop repo.

Inspired by Anton Anikin's work on a Clazy analyzer plugin ( https:// ) and some own increased usage of clang-tidy 
recently I decided to give the kdev-clang-tidy plugin a look, which has been 
idling for more than a year in playground now.

Found that it is working at least for running clang-tidy on files and 
presenting the result in the problem reporter. Though then it had some loose 
ends in the config UI as well as one big unfinished review request for some 
overhaul of the config logic.
So I decided to just cut off all the loose ends and am currently seeing to 
turn the plugin into something which works stable with a first minimal feature 
set, and push that out as a first release, so it might be already delivered 
via (rolling) distributions and be useful to early adaptors (besides those 
running from development branch anyway :) ).

The first initial release should still happen this week, targetting KDevelop 
5.2 installations as an optional add-on. Further releases would then happen 
No translation string freezes for the first few releases, to allow really 
quick turn-around and flexibility on strings, later-on with >1 week feature 
release cycle will then turn to normal handling, with a week's freeze and 

Initial feature set:
* run clang-tidy on a single file, with result shown in Problems toolview,
  invokable from file context menus and main menu (Analyzer section)
* per-project config UI:
  * free field for additional cmdl parameters to clang-tidy
  * checkbox whether to include system headers in check
  * toggle between using .clang-tidy files or options in the config UI:
    * header filter reg expr
    * opt-in list of checks

Planned features (in rough order of execution):
* tree-like display of checks, allow selecting of groups (matching the 
wildcard/masking logic of the -checks= parameter)
* warning about missing compilation database
* fix-its (initial code already has some parsing code for the patches created 
by clang-tidy, need to look e.g. into the grep tool to see how to apply these 
following the kdevplatform way)
* running on more than one file, e.g. the whole project
* globally defined sets of checks, for reuse between projects and use for 
specific code analyze work
* folder-specific clang-tidy settings
* being an editor for .clang-tidy files, for seamless integration between IDE-
based and console-based usage of clang-tidy

Long term I think kdev-clang-tidy could be added to the kdevelop repo together 
with the kdev-clazy plugin, to join their cppcheck buddy.
At least until somebody implemented any possible integration of these clang-
based analysers with the clang-parser of the clang language plugin. Which 
though might be more challenging, so the current explicit analyzer plugins 
serve as intermediate utilities.
For ensuring the existance of the needed compilation database I have already 
started to sketch some additional interface ICompilationDatabaseProvider, 
which e.g. CMakeManager would then implement, to allow the analyzers to check 
for the generation of that database and offering the user to turn it off via a 
single click.

After the initial release it might also make sense to add kdev-clang-tidy to 
the appimage, so more people have access to it.

Looking forward for any cooperation :)

Now, your comments?


More information about the KDevelop-devel mailing list