third_party/blink/web_tests/external/PRESUBMIT.py
def _LintWPT(input_api, output_api):
    """Lint functionality duplicated from web-platform-tests upstream.

    This is to catch lint errors that would otherwise be caught in WPT CI.
    See https://web-platform-tests.org/writing-tests/lint-tool.html for more
    information about the lint tool.
    """
    wpt_path = input_api.os_path.join(input_api.PresubmitLocalPath(), 'wpt')
    linter_path = input_api.os_path.join(input_api.change.RepositoryRoot(),
                                         'third_party', 'wpt_tools', 'wpt',
                                         'wpt')

    paths_in_wpt = []
    for abs_path in input_api.AbsoluteLocalPaths():
        if abs_path.endswith(input_api.os_path.relpath(abs_path, wpt_path)):
            paths_in_wpt.append(abs_path)

    # If there are changes in LayoutTests/external that aren't in wpt, e.g.
    # changes to wpt_automation or this presubmit script, then we can return
    # to avoid running the linter on all files in wpt (which is slow).
    if not paths_in_wpt:
        return []

    args = [
        python3_command(input_api),
        linter_path,
        'lint',
        '--repo-root=%s' % wpt_path,
        '--ignore-glob=*-expected.txt',
        '--ignore-glob=*DIR_METADATA',
        '--ignore-glob=*OWNERS',
    ] + paths_in_wpt

    proc = input_api.subprocess.Popen(
        args,
        stdout=input_api.subprocess.PIPE,
        stderr=input_api.subprocess.PIPE)
    stdout, stderr = proc.communicate()

    if proc.returncode != 0:
        return [output_api.PresubmitError('wpt lint failed:', long_text=stdout + stderr)]
    return []
Lint functionality duplicated from web-platform-tests upstream.

    This is to catch lint errors that would otherwise be caught in WPT CI.
    See https://web-platform-tests.org/writing-tests/lint-tool.html for more
    information about the lint tool.
    
Lint functionality duplicated from web-platform-tests upstream.
This is to catch lint errors that would otherwise be caught in WPT CI.
Lint functionality duplicated from web - platform - tests upstream . This is to catch lint errors that would otherwise be caught in WPT CI .
def _LintWPT(input_api, output_api):
    wpt_path = input_api.os_path.join(input_api.PresubmitLocalPath(), 'wpt')
    linter_path = input_api.os_path.join(input_api.change.RepositoryRoot(),
                                         'third_party', 'wpt_tools', 'wpt',
                                         'wpt')
    paths_in_wpt = []
    for abs_path in input_api.AbsoluteLocalPaths():
        if abs_path.endswith(input_api.os_path.relpath(abs_path, wpt_path)):
            paths_in_wpt.append(abs_path)
    if not paths_in_wpt:
        return []
    args = [
        python3_command(input_api),
        linter_path,
        'lint',
        '--repo-root=%s' % wpt_path,
        '--ignore-glob=*-expected.txt',
        '--ignore-glob=*DIR_METADATA',
        '--ignore-glob=*OWNERS',
    ] + paths_in_wpt
    proc = input_api.subprocess.Popen(
        args,
        stdout=input_api.subprocess.PIPE,
        stderr=input_api.subprocess.PIPE)
    stdout, stderr = proc.communicate()
    if proc.returncode != 0:
        return [output_api.PresubmitError('wpt lint failed:', long_text=stdout + stderr)]
    return []
def _LintWPT ( input_api , output_api ) : wpt_path = input_api . os_path . join ( input_api . PresubmitLocalPath ( ) , 'wpt' ) linter_path = input_api . os_path . join ( input_api . change . RepositoryRoot ( ) , 'third_party' , 'wpt_tools' , 'wpt' , 'wpt' ) paths_in_wpt = [ ] for abs_path in input_api . AbsoluteLocalPaths ( ) : if abs_path . endswith ( input_api . os_path . relpath ( abs_path , wpt_path ) ) : paths_in_wpt . append ( abs_path ) if not paths_in_wpt : return [ ] args = [ python3_command ( input_api ) , linter_path , 'lint' , '--repo-root=%s' % wpt_path , '--ignore-glob=*-expected.txt' , '--ignore-glob=*DIR_METADATA' , '--ignore-glob=*OWNERS' , ] + paths_in_wpt proc = input_api . subprocess . Popen ( args , stdout = input_api . subprocess . PIPE , stderr = input_api . subprocess . PIPE ) stdout , stderr = proc . communicate ( ) if proc . returncode != 0 : return [ output_api . PresubmitError ( 'wpt lint failed:' , long_text = stdout + stderr ) ] return [ ]
Lint functionality duplicated from web-platform-tests upstream.
Lint functionality duplicated from web - platform - tests upstream .
"""Lint functionality duplicated from web-platform-tests upstream.

    This is to catch lint errors that would otherwise be caught in WPT CI.
    See https://web-platform-tests.org/writing-tests/lint-tool.html for more
    information about the lint tool.
    """ # If there are changes in LayoutTests/external that aren't in wpt, e.g. # changes to wpt_automation or this presubmit script, then we can return # to avoid running the linter on all files in wpt (which is slow).
input_api
output_api