mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
C++: Initial cpp/comma-before-misleading-indentation
MRVA top 1000 run at: https://github.com/github/semmle-code/actions/runs/3106828111
This commit is contained in:
@@ -1 +1,19 @@
|
||||
select 1
|
||||
/**
|
||||
* @name Comma before misleading indentation
|
||||
* @description The expressions before and after the comma operator can be misread because of an unusual difference in start columns.
|
||||
* @kind problem
|
||||
* @id cpp/comma-before-misleading-indentation
|
||||
* @problem.severity recommendation
|
||||
* @tags maintainability
|
||||
* readability
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
from CommaExpr ce
|
||||
where
|
||||
ce.fromSource() and
|
||||
not exists(MacroInvocation me | ce = me.getAnAffectedElement()) and
|
||||
ce.getLeftOperand().getLocation().getStartColumn() >
|
||||
ce.getRightOperand().getLocation().getStartColumn()
|
||||
select ce, "Comma before misleading indentation."
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
| 1 |
|
||||
| test.cpp:9:3:10:8 | ... , ... | Comma before misleading indentation. |
|
||||
| test.cpp:17:7:18:4 | ... , ... | Comma before misleading indentation. |
|
||||
|
||||
Reference in New Issue
Block a user