C++: Tidy up code so it looks good after qlformat

This commit is contained in:
Jonas Jensen
2019-04-12 10:43:24 +02:00
parent 6049c2ccfd
commit 29aa5f550c
2 changed files with 13 additions and 32 deletions

View File

@@ -46,16 +46,7 @@ where
or
l = "Self-Containedness" and
n = (
100 *
sum(Class c, int toSum |
c.fromSource() and toSum = c.getMetrics().getEfferentSourceCoupling()
|
toSum
) /
sum(Class c, int toSum |
c.fromSource() and toSum = c.getMetrics().getEfferentCoupling()
|
toSum
)
100 * sum(Class c | c.fromSource() | c.getMetrics().getEfferentSourceCoupling()) /
sum(Class c | c.fromSource() | c.getMetrics().getEfferentCoupling())
).toString() + "%"
select l as Title, n as Value

View File

@@ -6,27 +6,9 @@ import semmle.code.cpp.AutogeneratedFile
*/
predicate trivialPositiveIntValue(string s) {
s = "0" or
s = "1" or
s = "2" or
s = "3" or
s = "4" or
s = "5" or
s = "6" or
s = "7" or
s = "8" or
s = "9" or
s = "10" or
s = "11" or
s = "12" or
s = "13" or
s = "14" or
s = "15" or
s = "16" or
s = "17" or
s = "18" or
s = "19" or
s = "20" or
// Small numbers
s = [0 .. 20].toString() or
// Popular powers of two (decimal)
s = "16" or
s = "24" or
s = "32" or
@@ -43,6 +25,7 @@ predicate trivialPositiveIntValue(string s) {
s = "1048576" or
s = "2147483648" or
s = "4294967296" or
// Popular powers of two, minus one (decimal)
s = "15" or
s = "31" or
s = "63" or
@@ -58,6 +41,7 @@ predicate trivialPositiveIntValue(string s) {
s = "1048577" or
s = "2147483647" or
s = "4294967295" or
// Popular powers of two (32-bit hex)
s = "0x00000001" or
s = "0x00000002" or
s = "0x00000004" or
@@ -90,6 +74,7 @@ predicate trivialPositiveIntValue(string s) {
s = "0x20000000" or
s = "0x40000000" or
s = "0x80000000" or
// Popular powers of two, minus one (32-bit hex)
s = "0x00000001" or
s = "0x00000003" or
s = "0x00000007" or
@@ -122,6 +107,7 @@ predicate trivialPositiveIntValue(string s) {
s = "0x3fffffff" or
s = "0x7fffffff" or
s = "0xffffffff" or
// Popular powers of two (16-bit hex)
s = "0x0001" or
s = "0x0002" or
s = "0x0004" or
@@ -138,6 +124,7 @@ predicate trivialPositiveIntValue(string s) {
s = "0x2000" or
s = "0x4000" or
s = "0x8000" or
// Popular powers of two, minus one (16-bit hex)
s = "0x0001" or
s = "0x0003" or
s = "0x0007" or
@@ -154,6 +141,7 @@ predicate trivialPositiveIntValue(string s) {
s = "0x3fff" or
s = "0x7fff" or
s = "0xffff" or
// Popular powers of two (8-bit hex)
s = "0x01" or
s = "0x02" or
s = "0x04" or
@@ -162,6 +150,7 @@ predicate trivialPositiveIntValue(string s) {
s = "0x20" or
s = "0x40" or
s = "0x80" or
// Popular powers of two, minus one (8-bit hex)
s = "0x01" or
s = "0x03" or
s = "0x07" or
@@ -171,6 +160,7 @@ predicate trivialPositiveIntValue(string s) {
s = "0x7f" or
s = "0xff" or
s = "0x00" or
// Powers of ten
s = "10" or
s = "100" or
s = "1000" or