• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / brighterscript / #15915

13 May 2026 06:48PM UTC coverage: 86.904% (-0.01%) from 86.917%
#15915

push

web-flow
Merge 276684b1f into 9de11ed0c

15644 of 19004 branches covered (82.32%)

Branch coverage included in aggregate %.

4 of 9 new or added lines in 2 files covered. (44.44%)

27 existing lines in 4 files now uncovered.

16360 of 17823 relevant lines covered (91.79%)

27311.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

12.9
/src/bscPlugin/codeActions/FixAllCodeActionsProcessor.ts
1
import type { BsDiagnostic } from '../../interfaces';
2
import { DiagnosticCodeMap } from '../../DiagnosticMessages';
1✔
3
import type { DiagnosticMessageType } from '../../DiagnosticMessages';
4
import type { XmlFile } from '../../files/XmlFile';
5
import type { ProvideSourceFixAllCodeActionsEvent } from '../../interfaces';
6
import { isXmlFile } from '../../astUtils/reflection';
1✔
7
import { getMissingExtendsInsertPosition, getRemoveReturnValueChange } from './codeActionHelpers';
1✔
8

9
export class FixAllCodeActionsProcessor {
1✔
10
    public constructor(
NEW
11
        public event: ProvideSourceFixAllCodeActionsEvent
×
12
    ) { }
13

14
    public process() {
15
        const byCode = new Map<number | string, BsDiagnostic[]>();
×
16
        for (const diagnostic of this.event.diagnostics) {
×
17
            const key = diagnostic.code;
×
18
            if (!byCode.has(key)) {
×
19
                byCode.set(key, []);
×
20
            }
21
            byCode.get(key).push(diagnostic);
×
22
        }
23

24
        const missingExtends = byCode.get(DiagnosticCodeMap.xmlComponentMissingExtendsAttribute);
×
25
        if (missingExtends) {
×
26
            this.processMissingExtends(missingExtends as DiagnosticMessageType<'xmlComponentMissingExtendsAttribute'>[]);
×
27
        }
28

29
        const voidFunctionReturns = byCode.get(DiagnosticCodeMap.voidFunctionMayNotReturnValue);
×
30
        if (voidFunctionReturns) {
×
31
            this.processVoidFunctionReturnActions(voidFunctionReturns);
×
32
        }
33
    }
34

35
    /**
36
     * For every `voidFunctionMayNotReturnValue` diagnostic in this file,
37
     * remove the return value expression, leaving the bare `return` keyword.
38
     */
39
    private processVoidFunctionReturnActions(diagnostics: BsDiagnostic[]) {
40
        const changes = diagnostics.map(diagnostic => getRemoveReturnValueChange(diagnostic, this.event.file.srcPath));
×
41
        this.event.actions.push({
×
42
            title: 'Remove all void return values',
43
            kind: 'source.fixAll.brighterscript',
44
            isPreferred: true,
45
            changes: changes
46
        });
47
    }
48

49
    /**
50
     * For every `xmlComponentMissingExtendsAttribute` diagnostic in this file,
51
     * insert `extends="Group"` — the same choice marked `isPreferred` in the
52
     * per-diagnostic quick-fix.
53
     */
54
    private processMissingExtends(diagnostics: DiagnosticMessageType<'xmlComponentMissingExtendsAttribute'>[]) {
55
        if (!isXmlFile(this.event.file)) {
×
56
            return;
×
57
        }
58

59
        const changes = diagnostics.map(() => ({
×
60
            type: 'insert' as const,
61
            filePath: this.event.file.srcPath,
62
            position: getMissingExtendsInsertPosition(this.event.file as XmlFile),
63
            newText: ' extends="Group"'
64
        }));
65

66
        this.event.actions.push({
×
67
            title: 'Add missing extends attributes',
68
            kind: 'source.fixAll.brighterscript',
69
            isPreferred: true,
70
            changes: changes
71
        });
72
    }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc