ng-checkup 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -21,3 +21,12 @@ import type { Report } from '../types.js';
|
|
|
21
21
|
* project as a whole sits on `package.json`.
|
|
22
22
|
*/
|
|
23
23
|
export declare function renderCodeQuality(report: Report): string;
|
|
24
|
+
/**
|
|
25
|
+
* What a finding is about, with everything that changes with its size taken
|
|
26
|
+
* out: numbers, and the singular or plural they force on the words around
|
|
27
|
+
* them. "1 component uses eager change detection" and "2 components use
|
|
28
|
+
* eager change detection" are one finding; without the second step GitLab
|
|
29
|
+
* showed the first as resolved and the second as new on an unrelated file.
|
|
30
|
+
* Exported for tests.
|
|
31
|
+
*/
|
|
32
|
+
export declare function findingKind(message: string): string;
|
|
@@ -26,6 +26,23 @@ export function renderCodeQuality(report) {
|
|
|
26
26
|
const entries = report.checks.flatMap((check) => check.findings.filter(isReported).flatMap((finding) => entriesOf(check, finding)));
|
|
27
27
|
return `${JSON.stringify(entries, null, 2)}\n`;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* What a finding is about, with everything that changes with its size taken
|
|
31
|
+
* out: numbers, and the singular or plural they force on the words around
|
|
32
|
+
* them. "1 component uses eager change detection" and "2 components use
|
|
33
|
+
* eager change detection" are one finding; without the second step GitLab
|
|
34
|
+
* showed the first as resolved and the second as new on an unrelated file.
|
|
35
|
+
* Exported for tests.
|
|
36
|
+
*/
|
|
37
|
+
export function findingKind(message) {
|
|
38
|
+
const irregular = { is: 'be', are: 'be', was: 'be', were: 'be', has: 'have', does: 'do', its: 'their' };
|
|
39
|
+
return message
|
|
40
|
+
.toLowerCase()
|
|
41
|
+
.replace(/\d[\d\s.,%]*/g, '#')
|
|
42
|
+
.split(/(\W+)/)
|
|
43
|
+
.map((word) => irregular[word] ?? (/(ss|sh|ch|x)es$/.test(word) ? word.slice(0, -2) : word.length > 3 && /[^s]s$/.test(word) ? word.slice(0, -1) : word))
|
|
44
|
+
.join('');
|
|
45
|
+
}
|
|
29
46
|
/** True for the findings that become Code Quality entries. */
|
|
30
47
|
function isReported(finding) {
|
|
31
48
|
return finding.severity !== 'info';
|
|
@@ -33,7 +50,7 @@ function isReported(finding) {
|
|
|
33
50
|
/** The entries of one finding: one per example file, or one on `package.json`. */
|
|
34
51
|
function entriesOf(check, finding) {
|
|
35
52
|
const files = finding.files && finding.files.length > 0 ? finding.files : [{ path: 'package.json' }];
|
|
36
|
-
const kind = finding.message
|
|
53
|
+
const kind = findingKind(finding.message);
|
|
37
54
|
return files.map((file) => ({
|
|
38
55
|
type: 'issue',
|
|
39
56
|
check_name: `ng-checkup/${check.id}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codequality.js","sourceRoot":"","sources":["../../src/report/codequality.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,iHAAiH;AACjH,MAAM,UAAU,GAAsE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAE1I;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpI,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAED,8DAA8D;AAC9D,SAAS,UAAU,CAAC,OAAgB;IAClC,OAAO,OAAO,CAAC,QAAQ,KAAK,MAAM,CAAC;AACrC,C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AO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;QAC5D,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtC,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,EAAE,KAAK,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC5F,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE;KAChE,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-checkup",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "A one-minute modernization report for any Angular codebase: version gap, deprecated APIs, zoneless readiness, signals adoption, test runner, type safety and circular dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|