I’ve tried a few tools like cloc to count the lines of code within my cpp project.

However, they are pretty surface level and just count the lines.

Is there anything that is able to show how many lines are for classe, imports, simple aliases, typedefs, and more detailed info like that.

My codebase is using C++ 20 modules and a lot of it is just imports and namespace aliases, so just counting the lines is pretty inaccurate. A lot of the files are simply just 10-20 lines at the header for imports, etc, and then just a small child class with constructors.

Which is to say that it’s >50% “filler” in a lot of files.

If anyone knows any tools for this, ideally FOSS, please let me know. Thanks!

  • BB_C
    link
    fedilink
    arrow-up
    1
    ·
    4 hours ago

    tokei is the tool that came to mind reading your title.

    Getting fancier info depends on the fanciness of the tokenizer used. Maximum fanciness probably requires a full language parser. Info beyond code/tokens requires more than just a parser (language server territory).