mirror of
https://github.com/tc39/test262.git
synced 2025-05-30 11:40:30 +02:00
Allow linter to use alternate features.txt file
This commit is contained in:
parent
a9821b4211
commit
be929de3ec
@ -52,23 +52,27 @@ parser.add_argument('--exceptions',
|
|||||||
parser.add_argument('path',
|
parser.add_argument('path',
|
||||||
nargs='+',
|
nargs='+',
|
||||||
help='file name or directory of files to lint')
|
help='file name or directory of files to lint')
|
||||||
|
parser.add_argument('--features',
|
||||||
|
help='File containing all known features usable in tests',
|
||||||
|
default='features.txt')
|
||||||
|
|
||||||
checks = [
|
def checks(features):
|
||||||
CheckEsid(),
|
return [
|
||||||
CheckFileName(),
|
CheckEsid(),
|
||||||
CheckFrontmatter(),
|
CheckFileName(),
|
||||||
CheckFeatures('features.txt'),
|
CheckFrontmatter(),
|
||||||
CheckHarnessFeatures(),
|
CheckFeatures(features),
|
||||||
CheckHarness(),
|
CheckHarnessFeatures(),
|
||||||
CheckIncludes(),
|
CheckHarness(),
|
||||||
CheckLicense(),
|
CheckIncludes(),
|
||||||
CheckNegative(),
|
CheckLicense(),
|
||||||
CheckNoPadding(),
|
CheckNegative(),
|
||||||
CheckFlags(),
|
CheckNoPadding(),
|
||||||
CheckPosix(),
|
CheckFlags(),
|
||||||
]
|
CheckPosix(),
|
||||||
|
]
|
||||||
|
|
||||||
def lint(file_names):
|
def lint(file_names, features):
|
||||||
errors = dict()
|
errors = dict()
|
||||||
|
|
||||||
for file_name in file_names:
|
for file_name in file_names:
|
||||||
@ -78,7 +82,7 @@ def lint(file_names):
|
|||||||
with open(file_name, 'r') as f:
|
with open(file_name, 'r') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
meta = lib.frontmatter.parse(content)
|
meta = lib.frontmatter.parse(content)
|
||||||
for check in checks:
|
for check in checks(features):
|
||||||
error = check.run(file_name, meta, content)
|
error = check.run(file_name, meta, content)
|
||||||
|
|
||||||
if error is not None:
|
if error is not None:
|
||||||
@ -99,7 +103,7 @@ if __name__ == '__main__':
|
|||||||
file_count = len(files)
|
file_count = len(files)
|
||||||
print('Linting %s file(s)' % (file_count))
|
print('Linting %s file(s)' % (file_count))
|
||||||
|
|
||||||
all_errors = lint(files)
|
all_errors = lint(files, args.features)
|
||||||
unexpected_errors = dict(all_errors)
|
unexpected_errors = dict(all_errors)
|
||||||
|
|
||||||
for file_name, failures in all_errors.items():
|
for file_name, failures in all_errors.items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user