mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: Autoformat everything using qlformat.
Will need subsequent PRs fixing up test failures (due to deprecated methods moving around), but other than that everything should be straight-forward.
This commit is contained in:
@@ -13,11 +13,11 @@ import external.VCS
|
||||
|
||||
from Module m, int n
|
||||
where
|
||||
n =
|
||||
sum(Commit entry, int churn |
|
||||
churn = entry.getRecentChurnForFile(m.getFile()) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
) and
|
||||
exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
n =
|
||||
sum(Commit entry, int churn |
|
||||
churn = entry.getRecentChurnForFile(m.getFile()) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
) and
|
||||
exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
select m, n order by n desc
|
||||
|
||||
@@ -13,11 +13,11 @@ import external.VCS
|
||||
|
||||
from Module m, int n
|
||||
where
|
||||
n =
|
||||
sum(Commit entry, int churn |
|
||||
churn = entry.getRecentAdditionsForFile(m.getFile()) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
) and
|
||||
exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
n =
|
||||
sum(Commit entry, int churn |
|
||||
churn = entry.getRecentAdditionsForFile(m.getFile()) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
) and
|
||||
exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
select m, n order by n desc
|
||||
|
||||
@@ -13,11 +13,11 @@ import external.VCS
|
||||
|
||||
from Module m, int n
|
||||
where
|
||||
n =
|
||||
sum(Commit entry, int churn |
|
||||
churn = entry.getRecentDeletionsForFile(m.getFile()) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
) and
|
||||
exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
n =
|
||||
sum(Commit entry, int churn |
|
||||
churn = entry.getRecentDeletionsForFile(m.getFile()) and not artificialChange(entry)
|
||||
|
|
||||
churn
|
||||
) and
|
||||
exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
select m, n order by n desc
|
||||
|
||||
@@ -16,8 +16,8 @@ int committedFiles(Commit commit) { result = count(commit.getAnAffectedFile()) }
|
||||
from Module m
|
||||
where exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
select m,
|
||||
avg(Commit commit, int toAvg |
|
||||
commit.getAnAffectedFile() = m.getFile() and toAvg = committedFiles(commit) - 1
|
||||
|
|
||||
toAvg
|
||||
)
|
||||
avg(Commit commit, int toAvg |
|
||||
commit.getAnAffectedFile() = m.getFile() and toAvg = committedFiles(commit) - 1
|
||||
|
|
||||
toAvg
|
||||
)
|
||||
|
||||
@@ -12,21 +12,21 @@ import python
|
||||
import external.VCS
|
||||
|
||||
predicate inRange(Commit first, Commit second) {
|
||||
first.getAnAffectedFile() = second.getAnAffectedFile() and
|
||||
first != second and
|
||||
exists(int n |
|
||||
n = first.getDate().daysTo(second.getDate()) and
|
||||
n >= 0 and
|
||||
n < 5
|
||||
)
|
||||
first.getAnAffectedFile() = second.getAnAffectedFile() and
|
||||
first != second and
|
||||
exists(int n |
|
||||
n = first.getDate().daysTo(second.getDate()) and
|
||||
n >= 0 and
|
||||
n < 5
|
||||
)
|
||||
}
|
||||
|
||||
int recommitsForFile(File f) {
|
||||
result =
|
||||
count(Commit recommit |
|
||||
f = recommit.getAnAffectedFile() and
|
||||
exists(Commit prev | inRange(prev, recommit))
|
||||
)
|
||||
result =
|
||||
count(Commit recommit |
|
||||
f = recommit.getAnAffectedFile() and
|
||||
exists(Commit prev | inRange(prev, recommit))
|
||||
)
|
||||
}
|
||||
|
||||
from Module m
|
||||
|
||||
@@ -14,11 +14,11 @@ import external.VCS
|
||||
from Module m
|
||||
where exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
select m,
|
||||
count(Author author |
|
||||
exists(Commit e |
|
||||
e = author.getACommit() and
|
||||
m.getFile() = e.getAnAffectedFile() and
|
||||
e.daysToNow() <= 180 and
|
||||
not artificialChange(e)
|
||||
)
|
||||
count(Author author |
|
||||
exists(Commit e |
|
||||
e = author.getACommit() and
|
||||
m.getFile() = e.getAnAffectedFile() and
|
||||
e.daysToNow() <= 180 and
|
||||
not artificialChange(e)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -13,8 +13,8 @@ import external.VCS
|
||||
|
||||
from Module m
|
||||
where
|
||||
exists(Commit e |
|
||||
e.getAnAffectedFile() = m.getFile() and e.daysToNow() <= 180 and not artificialChange(e)
|
||||
) and
|
||||
exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
exists(Commit e |
|
||||
e.getAnAffectedFile() = m.getFile() and e.daysToNow() <= 180 and not artificialChange(e)
|
||||
) and
|
||||
exists(m.getMetrics().getNumberOfLinesOfCode())
|
||||
select m, 1
|
||||
|
||||
Reference in New Issue
Block a user