Commit Graph

306 Commits (f78dd18ee16651fb34e4cfccfa266e151ba6adb8)

Author SHA1 Message Date
seanmccullough faaed2f486 [depot_tools, chromium/src] mv CheckInclusiveLanguage into canned checks
Also adds a new canned_presubmit_checks_test.py and supporting mocks,
based on the PRESUBMIT_*.py under chromium/src.

If this is OK, there are subsequent CLs for removing the original code
from chromuim/src and infra/infra, and having their PRESUBMIT scripts
just reference this canned check instead.

Change-Id: I67dfb7ac0b4cdc36bd62ec2dc062ca5c78c2244e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2805268
Commit-Queue: Sean McCullough <seanmccullough@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
4 years ago
Stephen Martinis 7837307d38 Delete CheckBuildbotPendingBuilds
This check has been disabled basically everywhere since about 2013. It
should be safe to remove this; there will be warnings when trying to
skip it, but it shouldn't fail any builds.

Recipe-Nontrivial-Roll: build
Bug: 1194216
Change-Id: I84878f9e46543ae71f7e4e057b99d15a034e0d0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2794799
Commit-Queue: Stephen Martinis <martiniss@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes c900fe5760 presubmit: Also skip owners check on upload if code-owners is enabled.
Change-Id: I6f136321750b4e9f2514f04a6f357272d35e9b4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775715
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 8170c29fd1 Reland "presubmit: Skip owners checks if code-owners plugin is enabled."
This is a reland of 2cf835a9ba

URL-encoded repo path, so chromium/src becomes chromium%2Fsrc
as Gerrit expects

Original change's description:
> presubmit: Skip owners checks if code-owners plugin is enabled.
>
> If code-owners plugin is enable for the repo, skip owners check on
> commit, and skip checking owners format, as that will be done by
> the plugin.
>
> Change-Id: I1663baef4f0f27b00423071343fe740f6da50ce7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2727131
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I3038590f3a92cbf7b6dc0ba6eb47f72593a2ccf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775840
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes c456617ddd presubmit: Allow Bot-Commit+1 to self-approve change.
Change-Id: I29a7aeb6f797be015f29e1e514bbe44988a1221e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775839
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Dirk Pranke e4bab45474 Reland "presubmit: Don't skip OWNERS check when Bot-Commit+1 is present."
This reverts commit e7c0581740.

Reason for revert: Whoops. chromium/src was updated. I was confused by a conversation on the #ops slack channel and my checkout being slightly out of date. I think the original change was actually okay.

