Commit e742b9e
committed
codecompliance: check spaces around compound/comparison operators
cppstyle.py already flags a few C++ spacing slips but not missing spaces
around the compound-assignment and comparison operators (+=, ==, <=, and
friends), which #837 asks for. Add a check for them.
The operators overlap, so a naive scan false-matches: >= sits inside
>>=, <= inside <<= and the C++20 <=> spaceship. The regex uses
lookbehind/lookahead to only match the standalone forms. Comments and
string literals are blanked before checking, and operator-overload
declarations (operator==, etc.) are skipped, so things like `// a==b`,
`"x==y"` and `bool operator==(...)` don't trip it.
The existing tree already passes the new check (zero hits across
libopenage), so this is purely additive.
Closes #837.1 parent 4176e0e commit e742b9e
1 file changed
Lines changed: 43 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
50 | 77 | | |
51 | 78 | | |
52 | 79 | | |
| |||
81 | 108 | | |
82 | 109 | | |
83 | 110 | | |
84 | | - | |
| 111 | + | |
| 112 | + | |
85 | 113 | | |
86 | 114 | | |
87 | 115 | | |
| |||
116 | 144 | | |
117 | 145 | | |
118 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
0 commit comments