klog icon indicating copy to clipboard operation
klog copied to clipboard

Code style is missing (src/README-DEVEL)

Open ikbenkous opened this issue 2 years ago • 2 comments

I suppose the code style describing brackets/spaces/tabs/etc was either never there or was deleted. See here: https://github.com/ea4k/klog/blob/d308f9862ddb2f3895f3c6f7452f2327f94ea83e/src/README-DEVEL#L133-L134

Suggestions:

  1. Move README-DEVEL and any other text files out of /src/ and into / (or maybe /docs/ or /txt/)
  2. Regarding the code style:
    • See if the code style was ever present, restore it and update it to reflect modern C++ features/recommendations
    • Maybe just write a new code style altogether from scratch
  3. Maybe add a make lint target to run a linter (should be a separate issue)

ikbenkous avatar Nov 26 '23 23:11 ikbenkous

I believe there are recommendations for header include order. The recommended way being: First the most specific header, then library headers, then standard libraries. klog does the exact opposite, which is a common coding style even in other C++ projects.

I can't find the exact Core C++ guideline, but it may be in there. Or maybe it's bad advice. Please let me know. But if it's good advice, put it in the klog coding style I guess?

Here's at least someone's blog post about it: https://blog.knatten.org/2010/07/01/the-order-of-include-directives-matter/

ikbenkous avatar Jun 25 '24 05:06 ikbenkous

There are ~5500 qDebug() statements in the codebase of which only about 77 are currently active and not commented out. There are 0 qInfo(), qWarn(), qCritical() and qFatal() messages. The coding style should mention using other log levels as well where appropriate.

Debugging would be a lot easier if you can just set the log level, get to testing and see other unrelated messages. The log is kind of sparse right now.

qDebug()/Info()/etc messages are supposedly not "meant" to be visible to the user and these macros may be disabled in release builds. Should klog have logging enabled even in release builds?

ikbenkous avatar Jul 14 '24 18:07 ikbenkous