Original change's description:
> Revert "presubmit: Don't skip OWNERS check when Bot-Commit+1 is present."
>
> This reverts commit 9757ad5883.
>
> Reason for revert: We need to update callers first (e.g., //PRESUBMIT.py in chromium/src).
>
> Original change's description:
> > presubmit: Don't skip OWNERS check when Bot-Commit+1 is present.
> >
> > Change-Id: I17b07796a86c5214e13a0058428889c1bb2b850d
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2774080
> > Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> > Reviewed-by: Jason Clinton <jclinton@chromium.org>
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
>
> Change-Id: I02c3d5ea2e65ef852d34a6816d04fe1cad82823a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775101
> Auto-Submit: Dirk Pranke <dpranke@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: I2c1ae8c60938cbd9316e9075488cc7451068a2f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775103
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Auto-Submit: Dirk Pranke <dpranke@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
4 years ago
Dirk Pranke e7c0581740 Revert "presubmit: Don't skip OWNERS check when Bot-Commit+1 is present."
This reverts commit 9757ad5883.

Reason for revert: We need to update callers first (e.g., //PRESUBMIT.py in chromium/src).

Original change's description:
> presubmit: Don't skip OWNERS check when Bot-Commit+1 is present.
>
> Change-Id: I17b07796a86c5214e13a0058428889c1bb2b850d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2774080
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Jason Clinton <jclinton@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I02c3d5ea2e65ef852d34a6816d04fe1cad82823a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775101
Auto-Submit: Dirk Pranke <dpranke@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
4 years ago
Edward Lesmes 9757ad5883 presubmit: Don't skip OWNERS check when Bot-Commit+1 is present.
Change-Id: I17b07796a86c5214e13a0058428889c1bb2b850d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2774080
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Josip Sokcevic ec3c39536a Revert "presubmit: Skip owners checks if code-owners plugin is enabled."
This reverts commit 2cf835a9ba.

Reason for revert: doesn't work with depot_tools

error 404 Not found: tools (with applied patch from 2729404)

Bug: 1183975

Original change's description:
> presubmit: Skip owners checks if code-owners plugin is enabled.
>
> If code-owners plugin is enable for the repo, skip owners check on
> commit, and skip checking owners format, as that will be done by
> the plugin.
>
> Change-Id: I1663baef4f0f27b00423071343fe740f6da50ce7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2727131
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: Id4d560701e4b0144e0aafc5263e09ed6927f6222
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2729409
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
4 years ago
Edward Lesmes 2cf835a9ba presubmit: Skip owners checks if code-owners plugin is enabled.
If code-owners plugin is enable for the repo, skip owners check on
commit, and skip checking owners format, as that will be done by
the plugin.

Change-Id: I1663baef4f0f27b00423071343fe740f6da50ce7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2727131
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes ac34821d37 presubmit: Make email_regexp argument optional.
Make email_regexp argument to GetCodeReviewOwnerAndReviewers
optional. This will make it possible to remove it from
downstream PRESUBMIT.py scripts that pass it.

Change-Id: I45168c1f4137e7e797b30d050e4ee82f6e26daf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2679763
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes e342fb16f9 Don't suggest change author as reviewer.
Change-Id: Ie34fc34883b2c86fc134f10ded24b26a631886ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2676835
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Josip Sokcevic 8c95595001 Remove non-inclusive parameters from presubmit
R=ehmaldonado@google.com

Bug: 1118435, 1118436
Change-Id: Ie66b2cb39a3d8abc83679bee44d2e594eba77442
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2657981
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes 1076f38947 Reland "presubmit: Use new API to check for owners approval"
This is a reland of 0489cc12af

Don't remove email_regexp argument, as downstream still passes it.

Original change's description:
> Reland "presubmit: Use new API to check for owners approval"
>
> New API was updated to properly support '*' as owner.
>
> Change-Id: If14144f83484731fd5534c03cb9fde4b18f49fe9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2628703
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: Id137aca0036c2ebf11ec56a12f4e053cd2cc6637
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2639411
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes 0eb104764a Revert "Reland "presubmit: Use new API to check for owners approval""
This reverts commit 0489cc12af.

Reason for revert:
Chromium presubmit needs to be updated too

Original change's description:
> Reland "presubmit: Use new API to check for owners approval"
>
> New API was updated to properly support '*' as owner.
>
> Change-Id: If14144f83484731fd5534c03cb9fde4b18f49fe9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2628703
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,gavinmak@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Change-Id: Id6f55a8fbc692ad1a82154a6646d487bb37cbe63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2637539
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 0489cc12af Reland "presubmit: Use new API to check for owners approval"
New API was updated to properly support '*' as owner.

Change-Id: If14144f83484731fd5534c03cb9fde4b18f49fe9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2628703
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Ben Pastene 703f21e217 Revert "presubmit: Use new API to check for owners approval"
This reverts commit 64d94deaa6.

Reason for revert: tentative revert for https://crbug.com/1166467

Original change's description:
> presubmit: Use new API to check for owners approval
>
> It also allows us to improve unit tests.
>
> Change-Id: I356a2fddcbcc5af0e628f79ede1ba277008f5cde
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2612222
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,gavinmak@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Bug: 1166467
Change-Id: I1df97f8fdbc56942fdcc7bafffed517e24a9481d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2628574
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
4 years ago
Edward Lesmes 64d94deaa6 presubmit: Use new API to check for owners approval
It also allows us to improve unit tests.

Change-Id: I356a2fddcbcc5af0e628f79ede1ba277008f5cde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2612222
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes c1aa4ecfcc Reland "presubmit: Don't print comments for missing reviewers."
This is a reland of 276bab4c6e

Fixed to include author on the list of reviewers.

Original change's description:
> presubmit: Don't print comments for missing reviewers.
>
> Don't print owners comments when suggesting missing reviewers,
> as this won't be supported when using Gerrit API.
>
> Change-Id: I644b2f87b58a3c9ece3aa7d107100f3501bd3071
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2607675
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I6dfb2087022ad87595e6cabc50d42a8bdf6311b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2615918
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes 3c57b27ae1 Revert "presubmit: Don't print comments for missing reviewers."
This reverts commit 276bab4c6e.

Reason for revert:
Possible cause of crbug.com/1163731

Original change's description:
> presubmit: Don't print comments for missing reviewers.
>
> Don't print owners comments when suggesting missing reviewers,
> as this won't be supported when using Gerrit API.
>
> Change-Id: I644b2f87b58a3c9ece3aa7d107100f3501bd3071
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2607675
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,gavinmak@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Bug: 1163731
Change-Id: I0b3d0f352e5483e754f6b790f70a9278df4eb3e2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2613924
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 276bab4c6e presubmit: Don't print comments for missing reviewers.
Don't print owners comments when suggesting missing reviewers,
as this won't be supported when using Gerrit API.

Change-Id: I644b2f87b58a3c9ece3aa7d107100f3501bd3071
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2607675
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes d79114a2ed [presubmit] Add check to prevent new metadata in OWNERS files.
Bug: 1113033
Change-Id: I000cd307fea8862b9ef9cab907aafd357ee761bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2582566
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes 1ec57124a6 [presubmit] Add option to ignore TBR on PRESUBMIT.py checks.
Change-Id: Ibd1a5fa67aca0c273e8289d0726afeaeb88754d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2568908
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes cf49cb8206 [presubmit][owners] Skip owners check when Owners-Override is +1
Add support for Owners-Override label to allow trusted bots, sheriffs,
and global owners to bypass owners checks.

Bug: 1093627
Change-Id: Ie217369a67e4060807c0a12f84430e30a7c57daa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2530488
Reviewed-by: Yulan Lin <yulanlin@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes 02d4b82580 [presubmit][owners] Skip owners check when Bot-Review is +1
Add support for Bot-Review label to allow trusted bots to
bypass owners checks.

Bug: 1093627
Change-Id: Ie7398041e9e32fd87bb415b239b5ec0a4740e1ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2530516
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Yulan Lin <yulanlin@google.com>
5 years ago
Andrew Grieve 02ffb6f47a CheckDirMetadataFormat: LocalPath() -> AbsoluteLocalPath()
LocalPath() should be used in error messages, but never when actually
trying to access a path.

Bug: 1127507
Change-Id: I03ec5421891ac67a8620cd3c7e88c2de1811e914
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2418914
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
5 years ago
Josip Sokcevic c6aa151180 Warn only if non-inclusive term is used
This fixes the issue where presubmit_canned_checks issues a warning if
optional arguments in CheckAuthorizedAuthor are not used at all.

This relands commit b09f2bb2f2 with some
additional changes.

R=apolito@google.com

Bug: 1098560
Change-Id: If323d90ab7d6bcca68ed89142ea67edc4be057d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2373216
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Josip Sokcevic b09f2bb2f2 Revert "Warn when non-inclusive parameters are used"
This reverts commit 149a3b7581.

Reason for revert: warnings are issued if no optional parameters
are passed.

Original change's description:
> Warn when non-inclusive parameters are used
> 
> R=​apolito@google.com
> 
> Bug: 1098560
> Change-Id: Iabc2a5d89a6af1418c1228f3c09eacbbd799b5c7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2355112
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>

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

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

Bug: 1098560
Change-Id: Ib0f188de90121c692f5c0d7271938ee312917fd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2376042
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Josip Sokcevic 149a3b7581 Warn when non-inclusive parameters are used
R=apolito@google.com

Bug: 1098560
Change-Id: Iabc2a5d89a6af1418c1228f3c09eacbbd799b5c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2355112
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lesmes 7291750ae2 presubmit: Add dirmd_bin to CheckDirMetadataFormat.
dirmd is not available on bots, so we'll need to receive the path
where it's available as an argument.

Bug: 1102997
Change-Id: I8966225d8ded3eb06c504797280baaa6c6c64a9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2321510
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes a58287b8ee presubmit: Also validate metadata in OWNERS files.
Bug: 1102997
Change-Id: Id847129d320004fcd121941f2e14cf9ad56ab4a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2318335
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Josip Sokcevic d855b92743 Make presubmit_canned_checks inclusive
This modifies CheckAuthorizedAuthor parameters to be inclusive while
being backwards compatbile. Also, it fixes issue with empty lists.

R=ehmaldonado@chromium.org

Bug: 1098560
Change-Id: I992b25d6408d6cb906fa1696209de253e50c5156
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2316706
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Lei Zhang b8c62cf5f4 Add default filters to git cl lint.
Use the same set of default filters as presubmit checks. Presubmit
checks use filters to give better lint results as expected by Google C++
style. Give git-cl's lint subcommand the same benefit.

Bug: 1106028
Change-Id: I51ff0737b310990ab424376d2721e8a6a50dfc6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2298122
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes 6d938a0d85 presubmit_canned_checks: Add DIR_METADATA presubmit checks.
- Add a check to validate DIR_METADATA files.
- Add a check to enforce that OWNERS files contain no metadata if a
  DIR_METADATA file is present in the same directory.

Bug: 1102997
Change-Id: Iedb09941001577dc81b1dda2241481ff667b2568
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2298330
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
5 years ago
local_bot 6402141d1f Rename blocklist/allowlist to skip_list/check_list
This change is backwards compatible.

R=dpranke@google.com

Bug: 1098560
Change-Id: Ic9447041a68b8c379f65900af11c89b006e3f806
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2285156
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
5 years ago
local_bot 30f774ef87 Rename whitelist/blacklist to allowlist/blocklist
R=apolito@google.com, ehmaldonado@chromium.org

Bug: 1098562
Bug: 1098560
Change-Id: I45dc739f9e6d1a2e9bfcd9fa0587f4bb4a115c5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2265255
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Peter Kasting 5ff7ad23ae Remove lint checks for non-const references.
These are now allowed by the Google style guide.

Bug: none
Change-Id: Ib182011ce489ee218cf673842be633626507cd60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2248714
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
5 years ago
Leandro Lovisolo 44de5e3f65 presubmit_canned_checks.py: Ignore long TypeScript imports.
Change-Id: If9e133002e2cdcff42917a487a677f3ed73d4d3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2241184
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
5 years ago
Aaron Gable 6e7ddb698b Remove agable from depot_tools OWNERS and TODOs
Change-Id: I0667af4562208a111ab3673f3fca6aab655f5f26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2218962
Auto-Submit: Aaron Gable <agable@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Anthony Polito <apolito@google.com>
5 years ago
Robert Brandt beb877fe49 depot_tools: bugfix for py3 syntax and bytes/str changes
Also update copywrite header to conform to expectations.

BUG=chromium:1082354
TEST=locally, can upload commit with this fix

Change-Id: I5527cf9cc58fbab94f777b82008a422a3190f539
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2199884
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Derek Morris 053213d049 Add a pan-project presubmit check for commits in tree
It's possible to add commit objects to the tree, and this can cause
some confusion for git's tools - if this happens to overlap with an
actual folder or a gclient-imported repo, the tree will be dirty.

This change finds this issue by scanning the tree and looking for a
commit object there.

Bug: 869594
Change-Id: Ia1f1fb22ab8f7ac1eed7b32dedad5c1296b1d67b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1842637
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Derek Morris <demorri@microsoft.com>
5 years ago
Samuel Huang c1e1d099bd [Presubmit] Allow GetUnitTestsRecursively() to restrict Python versions.
GetUnitTests() has named params {run_on_python2, run_on_python3}.
This CL adds these params to GetUnitTestsRecursively() so they can be
forwarded to GetUnitTests().

Bug: https://crbug.com/1054018
Change-Id: I06ac25a37f94cdea1cdc91954b70113e54cfdd15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2107610
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
5 years ago
Edward Lemur bce1ec1d57 Reland "presubmit_canned_checks: Run pylint on parent directory for depot_tools."
This is a reland of d3bfd23c6d

Don't modify cwd for paths other than depot_tools.

Original change's description:
> presubmit_canned_checks: Run pylint on parent directory for depot_tools.
>
> On Windows, scripts on the current directory take precedence over PATH.
> When pylint.bat calls vpython, it executes the vpython of the depot_tools
> under test instead of the one in the bot.
> As a workaround, run the tests from the parent directory instead.
>
> Change-Id: I7fa3f5b268df516194063ff39907ada18f7ef544
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1994216
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

No-Presubmit: True
Change-Id: I4236ec17b2642ed7f53844af532ec1f5234b80d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1995783
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Dean Berris a1266b63b5 Revert "presubmit_canned_checks: Run pylint on parent directory for depot_tools."
This reverts commit d3bfd23c6d.

Reason for revert: Breaks non-depot_tools based presubmits that use canned checks that expect the presubmit to be run in the sub-repository (for example, in Catapult where it's hosted in third_party/catapult instead of being directly in chromium).

Original change's description:
> presubmit_canned_checks: Run pylint on parent directory for depot_tools.
> 
> On Windows, scripts on the current directory take precedence over PATH.
> When pylint.bat calls vpython, it executes the vpython of the depot_tools
> under test instead of the one in the bot.
> As a workaround, run the tests from the parent directory instead.
> 
> Change-Id: I7fa3f5b268df516194063ff39907ada18f7ef544
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1994216
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,apolito@google.com

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

Change-Id: If989527a53be90e1ae32cb3fa30f5e4777824480
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1994753
Reviewed-by: Dean Berris <dberris@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Dean Berris <dberris@chromium.org>
5 years ago
Edward Lemur d3bfd23c6d presubmit_canned_checks: Run pylint on parent directory for depot_tools.
On Windows, scripts on the current directory take precedence over PATH.
When pylint.bat calls vpython, it executes the vpython of the depot_tools
under test instead of the one in the bot.
As a workaround, run the tests from the parent directory instead.

Change-Id: I7fa3f5b268df516194063ff39907ada18f7ef544
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1994216
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Garrett Beaty ed0cc5f6fd Add flag to "git cl format" to avoid invoking clang-format.
In repos that are checked out separately from chromium, invoking
"git cl format" on a change that has files that would be formatted using
clang-format causes an error because the depot_tools version of
clang-format looks for a clang-format inside the repo.

This prevents using proto-based properties (the preferred mechanism
going forward) in recipe repos that enforce formatting. The
--no-clang-format flag provides a workaround that can be used to
prevent trying to format any files where clang-format doesn't work.

Bug: 979330
Change-Id: Ice8561d88b29623deb953465253f92c88aa7fc2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1986111
Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Dan Beam f392703d63 Exclude ES imports from long lines check
Bug: 1028829
Change-Id: Iafc40952e402884639543436281e93942c0257a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1959813
Auto-Submit: Dan Beam <dbeam@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur b983024505 presubmit_support: Fix tests on Python 3.
The problems on crbug.com/1017367 should have been fixed by crrev.com/c/1880013

Bug: 1009814
Change-Id: Ia98304ca983b4e7e293fedb9df1fee589de58ba9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1887714
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Haiyang Pan 5eb757a742 Skip non-text files for CheckDoNotSubmitInFiles
Bug: 1017286
Change-Id: Ibb9f2c94eb87024a3d9b9f334ffa5f8e2429b368
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1881377
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Haiyang Pan <hypan@google.com>
6 years ago
Edward Lemur d2a5a4c043 Revert "presubmit_support: Fix tests on Python 3."
This reverts commit a834f39e21.

Reason for revert:
https://bugs.chromium.org/p/chromium/issues/detail?id=1017367

Original change's description:
> presubmit_support: Fix tests on Python 3.
>
> Bug: 1009814
> Change-Id: I2c2a835fc4fa0a7fc9e68dfff680fb0beacb491e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1869535
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,apolito@google.com

Bug: 1009814
Change-Id: I48907caeca9b9b32e4e3a7cb5a636280d017a4c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1877350
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago