Commit Graph

481 Commits

Author SHA1 Message Date
Gavin Mak
b084cd665f Fix CheckForCommitObjects to check missing gitlink changes
https://crrev.com/c/7234371 made some optimizations to the check
but caused it to start missing changes that modified DEPS but not
the corresponding gitlink.

Fix the check by doing a full tree scan when DEPS is updated.

Bug: 469784282
Change-Id: Ibdcdcb1af5a330e4d9e96daecd28e06bc1436022
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7362007
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josiah Kiehl <kiehl@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2026-01-06 10:36:28 -08:00
Josiah Kiehl
4244c70855 Handle Windows command line limits in CheckForCommitObjects.
On Windows, the command line has a character limit of 8191. When checking for commit objects in submodules, the `git ls-tree` command can become very long if many files are affected, potentially exceeding this limit.

This change modifies `CheckForCommitObjects` to check the estimated length of the `git ls-tree` command when running on Windows. If the command line with all affected files would exceed the limit, it falls back to using a recursive `ls-tree` (`-r`) instead of listing each file individually. This prevents command line overflow errors on Windows.

Change-Id: I6a340baefee57f5933473add0601a42ff1e61bb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7254474
Auto-Submit: Josiah Kiehl <kiehl@google.com>
Commit-Queue: Josiah Kiehl <kiehl@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
2025-12-11 18:23:44 -08:00
Josiah Kiehl
7c09ebfd12 Optimize CheckForCommitObjects by batching git ls-tree operations
Significantly reduces the execution time of presubmit checks by
optimizing CheckForCommitObjects.

For CLs with fewer than 1000 affected files, run `git ls-tree` only on
specific files instead of scanning the full tree. This yields a ~70x
speedup (~0.97s -> ~0.01s) for typical CLs.

Change-Id: Ia8b89dbb14a5129ba79944282deba52a3558bdf2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7234371
Commit-Queue: Josiah Kiehl <kiehl@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
2025-12-09 15:07:14 -08:00
Josiah Kiehl
b48cbb3e60 Optimize CheckForCommitObjects presubmit check
This CL optimizes CheckForCommitObjects in two ways:
- Fast Path: If the raw `git ls-tree` output does not contain `160000` (gitlink mode), return early. This avoids parsing entirely for repositories without submodules at the cost of about 3ms.
- Iterative Parsing: For repositories with submodules, use an iterative find loop to locate gitlink entries instead of splitting the entire tree content.

On the Chromium repo:
- Speed: The parsing step is ~7.7x faster (0.04s vs 0.30s).
- Memory: Saves ~78 MB of memory per run by avoiding the creation of ~300,000 string objects during the split.

I also added tests now that it's more than a simple loop.

Change-Id: I903effc50aaedb9130772491ad38385b22477d58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7231149
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josiah Kiehl <kiehl@google.com>
2025-12-09 10:55:42 -08:00
Lauren Minchin
f520a9305e Add canned check for AyeAye analyzers
Bug:b/464253715
Change-Id: I86bff67eac3aeae00cac9798cb9237e7c5364b10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7237916
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Lauren Minchin <lminchin@google.com>
2025-12-09 10:46:52 -08:00
Brian Sheedy
8e49ae5de8 Update submodules exception
Makes the following changes related to the exception made for fake
Chromium checkouts when checking git submodules:

1. Adds an instance of this being used in Dawn to the comment
2. Adds third_party/placeholder_chromium as an allowed dependency name
   since the "dummy" from third_party/dummy_chromium runs into the
   inclusive language checks.

Bug: 452840620
Change-Id: I65099d150cf9c4971e3183f1cb208df668582e4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7170740
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Auto-Submit: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
2025-11-18 14:47:31 -08:00
Garrett Beaty
8257337edc Update the freeze checks to support multiple freeze periods.
This updates the CheckInfraFreeze/CheckChromiumInfraFreeze functions to
operate on the _CHROMIUM_FREEZES list of tuples with start, end and
details that define freeze periods rather than a single freeze period
defined by the _CHROMIUM_FREEZE_START, _CHROMIUM_FREEZE_END and
_CHROMIUM_FREEZE_DETAILS values. This will enable defining the freeze
periods for end-of-year all at once rather than requiring an update
between the November and December/January periods.

