[C++ Lint Rule] #define indentation is Inconsistent
#28.605 aberto em 9 de jul. de 2019
Métricas do repositório
- Stars
- (117.218 stars)
- Métricas de merge de PR
- (Mesclagem média 18d 17h) (219 fundiu PRs em 30d)
Description
I was recently going through the source code, trying to familiarize myself with the codebase, and I noticed that there's no consistent rule for how #defines are indented.
For example, in node_main.cc, there's no indentation at all in this #ifdef block.
However, in other places, like node.h, there's a space between the # and the define to indicate a kind of indentation.
There also seems to be inconsistency with how many spaces/tabs should go after the #define variable name and the value, as seen here.
Can we come up with a rule for this and add it to the C++ Style Guide? Maybe even add a rule to the linter?
To get started with the rules we can to define, some questions are:
- Should #defines inside of braces be indented?
- When should
#ifdef Xbe used vs.if defined(X)? - What should the indentation pattern be for
#define/#ifdef/#if defined/#ifndef?