XAMPPRocky / tokei_rs

The tokei.rs server code.
Apache License 2.0
55 stars 11 forks source link

Badge: Filtering by C++/C++ Header lines not working #268

Closed CramBL closed 7 months ago

CramBL commented 7 months ago

Hi, counting C++ lines of code seems to be broken (for generating badges).

I use the popular fmtlib as the first example, which used .h for C++ header files (not supported in your languages.json) and uses .cc for C++ source files which IS supported in languages.json.

Second example is identical but uses glaze as the repo, which uses .hpp and .cpp for header and source files.

1. Example fmtlib (.h/.cc)

At first it appears to work: ![](https://tokei.rs/b1/github/fmtlib/fmt?type=Cpp,CppHeader)

But it doesn't, it appears that Cpp and CppHeader is not recognized so instead it falls back on detecting any languages.

When adding Cmake to the list: ![](https://tokei.rs/b1/github/fmtlib/fmt?type=Cpp,CppHeader,Cmake) Now it's only 1.2k lines which is how many lines of Cmake there are in the repo.

Adding Go instead of Cmake puts the LoC at 0 as Go is recognized but there's no Go code in fmtlib. ![](https://tokei.rs/b1/github/fmtlib/fmt?type=Cpp,CppHeader,Go)

2. Example glaze (.hpp/.cpp)

Just ?type=Cpp,CppHeader ![](https://tokei.rs/b1/github/stephenberry/glaze?type=Cpp,CppHeader)

When adding Cmake to the list: ![](https://tokei.rs/b1/github/stephenberry/glaze?type=Cpp,CppHeader,Cmake)

Adding Go instead of Cmake ![](https://tokei.rs/b1/github/stephenberry/glaze?type=Cpp,CppHeader,Go)

CramBL commented 7 months ago

Ok NVM I figured it out. Sorry for the noise.

I should encode the + in C++ as %2b and the spaces in C++ Header as %20 and then it works.

e.g.

![](https://tokei.rs/b1/github/stephenberry/glaze?type=Cpp,CppHeader)

Should be

![](https://tokei.rs/b1/github/stephenberry/glaze?type=C%2b%2b,C%2b%2b%20Header)