I want to check my code to find typos like this:
bool check;
check == true; // should be: check = true;
This is a valid code in C/C++, so I want to use cpplint to find code occurrences of this type.
What cpplint configuration should I use?
This typo indeed can be left unnoticed. I'd suggest you not to rely on default compiler configuration.
Assume following code:
int main()
{
int check;
check == 1;
}
When built with gcc main.c -o main
the compiler will not produce any warnings at all. (Ubuntu 20.04.1, GCC 9.3.0).
However, when built with gcc main.c -o main -Wall
:
main.c: In function ‘main’:
main.c:4:8: warning: statement with no effect [-Wunused-value]
4 | check == 1;
| ~~~~~~^~~~
You don't need cpplint for this kind of typos. That's an overkill.