示例#1
0
from lib.collect_files import collect_files
from lib.checks.frontmatter import CheckFrontmatter
from lib.checks.license import CheckLicense
from lib.eprint import eprint
import lib.frontmatter
import lib.whitelist

parser = argparse.ArgumentParser(description='Test262 linting tool')
parser.add_argument('--whitelist',
                    type=argparse.FileType('r'),
                    help='file containing expected linting errors')
parser.add_argument('path',
                    nargs='+',
                    help='file name or directory of files to lint')

checks = [CheckFrontmatter(), CheckLicense()]


def lint(file_names):
    errors = dict()

    for file_name in file_names:
        with open(file_name, 'r') as f:
            content = f.read()
        meta = lib.frontmatter.parse(content)
        for check in checks:
            error = check.run(file_name, meta, content)

            if error is not None:
                if file_name not in errors:
                    errors[file_name] = dict()
示例#2
0
parser = argparse.ArgumentParser(description='Test262 linting tool')
parser.add_argument('--whitelist',
                    type=argparse.FileType('r'),
                    help='file containing expected linting errors')
parser.add_argument('path',
                    nargs='+',
                    help='file name or directory of files to lint')

checks = [
    CheckEsid(),
    CheckFileName(),
    CheckFrontmatter(),
    CheckFeatures('features.txt'),
    CheckHarnessFeatures(),
    CheckLicense(),
    CheckNegative()
]


def lint(file_names):
    errors = dict()

    for file_name in file_names:
        with open(file_name, 'r') as f:
            content = f.read()
        meta = lib.frontmatter.parse(content)
        for check in checks:
            error = check.run(file_name, meta, content)

            if error is not None:
示例#3
0
文件: lint.py 项目: xanlpz/test262
from lib.checks.features import CheckFeatures
from lib.checks.frontmatter import CheckFrontmatter
from lib.checks.license import CheckLicense
from lib.eprint import eprint
import lib.frontmatter
import lib.whitelist

parser = argparse.ArgumentParser(description='Test262 linting tool')
parser.add_argument('--whitelist',
                    type=argparse.FileType('r'),
                    help='file containing expected linting errors')
parser.add_argument('path',
                    nargs='+',
                    help='file name or directory of files to lint')

checks = [CheckFrontmatter(), CheckFeatures('features.txt'), CheckLicense()]


def lint(file_names):
    errors = dict()

    for file_name in file_names:
        with open(file_name, 'r') as f:
            content = f.read()
        meta = lib.frontmatter.parse(content)
        for check in checks:
            error = check.run(file_name, meta, content)

            if error is not None:
                if file_name not in errors:
                    errors[file_name] = dict()