Skip to content

Commit db9a0d1

Browse files
committed
make the deprecation query calculate based on months, and adjust the cutoff to 14 months
1 parent 6f8ae70 commit db9a0d1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ql/ql/src/queries/reports/OutdatedDeprecations.ql

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @name Outdated deprecation
33
* @description Deprecations that are over a year old should be removed.
44
* @kind problem
5-
* @problem.severity warning
5+
* @problem.severity recommendation
66
* @id ql/outdated-deprecation
77
* @tags maintainability
88
* @precision high
@@ -32,9 +32,14 @@ class DatedDeprecation extends Annotation {
3232
)
3333
}
3434

35-
date getLastModified() { result = lastModified }
35+
/** Gets how long ago this deprecation was added, in months. */
36+
int getMonthsOld() {
37+
exists(float month |
38+
month = 365 / 12 and result = (lastModified.daysTo(today()) / month).floor()
39+
)
40+
}
3641
}
3742

3843
from DatedDeprecation d
39-
where d.getLastModified().daysTo(today()) > 365
40-
select d, "This deprecation is over a year old."
44+
where d.getMonthsOld() >= 14
45+
select d, "This deprecation is over 14 months old."

0 commit comments

Comments
 (0)