The periods have been set to match the announced end-of-year freeze
dates.

Change-Id: I7ea9d19fad71d086cef3de0e02ea40fda35460ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7090808
Commit-Queue: Garrett Beaty <gbeaty@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
2025-11-13 10:57:54 -08:00
Gavin Mak
f5117c0007 Make CheckLicense warn locally
Only emit errors on standard CQ runs. Keep as warning for local runs to
reduce friction, and for full-tree CI checks to avoid breakage from
legacy files.

Bug: 454681814
Change-Id: I621ecc75cf5df40e4fd33ff439bfdc4f4c62e4fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7092462
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2025-10-29 09:58:56 -07:00
Scott Lee
5269eb4445 presubmit: fix git cl format failure in CheckPatchFormatted
CheckPatchFormatted passes the directory path of a given input file
to `git cl format` command if the directory doesn't directly contain
PRESUBMIT.py.

Now the presubmit check uses a diff file which includes a full list
of files to check the format of, and passing the directory is
no longer necessary.

Bug: 449775904
Change-Id: I50cdd58f46d058bbf5274f926578572573d814cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7018893
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2025-10-07 15:33:12 -07:00
Scott Lee
35982166cc Reland "presubmit: update CheckPatchFormatted to pass --input_diff_file"
This reverts commit 3accee0833.

Reason for revert: Fixes have been made
- crrev.com/c/6939737
- crrev.com/c/6943433

Original change's description:
> Revert "presubmit: update CheckPatchFormatted to pass --input_diff_file"
>
> This reverts commit 4689d66abf.
>
> Reason for revert: causing issues in b/386840832
>
> Original change's description:
> > presubmit: update CheckPatchFormatted to pass --input_diff_file
> >
> > Once devs update depot_tools, this will take effect in both
> > terminal and CiderG
> >
> > TESTED: http://go/scrcast/NjM1MzE5NDc4NjQ4ODMyMHxmMzc3NGVlZi03Yg
> > Bug: 386840832
> > Change-Id: Ibb8f74bffd662eb330f61b9e82bcd75c09bbc232
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6937365
> > Commit-Queue: Scott Lee <ddoman@chromium.org>
> > Reviewed-by: Gavin Mak <gavinmak@google.com>
>
> Bug: 386840832
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: I0bb79952aab4e0fa29607c79ea14f13f2a2a7bb3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6939736
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Scott Lee <ddoman@chromium.org>

Bug: 386840832
Change-Id: I699e87ab7c2543b835a0cb94062ee2225b88af28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6944257
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2025-09-15 07:26:12 -07:00
Scott Lee
3accee0833 Revert "presubmit: update CheckPatchFormatted to pass --input_diff_file"
This reverts commit 4689d66abf.

Reason for revert: causing issues in b/386840832

Original change's description:
> presubmit: update CheckPatchFormatted to pass --input_diff_file
>
> Once devs update depot_tools, this will take effect in both
> terminal and CiderG
>
> TESTED: http://go/scrcast/NjM1MzE5NDc4NjQ4ODMyMHxmMzc3NGVlZi03Yg
> Bug: 386840832
> Change-Id: Ibb8f74bffd662eb330f61b9e82bcd75c09bbc232
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6937365
> Commit-Queue: Scott Lee <ddoman@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>

Bug: 386840832
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I0bb79952aab4e0fa29607c79ea14f13f2a2a7bb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6939736
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2025-09-11 16:29:34 -07:00
Scott Lee
4689d66abf presubmit: update CheckPatchFormatted to pass --input_diff_file
Once devs update depot_tools, this will take effect in both
terminal and CiderG

TESTED: http://go/scrcast/NjM1MzE5NDc4NjQ4ODMyMHxmMzc3NGVlZi03Yg
Bug: 386840832
Change-Id: Ibb8f74bffd662eb330f61b9e82bcd75c09bbc232
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6937365
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2025-09-11 10:40:14 -07:00
Gregg Tavares
424bd24d29 Change the PRESUBMIT TODO warning to ask for an issue #
An issue # is the preferred format. See
https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#comment-style
so the warning should suggest an issue #

