Commit 417d89c3 authored by Andreas Haas's avatar Andreas Haas Committed by LUCI CQ

Revert "Enable Javascript formatting by default"

This reverts commit 42a51f6a.

Reason for revert: With this change also JavaScript code in the
V8 code base gets formatted. However, clang-format cannot deal with
V8 intrinsics, and therefore inserts a space between the `%` and the
intrinsics name. With that Clusterfuzz cannot detect intrinsics
anymore, and therefore the blacklisting of intrinsics would not
work anymore. The result is that Clusterfuzz then produces useless
test cases that are known to crash and could not exist in the wild.

Original change's description:
> Enable Javascript formatting by default
> 
> This removes the need for explicitly passing `--js` to `git cl format`
> to format both JavaScript and TypeScript. It would reduce a significant
> amount of mental overhead for formatting code in DevTools frontend,
> which is primarily JS/TS.
> 
> Fixed: 1007347
> Change-Id: Ia35c9af677d12ce9be72fe5fcdd6ceb6cb039c5f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2029371
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>

TBR=tvanderlippe@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I13e8ce8916f0685b667607f2c8e68b1185d43329
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2041650Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
parent e868546a
......@@ -5238,15 +5238,8 @@ def CMDformat(parser, args):
parser.add_option(
'--js',
action='store_true',
default=None,
help='Format javascript code with clang-format. '
'Has no effect if --no-clang-format is set.')
parser.add_option(
'--no-js',
action='store_true',
default=False,
help='Disable JavaScript/TypeScript formatting code with clang-format. '
'Has no effect if --no-clang-format is set.')
parser.add_option('--diff', action='store_true',
help='Print diff to stdout rather than modifying files.')
parser.add_option('--presubmit', action='store_true',
......@@ -5257,10 +5250,6 @@ def CMDformat(parser, args):
raise parser.error('Cannot set both --python and --no-python')
if opts.no_python:
opts.python = False
if opts.js is not None and opts.no_js:
raise parser.error('Cannot set both --js and --no-js')
if opts.no_js:
opts.js = False
# Normalize any remaining args against the current path, so paths relative to
# the current directory are still resolved as expected.
......@@ -5293,8 +5282,7 @@ def CMDformat(parser, args):
# Filter out files deleted by this CL
diff_files = [x for x in diff_files if os.path.isfile(x)]
js_explicitly_disabled = opts.js is not None and not opts.js
if not js_explicitly_disabled:
if opts.js:
CLANG_EXTS.extend(['.js', '.ts'])
clang_diff_files = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment