Skip to content

Commit 26b3503

Browse files
committed
Add basic support for --verifytypes; closes #4
1 parent 22ae365 commit 26b3503

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ inputs:
3838
description: 'Use library code to infer types when stubs are missing.'
3939
required: false
4040
default: 'false'
41+
verify-types:
42+
description: 'Package name to run the type verifier on; must be an *installed* library. Any score under 100% will fail the build.'
43+
required: false
4144
extra-args:
4245
description: 'Extra arguments; can be used to specify specific files to check.'
4346
required: false

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ inputs:
3535
description: 'Use exit code of 1 if warnings are reported.'
3636
required: false
3737
default: 'false'
38+
verify-types:
39+
description: description: 'Package name to run the type verifier on; must be an *installed* library. Any score under 100% will fail the build.'
40+
required: false
3841
extra-args:
3942
description: 'Extra arguments; can be used to specify specific files to check.'
4043
required: false

dist/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6198,7 +6198,7 @@ async function main() {
61986198
console.log(`pyright ${version}, node ${process.version}`);
61996199
const { args, noComments } = await getArgs(version);
62006200
console.log(`${process.execPath} ${args.join(" ")}`);
6201-
if (noComments) {
6201+
if (noComments || args.indexOf("--verifytypes") >= 0) {
62026202
const { status: status2 } = cp.spawnSync(process.execPath, args, {
62036203
stdio: ["ignore", "inherit", "inherit"]
62046204
});
@@ -6291,6 +6291,11 @@ async function getArgs(version) {
62916291
if (warnings) {
62926292
args.push("--warnings");
62936293
}
6294+
const verifyTypes = core.getInput("verify-types");
6295+
if (project) {
6296+
args.push("--verifytypes");
6297+
args.push(verifyTypes);
6298+
}
62946299
const extraArgs = core.getInput("extra-args");
62956300
if (extraArgs) {
62966301
args.push(...(0, import_string_argv.default)(extraArgs));

src/main.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ export async function main() {
2222
const { args, noComments } = await getArgs(version);
2323
console.log(`${process.execPath} ${args.join(' ')}`);
2424

25-
if (noComments) {
26-
// Comments are disabled, just run as a subprocess passing things through.
25+
if (noComments || args.indexOf('--verifytypes') >= 0) {
26+
// If comments are disabled, there's no point in directly processing the output,
27+
// as it's only used for comments.
28+
// If we're running the type verifier, there's no guarantee that we can even act
29+
// on the output besides the exit code.
30+
//
31+
// So, in either case, just directly run pyright and exit with its status.
2732
const { status } = cp.spawnSync(process.execPath, args, {
2833
stdio: ['ignore', 'inherit', 'inherit'],
2934
});
@@ -150,6 +155,12 @@ async function getArgs(version: SemVer) {
150155
args.push('--warnings');
151156
}
152157

158+
const verifyTypes = core.getInput('verify-types');
159+
if (project) {
160+
args.push('--verifytypes');
161+
args.push(verifyTypes);
162+
}
163+
153164
const extraArgs = core.getInput('extra-args');
154165
if (extraArgs) {
155166
args.push(...stringArgv(extraArgs));

0 commit comments

Comments
 (0)