Note: the check remains the same so just an owner will pass the check
even though owners leave the team making such TODOs useless.

Bug: 440305604
Change-Id: Id107ccb104437201e873d96670c595b84fd90ab7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6917466
Reviewed-by: Scott Lee <ddoman@chromium.org>
Auto-Submit: Gregg Tavares <gman@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2025-09-08 11:40:50 -07:00
Matt Stark
9e9b885a7b Make git cl presubmit pass before running git cl upload.
This check is making any script which runs `git cl presubmit` locally fail.

In particular, `jj upload` runs `git cl presubmit`, and then uploads
only if it succeeds (we cannot run `git cl upload`, because that can
specifically only upload the currently checked out commit).

According to the bug I linked, "I think that historically it was possible
for developers to try to commit directly from their Chromium repo,
without uploading, and this aims to stop that. It also warns users that
their change has not been uploaded. Whether it still needs to be an
error is not clear, but I'm not sure it's causing any problems so I'm
inclined to leave it."

To sum things up:
* Since presubmits can be bypassed, this is not a security measure
* These days I don't believe you can commit directly from your chromium
  repo
* It's now starting to cause problems.

Bug: 40253731
Change-Id: I0d83fa68d0e65dcdd8932c7d3053750dcc16d3fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6875404
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Matt Stark <msta@google.com>
2025-08-28 17:38:25 -07:00
Ben Pastene
dc84b2708f Uncap max line length for *.star files
In https://crrev.com/c/6697693, presubmit's canned formatting checks
started looking at *.star files. This included enforcing a max line
length of 80 chars in such files.

Most (all?) *.star files found in gclient-managed repos are lucicfg
client repos, which generally have their own formatter and use 4-space
indents. This can lead to some friction with presubmit's 80 char limit.
So this uncaps that limit for all *.star files.

Bug: None
Change-Id: Ice68676c5d097d7951e83cf81ca9ac8adc8151ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6862147
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
2025-08-19 16:26:24 -07:00
Scott Lee
18fc4e5507 presubmit: add bypass-check-license instruction in the failure message
https://crrev.com/c/6842238 added the bypass instructions to
the presubmit failure messages, but it missed one place.

Bug: 435696543
Change-Id: Ic48b4cd3ba0f9797b48ff7e54f7a25b8c83a686b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6858267
Auto-Submit: Scott Lee <ddoman@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Brian Egizi <begizi@google.com>
2025-08-18 15:07:50 -07:00
Scott Lee
f88b25b610 Reland "presubmit: emit errors instead of warnings for bad copyright headers"
This reverts commit eb60ab38de.

Reason for revert: re-landing with an additional patch

-------------
* Problem
Browser infra runs ci.*-presubmit builders, such as linux-presubmit,
with --all to ensure that the entire chromium/src passes
presubmit checks.

crrev.com/c/6842238 changed the finding type for License Check
from warning to error, but the CI presubmit builders failed because
there are many files without valid CopyRight.

