Lint: disallow calls to verifyConfigurable and verifyProperty in same file

This commit is contained in:
Rick Waldron 2018-06-07 22:38:36 -04:00
parent acf6de15ec
commit c686cc6099
4 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,14 @@
import yaml
from ..check import Check
class CheckHarness(Check):
'''Ensure tests don't misuse harness APIs.'''
ID = 'HARNESS'
def run(self, name, meta, source):
print(source)
if 'verifyConfigurable(' in source and 'verifyProperty(' in source:
return 'verifyConfigurable & verifyProperty may not be used in the same file'
else:
return

View File

@ -30,6 +30,7 @@ from lib.checks.esid import CheckEsid
from lib.checks.features import CheckFeatures from lib.checks.features import CheckFeatures
from lib.checks.frontmatter import CheckFrontmatter from lib.checks.frontmatter import CheckFrontmatter
from lib.checks.harnessfeatures import CheckHarnessFeatures from lib.checks.harnessfeatures import CheckHarnessFeatures
from lib.checks.harness import CheckHarness
from lib.checks.license import CheckLicense from lib.checks.license import CheckLicense
from lib.checks.negative import CheckNegative from lib.checks.negative import CheckNegative
from lib.checks.filename import CheckFileName from lib.checks.filename import CheckFileName
@ -51,6 +52,7 @@ checks = [
CheckFrontmatter(), CheckFrontmatter(),
CheckFeatures('features.txt'), CheckFeatures('features.txt'),
CheckHarnessFeatures(), CheckHarnessFeatures(),
CheckHarness(),
CheckLicense(), CheckLicense(),
CheckNegative() CheckNegative()
] ]

View File

@ -0,0 +1,12 @@
HARNESS - verifyConfigurable & verifyProperty may not be used in the same file
^ expected errors | v input
// Copyright (C) 2017 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-whatever
description: Minimal test
includes: [verifyProperty.js]
---*/
verifyConfigurable(Object, '');
verifyProperty(Object, {});

View File

@ -0,0 +1,10 @@
^ expected errors | v input
// Copyright (C) 2017 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-whatever
description: Minimal test
includes: [verifyProperty.js]
---*/
verifyConfigurable(Object, '');