mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 16:57:00 +08:00
Fix formatting
Running `npm run format-py` on a fresh checkout results in some changes. This patch commits those changes so that they do not become part of unrelated CLs. Change-Id: Ie8051c7907ac9624e9fe870e2137b9a9fe2769c3 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1871869 Auto-Submit: Mathias Bynens <mathias@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
544479c489
commit
032591d692
+18
-15
@@ -59,8 +59,9 @@ def _CheckFormat(input_api, output_api):
|
||||
with open(eslint_ignore_path, 'r') as ignore_manifest:
|
||||
for line in ignore_manifest:
|
||||
ignore_files.append(line.strip())
|
||||
formattable_files = [affected_file for affected_file in affected_files
|
||||
if all(ignore_file not in affected_file for ignore_file in ignore_files)]
|
||||
formattable_files = [
|
||||
affected_file for affected_file in affected_files if all(ignore_file not in affected_file for ignore_file in ignore_files)
|
||||
]
|
||||
if len(formattable_files) == 0:
|
||||
return []
|
||||
|
||||
@@ -77,7 +78,8 @@ def _CheckFormat(input_api, output_api):
|
||||
|
||||
# Use eslint to autofix the braces.
|
||||
# Also fix semicolon to avoid confusing clang-format.
|
||||
eslint_process = popen([devtools_paths.node_path(), devtools_paths.eslint_path(), '--config', '.eslintrc.js', '--fix'] + affected_files)
|
||||
eslint_process = popen(
|
||||
[devtools_paths.node_path(), devtools_paths.eslint_path(), '--config', '.eslintrc.js', '--fix'] + affected_files)
|
||||
eslint_process.communicate()
|
||||
|
||||
# Need to run clang-format again to align the braces
|
||||
@@ -173,17 +175,19 @@ def _CheckCSSViolations(input_api, output_api):
|
||||
results.append(output_api.PresubmitError(("%s:%d uses ::shadow selector") % (f.LocalPath(), line_number)))
|
||||
return results
|
||||
|
||||
|
||||
def _CommonChecks(input_api, output_api):
|
||||
"""Checks common to both upload and commit."""
|
||||
results = []
|
||||
results.extend(input_api.canned_checks.CheckOwnersFormat(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasNoCrAndHasOnlyOneEol(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasNoStrayWhitespace(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckGenderNeutral(input_api, output_api))
|
||||
results.extend(_CheckDevtoolsLocalizableResources(input_api, output_api))
|
||||
results.extend(_CheckDevtoolsLocalization(input_api, output_api))
|
||||
return results
|
||||
"""Checks common to both upload and commit."""
|
||||
results = []
|
||||
results.extend(input_api.canned_checks.CheckOwnersFormat(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasNoCrAndHasOnlyOneEol(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasNoStrayWhitespace(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckGenderNeutral(input_api, output_api))
|
||||
results.extend(_CheckDevtoolsLocalizableResources(input_api, output_api))
|
||||
results.extend(_CheckDevtoolsLocalization(input_api, output_api))
|
||||
return results
|
||||
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
results = []
|
||||
@@ -199,8 +203,7 @@ def CheckChangeOnUpload(input_api, output_api):
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
results = []
|
||||
results.extend(_CommonChecks(input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasDescription(
|
||||
input_api, output_api))
|
||||
results.extend(input_api.canned_checks.CheckChangeHasDescription(input_api, output_api))
|
||||
return results
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Helper script to update CodeMirror from upstream.
|
||||
"""
|
||||
@@ -13,17 +12,20 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def parse_options(cli_args):
|
||||
parser = argparse.ArgumentParser(description='Roll CodeMirror')
|
||||
parser.add_argument('cm_dir', help='CodeMirror directory')
|
||||
parser.add_argument('devtools_dir', help='DevTools directory')
|
||||
return parser.parse_args(cli_args)
|
||||
|
||||
|
||||
def run_npm(options):
|
||||
print 'Building CodeMirror in %s' % os.path.abspath(options.cm_dir)
|
||||
subprocess.check_output(['npm', 'install'], cwd=options.cm_dir, stderr=subprocess.PIPE)
|
||||
subprocess.check_output(['npm', 'run', 'build'], cwd=options.cm_dir, stderr=subprocess.PIPE)
|
||||
|
||||
|
||||
def copy_lib_files(options):
|
||||
print 'Copying codemirror.js and codemirror.css'
|
||||
result = ''
|
||||
@@ -79,6 +81,7 @@ def find_and_copy_js_files(source_dir, target_dir, filter_fn):
|
||||
print 'Copying %s from %s' % (target_file, source_file)
|
||||
shutil.copyfile(source_file, target_file)
|
||||
|
||||
|
||||
def copy_cm_files(options):
|
||||
source_dir = os.path.join(options.cm_dir, 'addon')
|
||||
target_dir = os.path.join(options.devtools_dir, 'front_end', 'cm')
|
||||
@@ -88,6 +91,7 @@ def copy_cm_files(options):
|
||||
|
||||
find_and_copy_js_files(source_dir, target_dir, cm_filter)
|
||||
|
||||
|
||||
def copy_cm_modes_files(options):
|
||||
source_dir = os.path.join(options.cm_dir, 'mode')
|
||||
target_dir = os.path.join(options.devtools_dir, 'front_end', 'cm_modes')
|
||||
@@ -97,6 +101,7 @@ def copy_cm_modes_files(options):
|
||||
|
||||
find_and_copy_js_files(source_dir, target_dir, cm_modes_filter)
|
||||
|
||||
|
||||
def copy_cm_web_modes_files(options):
|
||||
source_dir = os.path.join(options.cm_dir, 'mode')
|
||||
target_dir = os.path.join(options.devtools_dir, 'front_end', 'cm_web_modes')
|
||||
@@ -106,6 +111,7 @@ def copy_cm_web_modes_files(options):
|
||||
|
||||
find_and_copy_js_files(source_dir, target_dir, cm_web_modes_filter)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
OPTIONS = parse_options(sys.argv[1:])
|
||||
run_npm(OPTIONS)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""
|
||||
Run Karma unit tests on a pre-built chrome or one specified via --chrome-binary.
|
||||
"""
|
||||
@@ -23,6 +22,7 @@ def check_chrome_binary(chrome_binary):
|
||||
def popen(arguments, cwd=None, env=None):
|
||||
return subprocess.Popen(arguments, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
|
||||
|
||||
|
||||
def to_platform_path_exact(filepath):
|
||||
if not is_cygwin:
|
||||
return filepath
|
||||
|
||||
Reference in New Issue
Block a user