Not only the existing files, all the new files that are added with
`Bypass-Check-License: <reason> footer could also cause the presubmit
builder to fail.

* This CL

In addition to the original patch from crrev.com/c/6842238,
this CL makes additional patches to turn the CopyRight errors into
warnings, if --file or --all is given.

The same approach is used in
https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:presubmit_canned_checks.py;l=982-987;drc=eb60ab38deeda6975c9b0fef883978f2a9f69120


Bug: 435696543,40237859
Original change's description:
> Revert "presubmit: emit errors instead of warnings for bad copyright headers"
>
> This reverts commit fa62515ecb.
>
> Reason for revert: it seems that the existing files without valid copyright headers are causing linux-presubmit builds to fail. b/438791294
>
> Bug: 435696543,40237859
> Original change's description:
> > presubmit: emit errors instead of warnings for bad copyright headers
> >
> > This is an effective revert of https://crrev.com/c/4895337 with
> > additional patches to support a footer.
> >
> > https://crrev.com/c/3887721 updated CheckLicense() to emit errors
> > for bad copyright headers. However, https://crrev.com/c/4895337
> > was changed the finding type from error to warning, claiming that
> > the check is N/A for moved third files, but it's not so easy
> > to programatiically distinguish moved third-party files.
> >
> > After discussions, it was decided to change the finding type back
> > to error to prevent accidental submissions for new files without
> > correct CopyRight headers.
> >
> > To mitigate moved, third-party files, this CL adds support for
> > "Bypass-Check-License: <reason>" footer.
> >
> > If the check should be ignored in a given CL, CL authors should
> > use the footer instead.
> >
> > Bug: 435696543,40237859
> > Change-Id: I177915c65932a3d76ea60ee6a0e396f726bc400d
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6842238
> > Reviewed-by: Gavin Mak <gavinmak@google.com>
> > Commit-Queue: Scott Lee <ddoman@chromium.org>
>
> Bug: 435696543,40237859
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Change-Id: Ibedf8d13e3742249947e29e625a14cceaf89879c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6852377
> Commit-Queue: Scott Lee <ddoman@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Gavin Mak <gavinmak@google.com>

Bug: 435696543,40237859
Change-Id: Iafdb29b928c016eb3949e29fd43a2ba5f53e0ba0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6852108
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2025-08-15 10:47:31 -07:00
Scott Lee
eb60ab38de Revert "presubmit: emit errors instead of warnings for bad copyright headers"
This reverts commit fa62515ecb.

Reason for revert: it seems that the existing files without valid copyright headers are causing linux-presubmit builds to fail. b/438791294 

Bug: 435696543,40237859
Original change's description:
> presubmit: emit errors instead of warnings for bad copyright headers
>
> This is an effective revert of https://crrev.com/c/4895337 with
> additional patches to support a footer.
>
> https://crrev.com/c/3887721 updated CheckLicense() to emit errors
> for bad copyright headers. However, https://crrev.com/c/4895337
> was changed the finding type from error to warning, claiming that
> the check is N/A for moved third files, but it's not so easy
> to programatiically distinguish moved third-party files.
>
> After discussions, it was decided to change the finding type back
> to error to prevent accidental submissions for new files without
> correct CopyRight headers.
>
> To mitigate moved, third-party files, this CL adds support for
> "Bypass-Check-License: <reason>" footer.
>
> If the check should be ignored in a given CL, CL authors should
> use the footer instead.
>
> Bug: 435696543,40237859
> Change-Id: I177915c65932a3d76ea60ee6a0e396f726bc400d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6842238
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Scott Lee <ddoman@chromium.org>

Bug: 435696543,40237859
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Ibedf8d13e3742249947e29e625a14cceaf89879c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6852377
Commit-Queue: Scott Lee <ddoman@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2025-08-14 14:18:36 -07:00
Scott Lee
fa62515ecb presubmit: emit errors instead of warnings for bad copyright headers
This is an effective revert of https://crrev.com/c/4895337 with
additional patches to support a footer.

https://crrev.com/c/3887721 updated CheckLicense() to emit errors
for bad copyright headers. However, https://crrev.com/c/4895337
was changed the finding type from error to warning, claiming that
the check is N/A for moved third files, but it's not so easy
to programatiically distinguish moved third-party files.

After discussions, it was decided to change the finding type back
to error to prevent accidental submissions for new files without
correct CopyRight headers.

To mitigate moved, third-party files, this CL adds support for
"Bypass-Check-License: <reason>" footer.

If the check should be ignored in a given CL, CL authors should
use the footer instead.

Bug: 435696543,40237859
Change-Id: I177915c65932a3d76ea60ee6a0e396f726bc400d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6842238
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
2025-08-14 09:55:48 -07:00
Olivier ROBIN
435e3b303e Remove Python from the command in CheckGNFormatted
The command is passed directly to gn.main, so it does not
need the python executable.

Change-Id: I010bf68e86bf48b4b7387c26124ede216696449f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6793062
Reviewed-by: Brian Ryner <bryner@google.com>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
2025-07-28 08:20:26 -07:00
Jie Sheng
5d3a0d63c1 Add CheckValidHostsInDEPSOnUpload in presubmit_canned_checks.py
This check will call the gclient.py to verify the host in DEPS file.
Using the local path of the gclient.py file.
Will remove the same test in the PRESUBMIT.py in next cl.

Bug: 419888911
Change-Id: I59719a84bc3a901c52188a9ca2ea2a523c23dd4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6638231
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Jie Sheng <jiesheng@google.com>
2025-06-11 16:36:46 -07:00
Gavin Mak
21c86aad65 Specify full dirmd path in CheckDirMetadataFormat
If dirmd_bin` is not provided, default to an absolute path to dirmd.
Otherwise, some builders can fail with a `No such file or directory:
'dirmd'.` like:
https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/27711/infra

