0

Add configs to avoid formatting code under third-party

There are >300 projects under third_party but only 3 maintained in
chromium/src which require formatting. Add language specific formatter
configs listed in git_cl.py except java, python, mojom and lucicfg. This
helps us mesure the scale vendored code diverged from upstream. Also
includes overrides for 3 projects are known to be maintained in
chromium/src under third_party.

There is no easy way to ignore java and python files so we will leave it
for now until we get the data. mojom and lucicfg aren't considered an
issue.

Bug: 397081590
Change-Id: I32917804f079848782dbe21a9b4fe45aecc9d063
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6441671
Reviewed-by: Rachael Newitt <renewitt@google.com>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Chenlin Fan <fancl@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1447455}
This commit is contained in:
Chenlin Fan 2025-04-15 16:33:51 -07:00 committed by Chromium LUCI CQ
parent 0b92cf6603
commit c822490a82
7 changed files with 29 additions and 2 deletions

@ -20,7 +20,8 @@ wrap_comments = true
use_small_heuristics = "Max"
# Third party code is formatted upstream.
# Please use negative pattern (!path) for any path you do want to format.
ignore = [
"third_party/rust/**/crate",
"third_party/rust/chromium_crates_io/vendor",
"third_party/**",
"!third_party/blink/**",
]

@ -1,6 +1,17 @@
# Generated protobuf code.
*_pb2.py
# Ideally all third-party code should be ignored by default.
# Unfortunately yapfignore doesn't support negative pattern (they use fnmatch)
# and is searched from current working directory instead of where the file is
# located. We won't be able to override the config to enable yapf for some
# files under third_party/*.
# Though this is done by git_cl.py anyway since yapfignore is ignored when file
# list is provided explicitly.
# https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:git_cl.py;l=747;drc=f5b53c0e98a814aa8d026b07288211a5e4421000
# Thers is no consistent way to ignore python code here unless we make yapf
# properly implement the yapfignore.
# Third-party code.
third_party/blink/tools/blinkpy/third_party/*
third_party/blink/web_tests/external/wpt/*

5
third_party/.clang-format-ignore vendored Normal file

@ -0,0 +1,5 @@
# Ignore all vendored third-party code. If any first-party code need to be
# formatted, please put a config under your own directory to void this one.
# https://clang.llvm.org/docs/ClangFormat.html#clang-format-ignore
**

7
third_party/.swift-format-ignore vendored Normal file

@ -0,0 +1,7 @@
# Ignore all vendored third-party code. If any first-party code need to be
# formatted, please put a config under your own directory to void this one.
# NOTE: until https://github.com/swiftlang/swift-format/issues/870 is done,
# this file will NOT have effect. Also swiftfmt has to be updated. At this
# stage (2025-Q1) there is no easy way for swiftfmt to ignore files.
*

@ -0,0 +1 @@
# Void parent level config to enable formatting.

1
third_party/ipcz/.clang-format-ignore vendored Normal file

@ -0,0 +1 @@
# Void parent level config to enable formatting.

@ -0,0 +1 @@
# Void parent level config to enable formatting.