C++: Fix long comments without * on each line

Comments like these will make the autoformatter produce bad indentation.

For the record (not for explainability), these issues were found with

    git grep -P -A1 '^( */\*| +\*( |$))(.(?!\*/))*$' cpp/ql/src/'**/*.ql*' |grep -B10 'qll\?- [^*]*$'
This commit is contained in:
Jonas Jensen
2019-09-05 14:14:53 +02:00
parent 44aca8a0f4
commit 3324bfb198
4 changed files with 53 additions and 48 deletions

View File

@@ -47,7 +47,7 @@ predicate diffBeginBegin(Expr lhs, Expr rhs, int length) {
/*
* Unary postfix operations: PostfixDecrExpr, PostfixIncrExpr
* Unary prefix operations: PrefixIncrExpr, PrefixDecrExpr, ComplementExpr, NotExpr,
UnaryMinusExpr, UnaryPlusExpr, AddressOfExpr, PointerDereferenceExpr
* UnaryMinusExpr, UnaryPlusExpr, AddressOfExpr, PointerDereferenceExpr
*/
from Expr err

View File

@@ -11,10 +11,10 @@
import cpp
/* bug finding approach: look for no-argument constructors that set a certain field x,
such that every member function reading x also contains a comparison involving x as
part of an if statement; the host class should not be used in an array type or as
part of an array new, it should not be used in a template instantiation, and it should
not be a virtual base class */
* such that every member function reading x also contains a comparison involving x as
* part of an if statement; the host class should not be used in an array type or as
* part of an array new, it should not be used in a template instantiation, and it should
* not be a virtual base class */
from Constructor c, MemberVariable f
where c.fromSource() and

View File

@@ -10,8 +10,8 @@
import cpp
/* TODO: "The break statement may be used to break out of a single loop provided
the alternative would obscure or otherwise significantly complicate the
control logic." */
* the alternative would obscure or otherwise significantly complicate the
* control logic." */
// whether t is the last statement of s, possibly peeling off blocks
predicate isTerminatingStmt(Stmt s, Stmt t) {

View File

@@ -76,36 +76,37 @@ class MetricClass extends Class {
dependsOnClassSimple(this, result)
}
/* -------- HENDERSON-SELLERS LACK OF COHESION IN METHODS -------- */
/*
* -------- HENDERSON-SELLERS LACK OF COHESION IN METHODS --------
/* The aim of this metric is to try and determine whether a class
represents one abstraction (good) or multiple abstractions (bad).
If a class represents multiple abstractions, it should be split
up into multiple classes.
* The aim of this metric is to try and determine whether a class
* represents one abstraction (good) or multiple abstractions (bad).
* If a class represents multiple abstractions, it should be split
* up into multiple classes.
In the Henderson-Sellers method, this is measured as follows:
M = set of methods in class
F = set of fields in class
r(f) = number of methods that access field f
<r> = mean of r(f) over f in F
The lack of cohesion is then given by
* In the Henderson-Sellers method, this is measured as follows:
* M = set of methods in class
* F = set of fields in class
* r(f) = number of methods that access field f
* <r> = mean of r(f) over f in F
* The lack of cohesion is then given by
<r> - |M|
---------
1 - |M|
* <r> - |M|
* ---------
* 1 - |M|
We follow the Eclipse metrics plugin by restricting M to methods
that access some field in the same class, and restrict F to
fields that are read by methods in the same class.
* We follow the Eclipse metrics plugin by restricting M to methods
* that access some field in the same class, and restrict F to
* fields that are read by methods in the same class.
Classes where the value of this metric is higher than 0.9 ought
to be scrutinised for possible splitting. Here is a query
to find such classes:
* Classes where the value of this metric is higher than 0.9 ought
* to be scrutinised for possible splitting. Here is a query
* to find such classes:
from MetricRefType t, float loc
where loc = t.getLackOfCohesionHS() and loc > 0.9
select t, loc order by loc desc
*/
* from MetricRefType t, float loc
* where loc = t.getLackOfCohesionHS() and loc > 0.9
* select t, loc order by loc desc
*/
/** Holds if `func` accesses field `f` defined in the same type. */
predicate accessesLocalField(Function func, Field f) {
@@ -143,23 +144,23 @@ class MetricClass extends Class {
)
}
/* -------- CHIDAMBER AND KEMERER LACK OF COHESION IN METHODS ------------ */
/*
* -------- CHIDAMBER AND KEMERER LACK OF COHESION IN METHODS ------------
/* The aim of this metric is to try and determine whether a class
represents one abstraction (good) or multiple abstractions (bad).
If a class represents multiple abstractions, it should be split
up into multiple classes.
* The aim of this metric is to try and determine whether a class
* represents one abstraction (good) or multiple abstractions (bad).
* If a class represents multiple abstractions, it should be split
* up into multiple classes.
In the Chidamber and Kemerer method, this is measured as follows:
n1 = number of pairs of distinct methods in a class that do *not*
have at least one commonly accessed field
n2 = number of pairs of distinct methods in a class that do
have at least one commonly accessed field
lcom = ((n1 - n2)/2 max 0)
* In the Chidamber and Kemerer method, this is measured as follows:
* n1 = number of pairs of distinct methods in a class that do *not*
* have at least one commonly accessed field
* n2 = number of pairs of distinct methods in a class that do
* have at least one commonly accessed field
* lcom = ((n1 - n2)/2 max 0)
We divide by 2 because each pair (m1,m2) is counted twice in n1 and n2.
*/
* We divide by 2 because each pair (m1,m2) is counted twice in n1 and n2.
*/
/** Holds if `f` should be excluded from the CK cohesion computation. */
predicate ignoreLackOfCohesionCK(Function f) {
@@ -206,7 +207,9 @@ class MetricClass extends Class {
)
}
/* ----------------- RESPONSE FOR A CLASS --------------------------------- */
/*
* ----------------- RESPONSE FOR A CLASS ---------------------------------
*/
/**
* Gets the _response_ for this class. This estimates the number of
@@ -217,7 +220,9 @@ class MetricClass extends Class {
result = sum(MemberFunction f | f.getDeclaringType()=this | count(Call call | call.getEnclosingFunction() = f))
}
/* ----------------- SPECIALIZATION INDEX -------------------------------- */
/*
* ----------------- SPECIALIZATION INDEX --------------------------------
*/
/**
* Gets a function that should be excluded when reporting the number of
@@ -259,7 +264,7 @@ class MetricClass extends Class {
}
/*
* HALSTEAD METRICS
* ----------------- HALSTEAD METRICS ------------------------------------
*/
/**