Bug: 416037494
Change-Id: Ibe3c0a80f2b605583321cce95241de62edcaec4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6533317
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2025-05-12 09:20:27 -07:00
Fumitoshi Ukai
a7571b1596 Reland "Reland "Use bundled python to run gn""
This reverts commit 6678906cf8.

Reason for revert:
run gn.py instead of gn on PATH in presubmit check.

Bug: 414312048
Original change's description:
> Revert "Reland "Use bundled python to run gn""
>
> This reverts commit 49fcbee29e.
>
> Reason for revert: This broke a presubmit check in devtools-frontend https://ci.chromium.org/ui/p/devtools-frontend/builders/try/dtf_presubmit_linux/b8715987965894722097/overview
>
> Bug: 414312048
> Original change's description:
> > Reland "Use bundled python to run gn"
> >
> > This reverts commit a3cdfed6c4.
> >
> > Reason for revert:
> > https://chromium-review.googlesource.com/c/chromium/src/+/6498495 landed
> >
> > Original change's description:
> > > Revert "Use bundled python to run gn"
> > >
> > > This reverts commit fa8fc854e1.
> > >
> > > Reason for revert: Most likely culprit for consistent failure
> > > to generate orderfiles (see crbug.com/414312048).
> > >
> > > Bug: 414312048
> > >
> > > Original change's description:
> > > > Use bundled python to run gn
> > > >
> > > > Change-Id: If01a7dae1aca72c93c87c1db27d2d37432094852
> > > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6490515
> > > > Reviewed-by: Junji Watanabe <jwata@google.com>
> > > > Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
> > > > Auto-Submit: Fumitoshi Ukai <ukai@google.com>
> > > > Commit-Queue: Fumitoshi Ukai <ukai@google.com>
> > >
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Change-Id: Id5e5f7cec91927aae144026aa16b169689881fb2
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6494846
> > > Owners-Override: Friedrich Hauser <friedrichh@chromium.org>
> > > Auto-Submit: Friedrich Hauser <friedrichh@chromium.org>
> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> >
> > Bug: 414312048
> > Change-Id: Id04cfe67ed994b91d794e51ba329f411de5d2d36
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6504176
> > Commit-Queue: Fumitoshi Ukai <ukai@google.com>
> > Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Reviewed-by: Junji Watanabe <jwata@google.com>
>
> Bug: 414312048
> Change-Id: Iadb3bd20af737c1e7404bf8e95c333f1dbd62942
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6508888
> Commit-Queue: Garrett Beaty <gbeaty@google.com>
> Reviewed-by: Garrett Beaty <gbeaty@google.com>
> Owners-Override: Garrett Beaty <gbeaty@google.com>
> Auto-Submit: Liviu Rau <liviurau@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: 414312048
Change-Id: I86d611b234bd5b2e91b184c7610c18cfe79f9816
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6515221
Reviewed-by: Junji Watanabe <jwata@google.com>
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2025-05-08 16:53:39 -07:00
Yiwei Zhang
e5cd6f84f0 include file_path in CheckJsonParses PRESUBMIT check
This is to test new feature added in
https://issues.chromium.org/404837554

Bug: 404837554
Change-Id: I3da40202091e08d9104f2b69d2a372ed786b3d36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6478701
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2025-04-22 16:39:21 -07:00
Sky Malice
c214cd9faf Add android resource files to DEFAULT_FILES_TO_CHECK.
The existing licence regex assumed each line would start with an unknown
and optional comment delimiter, followed by a required space. However
the standard way to write the licence in XML files uses a multi-line
comment, each individual line simply starts with the licence text, no
delimiter or space. The license check thus needed to be updated to make
the space optional as well.

Bug: 407060754
Change-Id: I4a83dd9408de890593952e441ba6b650f726907c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6409392
Commit-Queue: Sky Malice <skym@chromium.org>
Reviewed-by: Andy Perelson <ajp@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
2025-03-28 15:01:24 -07:00
Josip Sokcevic
c253820d11 [presubmit_canned_checks] Read DEPS file of modified repository
Read the DEPS file of a modified repository since submodules are coming
from it.

R=yiwzhang@google.com

Fixed: 402396938
Change-Id: I05c91c60b2b1ea58637242fb9970c3fabd58560e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6344911
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2025-03-11 13:27:13 -07:00
Josip Sokcevic
f8e16bdbd6 Reland^2: Fix CheckForRecursedeps to work for submodule based gclient DEPS
This reverts commit 7d6d4424b5.

Change-Id: Ibb05a6b6db2babef525a4230c01785570e074161
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6336451
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@google.com>
Commit-Queue: Robbie Iannucci <iannucci@google.com>
2025-03-07 14:15:25 -08:00
Josip Sokcevic
7d6d4424b5 Revert "[presubmit_support] Reland: Fix CheckForRecursedeps to work for submodule based gclient DEPS."
This reverts commit 4bef3f145a.

Reason for revert: https://crbug.com/401429917

Original change's description:
> [presubmit_support] Reland: Fix CheckForRecursedeps to work for submodule based gclient DEPS.
>
> R=sokcevic
>
> Bug: 401077549
> Change-Id: I68a2d153ce21e576ddc8b0449894e419097afba0
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6334747
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Auto-Submit: Robbie Iannucci <iannucci@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Bug: 401077549
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I38f20ca8915530f7f30e300f6f5d7590832c4ef7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6336255
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
2025-03-07 10:32:34 -08:00
Yiwei Zhang
cbf61c7044 CheckNewDEPSHooksHasRequiredReviewers checks approval from required
reviewers

The check mandates approval from required reviewers during submission.
Without it, the CL author could land the CL without explicitly
approval from required reviewers.

Bug: 396736534
Change-Id: I4671f123419b8f94a969b6caccf13a2064511a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6313625
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2025-03-07 09:46:45 -08:00
Robert Iannucci
4bef3f145a [presubmit_support] Reland: Fix CheckForRecursedeps to work for submodule based gclient DEPS.
R=sokcevic

Bug: 401077549
Change-Id: I68a2d153ce21e576ddc8b0449894e419097afba0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6334747
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2025-03-07 09:15:41 -08:00
Robbie Iannucci
01fcf2b8c5 Revert "[presubmit_support] Fix CheckForRecursedeps to work for submodule based gclient DEPS."
This reverts commit bb2a896987.

Reason for revert: Looks like this was insufficient - https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/25451/overview

Will investigate more tomorrow.

Original change's description:
> [presubmit_support] Fix CheckForRecursedeps to work for submodule based gclient DEPS.
>
> R=sokcevic
>
> Bug: 401077549
> Change-Id: I51fcabad5e563a65614d4b35e6600e7e511f7ba4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6330092
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Auto-Submit: Robbie Iannucci <iannucci@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Bug: 401077549
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I0730ea3f119b0acea7ed7a219cf723fc8116cd07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6334078
Owners-Override: Dan Le Febvre <dlf@google.com>
Commit-Queue: Dan Le Febvre <dlf@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Robbie Iannucci <iannucci@google.com>
Reviewed-by: Dan Le Febvre <dlf@google.com>
2025-03-06 22:47:51 -08:00
Robert Iannucci
bb2a896987 [presubmit_support] Fix CheckForRecursedeps to work for submodule based gclient DEPS.
R=sokcevic

Bug: 401077549
Change-Id: I51fcabad5e563a65614d4b35e6600e7e511f7ba4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6330092
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Robbie Iannucci <iannucci@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2025-03-06 17:54:29 -08:00
Yiwei Zhang
191c73e7a2 CheckNewDEPSHooksHasRequiredReviewers computes reviewers from OWNERS
Instead of taking reviewers as input args, it computes the reviewers
from the top-level OWNERS file because otherwise, all callers will
basically do the same thing at the callsite.

Bug: 396736534
Change-Id: I3ea83b8285fab8b75cb77b40b10414c6a3dea6b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6313624
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2025-03-03 12:08:55 -08:00
Yiwei Zhang
e5159abea6 Add CheckNewDEPSHooksHasRequiredReviewers canned check
This will later be used in chromium PRESUBMIT to ensure newly added DEPS
hook MUST be reviewed by a dedicated reviewer.

Bug: 396736534
Change-Id: I3859814c6316d4e576d12114277671ed5db80e33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6284565
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
2025-02-26 15:09:02 -08:00
Josip Sokcevic
9fd46c2b6b [presubmit] Check if .gitmodules diverges from DEPS
Raise presubmit error if .gitmodules file contains entry that doesn't
have gitlink, nor DEPS entry. This is desired as some tooling started to
depend on .gitmodules to learn about git dependencies.

Tested manually on chromium/src, based on the bug report test case.

R=ddoman@google.com

Bug: 392766700
Change-Id: I9dd8e03503b151f75e548acd0af098f342fc77a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6219822
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2025-01-30 14:38:36 -08:00
Jordan Brown
fd65288d4a Add is_open_source_project to metadata validation
Reciprocal licenses can only be used in open source projects.
This change updates the presubmit validation checks to accept an
optional flag `allow_reciprocal_licenses`. When True, the allowlist is
extended to include reciprocal licenses.

Bug: 385020146
Change-Id: I0374658207bc87ffd74e033762ee4973c6e83b3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6107863
Reviewed-by: Jordan Brown <rop@google.com>
Auto-Submit: Jordan Brown <rop@google.com>
Reviewed-by: Rachael Newitt <renewitt@google.com>
Commit-Queue: Rachael Newitt <renewitt@google.com>
2025-01-12 14:07:21 -08:00
Mike Frysinger
0d07dd258c pylint: add v3.2 support
Change-Id: I120bd70adda6ea53e976ba47aa63d1dc622c6663
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6150454
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2025-01-08 11:42:24 -08:00
Mike Frysinger
d6c2e1b339 presubmit_canned_checks: hack to avoid analyzer triggers
The analyzer is finding these literal strings and putting error
messages into new CLs.  Hack the string up to avoid that.

Change-Id: I8335e6f5e29ca4c2257010629f46036bc250ff73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6147794
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
2025-01-07 09:30:40 -08:00
Yiwei Zhang
40ef124163 exempt LINT.ThenChange line when checking long line
LINT.ThenChange is followed by path which sometimes may exceed the
length limit

Bug: 382239821
Change-Id: I2142fd3326704593bd46c8937b1bb904bcef4763
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6077446
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2024-12-09 22:10:07 +00:00
Erik Staab
67ddd5efb7 Update holiday freeze dates to reflect policy
Context: http://shortn/_5jjB9kobEg (internal)

Change-Id: I4ad85fb57914ef6577704f5ba9f3f13f2f530c25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6075718
Commit-Queue: Erik Staab <estaab@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2024-12-09 20:46:48 +00:00
Gary Tong
bd7f36598e Make the freeze check Chromium-specific and update dates
Bug: 381098374
Change-Id: I52456322481e546f48175e33ef330dfd8306c28c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6048214
Auto-Submit: Gary Tong <gatong@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Garrett Beaty <gbeaty@google.com>
Commit-Queue: Gary Tong <gatong@chromium.org>
2024-11-27 18:44:48 +00:00
Gavin Mak
c0796a593a Revert "Update freeze dates for 2024 Thanksgiving week"
This reverts commit 584e8366be.

Reason for revert: Android freeze, not Chrome

Original change's description:
> Update freeze dates for 2024 Thanksgiving week
>
> Change-Id: I20b1bb68d181f5d05f7dc91f270cbd97a26409ae
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6049175
> Auto-Submit: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Brian Ryner <bryner@google.com>
> Reviewed-by: Brian Ryner <bryner@google.com>

Change-Id: I139470cec0e786658e08344090b1a5a658d2ca28
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6052245
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Gavin Mak <gavinmak@google.com>
2024-11-26 18:08:07 +00:00
Gavin Mak
584e8366be Update freeze dates for 2024 Thanksgiving week
Change-Id: I20b1bb68d181f5d05f7dc91f270cbd97a26409ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6049175
Auto-Submit: Gavin Mak <gavinmak@google.com>
Commit-Queue: Brian Ryner <bryner@google.com>
Reviewed-by: Brian Ryner <bryner@google.com>
2024-11-25 21:52:16 +00:00
Philipp Wollermann
c4d75a1519 presubmit: Improve CheckInfraFreeze error message
I didn't understand from the error message how to correctly set the git-footer in my commit message, so that the override takes effect.

Maybe this version is easier for new devs?

Change-Id: I745d80f0e8068500137d9382f423d0c65a922f5b
Ignore-Freeze: Low risk
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5930648
Auto-Submit: Philipp Wollermann <philwo@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2024-10-15 13:33:54 +00:00
Josip Sokcevic
ed89aaf597 Update freeze dates for 2024, internal conference
Change-Id: If5d90a728ce765a7c6ad451a58698c59ec563b44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5913187
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Erik Staab <estaab@chromium.org>
2024-10-09 16:47:50 +00:00
Scott Lee
17a0d843c1 allow comment lines in inclusive_language_presubmit_exempt_dirs.txt
inclusive_language_presubmit_exempt_dirs.txt is a list of
paths to exclude from the inclusive word presubmit check.
https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:presubmit_canned_checks.py;l=2602;drc=0bc7c4832e4f2d453e4826c9a2e1197e11bd6ec7

This CL allows comment lines, starting with \#, in the file.
(Also, fixes a bug to allow an empty line)

Bug: 369701326
Change-Id: I7647459281f7921362aa4070c26671f321b7cfea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5906016
Auto-Submit: Scott Lee <ddoman@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2024-10-04 21:02:25 +00:00
Josip Sokcevic
0bc7c4832e [PRESUBMIT] Read DEPS file from Git in CheckForCommitObjects
CheckForCommitObjects is not working correctly if there is a
PanProjectChecks in non-root PRESUBMIT.py together with a DEPS file in
the same directory. Instead, PRESUBMIT needs to check the root DEPS
file.

In order to get commit objects (gitlink), we need to run Git ops.  This
patch relies on Git to provide the root DEPS file.

R=gavinmak@google.com

Fixed: 359944302
Change-Id: I7934a24c1ea8e6b6daa2f936ad4209ad9cdad5ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5784174
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2024-08-16 21:19:29 +00:00
Josip Sokcevic
2517f89cdf Reland "[presubmit checks] Check if files are written to a dep dir"
This is a reland of commit 561772c448

Original change's description:
> [presubmit checks] Check if files are written to a dep dir
>
> No files should be written to a directory that's used by CIPD or GCS, as
> defined in DEPS. Git already doesn't allow files to be written to a
> directory that's a gitlink.
>
> R=jojwang@google.com
>
> Bug: 343199633
> Change-Id: I8d3414eac728580eaf9ac7e337bb22bca3989e4e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5633187
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Bug: 343199633
Change-Id: Ifc3f6c4df328cdd215ceb7d0333f68223e9a1ccb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5643922
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
2024-06-20 18:11:10 +00:00
Gavin Mak
4d36c419f3 Revert "[presubmit checks] Check if files are written to a dep dir"
This reverts commit 561772c448.

Reason for revert: `KeyError: 'deps'` breaking some builds

Original change's description:
> [presubmit checks] Check if files are written to a dep dir
>
> No files should be written to a directory that's used by CIPD or GCS, as
> defined in DEPS. Git already doesn't allow files to be written to a
> directory that's a gitlink.
>
> R=jojwang@google.com
>
> Bug: 343199633
> Change-Id: I8d3414eac728580eaf9ac7e337bb22bca3989e4e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5633187
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Bug: 343199633
Change-Id: I26b8e72320260e394a72aee1f7e67dfc2b3e2987
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5641258
Auto-Submit: Gavin Mak <gavinmak@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2024-06-18 23:51:17 +00:00
Josip Sokcevic
561772c448 [presubmit checks] Check if files are written to a dep dir
No files should be written to a directory that's used by CIPD or GCS, as
defined in DEPS. Git already doesn't allow files to be written to a
directory that's a gitlink.

R=jojwang@google.com

Bug: 343199633
Change-Id: I8d3414eac728580eaf9ac7e337bb22bca3989e4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5633187
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2024-06-18 20:20:24 +00:00