0
Commit Graph

66 Commits

Author SHA1 Message Date
Joanna Wang
130e7bdd6b PRESUBMIT: check if DEPS file is an existing file rather than path.
Bug: 382703190
Change-Id: I6fca194462fe20a4bd4dcd63a531970d91360c06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6081832
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394373}
2024-12-10 17:39:03 +00:00
Andrew Grieve
b77ac76dd1 Make OWNERS review for added DEPS include_dirs opt-in
If review is required, DEPS files can add:

new_usages_require_review = True

Bug: 365797506
Change-Id: I3457e8d868fbf9715ce6ed4622d48a75c351c17a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5910107
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Commit-Queue: Yaron Friedman <yfriedman@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1389797}
2024-11-29 15:01:48 +00:00
Andrew Grieve
713b89b89f Reland : Improve mocking of os_path.exists() in PRESUBMIT_test.py
This reverts commit 58cf9bbd16.

Reason for reland: Fixed broken test

Original change's description:
> Revert "Reland "Improve mocking of os_path.exists() in PRESUBMIT_test.py""
>
> This reverts commit 3ba398ee58.
>
> Reason for revert: crbug.com/372313790
>
> Original change's description:
> > Reland "Improve mocking of os_path.exists() in PRESUBMIT_test.py"
> >
> > This reverts commit 74e5e087cb.
> >
> > Reason for reland: Fixed blink & webapk presubmit tests
> >
> > Original change's description:
> > > Revert "Improve mocking of os_path.exists() in PRESUBMIT_test.py"
> > >
> > > This reverts commit b35a9a9465.
> > >
> > > Reason for revert: Manual bisect shows that this is responsible for failures starting in https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/19822/blamelist.  Local repro on Linux: `vpython3 chrome/android/webapk/PRESUBMIT_test.py --verbose`
> > >
> > > Original change's description:
> > > > Improve mocking of os_path.exists() in PRESUBMIT_test.py
> > > >
> > > > I need this for an upcoming change, but it turns out it found 2 real
> > > > bugs:
> > > >  * A .pydeps check that would never be hit due to test mocks returning
> > > >    that deleted files exist
> > > >  * A translations check that would never be hit due to test mocks using
> > > >    local paths when absolute paths were requested.
> > > >
> > > > Bug: None
> > > > Change-Id: I920e4f67b2ff1193b89c7abfd9664d14a94c44bf
> > > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5910106
> > > > Reviewed-by: Ted Choc <tedchoc@chromium.org>
> > > > Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> > > > Cr-Commit-Position: refs/heads/main@{#1364918}
> > >
> > > Bug: None
> > > Change-Id: Ibcc1931e5709d1a4209e56211595df8b94a35c9a
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5913697
> > > Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
> > > Owners-Override: Łukasz Anforowicz <lukasza@chromium.org>
> > > Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
> > > Cr-Commit-Position: refs/heads/main@{#1364999}
> >
> > Bug: None
> > Change-Id: I303d4d1abc685e3bad854e9a5ebe8ae2efe48869
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5912982
> > Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> > Auto-Submit: Andrew Grieve <agrieve@chromium.org>
> > Reviewed-by: Ted Choc <tedchoc@chromium.org>
> > Owners-Override: Andrew Grieve <agrieve@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1365664}
>
> Bug: None
> Change-Id: Iaebc98243a14fff08442948fea4d69531f6103ee
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5918609
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Sophey Dong <sophey@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Sophey Dong <sophey@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1365901}

Bug: None
Change-Id: I998b8bea9e513d24652ce3d92bf88f677c987538
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5921545
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368995}
2024-10-15 20:20:08 +00:00
Sophey Dong
58cf9bbd16 Revert "Reland "Improve mocking of os_path.exists() in PRESUBMIT_test.py""
This reverts commit 3ba398ee58.

Reason for revert: crbug.com/372313790

Original change's description:
> Reland "Improve mocking of os_path.exists() in PRESUBMIT_test.py"
>
> This reverts commit 74e5e087cb.
>
> Reason for reland: Fixed blink & webapk presubmit tests
>
> Original change's description:
> > Revert "Improve mocking of os_path.exists() in PRESUBMIT_test.py"
> >
> > This reverts commit b35a9a9465.
> >
> > Reason for revert: Manual bisect shows that this is responsible for failures starting in https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/19822/blamelist.  Local repro on Linux: `vpython3 chrome/android/webapk/PRESUBMIT_test.py --verbose`
> >
> > Original change's description:
> > > Improve mocking of os_path.exists() in PRESUBMIT_test.py
> > >
> > > I need this for an upcoming change, but it turns out it found 2 real
> > > bugs:
> > >  * A .pydeps check that would never be hit due to test mocks returning
> > >    that deleted files exist
> > >  * A translations check that would never be hit due to test mocks using
> > >    local paths when absolute paths were requested.
> > >
> > > Bug: None
> > > Change-Id: I920e4f67b2ff1193b89c7abfd9664d14a94c44bf
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5910106
> > > Reviewed-by: Ted Choc <tedchoc@chromium.org>
> > > Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> > > Cr-Commit-Position: refs/heads/main@{#1364918}
> >
> > Bug: None
> > Change-Id: Ibcc1931e5709d1a4209e56211595df8b94a35c9a
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5913697
> > Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
> > Owners-Override: Łukasz Anforowicz <lukasza@chromium.org>
> > Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1364999}
>
> Bug: None
> Change-Id: I303d4d1abc685e3bad854e9a5ebe8ae2efe48869
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5912982
> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> Auto-Submit: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Ted Choc <tedchoc@chromium.org>
> Owners-Override: Andrew Grieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1365664}

Bug: None
Change-Id: Iaebc98243a14fff08442948fea4d69531f6103ee
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5918609
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Sophey Dong <sophey@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Sophey Dong <sophey@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1365901}
2024-10-09 00:08:10 +00:00
Andrew Grieve
3ba398ee58 Reland "Improve mocking of os_path.exists() in PRESUBMIT_test.py"
This reverts commit 74e5e087cb.

Reason for reland: Fixed blink & webapk presubmit tests

Original change's description:
> Revert "Improve mocking of os_path.exists() in PRESUBMIT_test.py"
>
> This reverts commit b35a9a9465.
>
> Reason for revert: Manual bisect shows that this is responsible for failures starting in https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/19822/blamelist.  Local repro on Linux: `vpython3 chrome/android/webapk/PRESUBMIT_test.py --verbose`
>
> Original change's description:
> > Improve mocking of os_path.exists() in PRESUBMIT_test.py
> >
> > I need this for an upcoming change, but it turns out it found 2 real
> > bugs:
> >  * A .pydeps check that would never be hit due to test mocks returning
> >    that deleted files exist
> >  * A translations check that would never be hit due to test mocks using
> >    local paths when absolute paths were requested.
> >
> > Bug: None
> > Change-Id: I920e4f67b2ff1193b89c7abfd9664d14a94c44bf
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5910106
> > Reviewed-by: Ted Choc <tedchoc@chromium.org>
> > Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1364918}
>
> Bug: None
> Change-Id: Ibcc1931e5709d1a4209e56211595df8b94a35c9a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5913697
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
> Owners-Override: Łukasz Anforowicz <lukasza@chromium.org>
> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1364999}

Bug: None
Change-Id: I303d4d1abc685e3bad854e9a5ebe8ae2efe48869
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5912982
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1365664}
2024-10-08 17:34:50 +00:00
Łukasz Anforowicz
74e5e087cb Revert "Improve mocking of os_path.exists() in PRESUBMIT_test.py"
This reverts commit b35a9a9465.

Reason for revert: Manual bisect shows that this is responsible for failures starting in https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/19822/blamelist.  Local repro on Linux: `vpython3 chrome/android/webapk/PRESUBMIT_test.py --verbose`

Original change's description:
> Improve mocking of os_path.exists() in PRESUBMIT_test.py
>
> I need this for an upcomping change, but it turns out it found 2 real
> bugs:
>  * A .pydeps check that would never be hit due to test mocks returning
>    that deleted files exist
>  * A translations check that would never be hit due to test mocks using
>    local paths when absolute paths were requested.
>
> Bug: None
> Change-Id: I920e4f67b2ff1193b89c7abfd9664d14a94c44bf
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5910106
> Reviewed-by: Ted Choc <tedchoc@chromium.org>
> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1364918}

Bug: None
Change-Id: Ibcc1931e5709d1a4209e56211595df8b94a35c9a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5913697
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Owners-Override: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1364999}
2024-10-07 16:56:18 +00:00
Andrew Grieve
b35a9a9465 Improve mocking of os_path.exists() in PRESUBMIT_test.py
I need this for an upcomping change, but it turns out it found 2 real
bugs:
 * A .pydeps check that would never be hit due to test mocks returning
   that deleted files exist
 * A translations check that would never be hit due to test mocks using
   local paths when absolute paths were requested.

Bug: None
Change-Id: I920e4f67b2ff1193b89c7abfd9664d14a94c44bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5910106
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1364918}
2024-10-07 14:34:19 +00:00
Andrew Grieve
66a2bc4786 Re-indent PRESUBMIT_test_mocks.py
So that it works with "git cl format".

PRESUBMIT.py and PRESUBMIT_test.py were previously re-indented, but this
file was missed.

Bug: None
Change-Id: Iddab807d5d46768c575228037da8b7203255a0b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5909130
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1364447}
2024-10-04 21:20:20 +00:00
Georg Neis
9080e060fa ash: Add presubmit check warning about indirect Ash sources
Implement a presubmit check in c/b/PRESUBMIT.py that scans changes
to BUILD.gn files under a set of Ash directories. It generates a
warning for each such BUILD.gn files to which source entries were
added that contain a slash, thus e.g. denoting a file in a subdirectory.

For example, if a new file c/b/ash/foo/BUILD.gn is added containing
  static_library("foo") {
    sources = [ "bar/baz.cc", "x.cc", "../bla.h" ]
    ...
  }
then the check will warn about bar/baz.cc and ../bla.h.

(The parsing is done via regexps and is not 100% precise.)

This presubmit check is meant to protect against regressions in the
context of the ongoing Ash refactoring project (b/332804822) where we
are creating BUILD.gn files for subdirectories.

Bug: b:357772015
Change-Id: Ibb7b99c2531bc129fd06ef14cd7ed07a361be33a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5768197
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1345766}
2024-08-23 01:50:29 +00:00
Arthur Sonzogni
c66e9c85b6 PRESUBMIT: Fix AffectedSourceFile's mock.
Context:
--------

I was surprised @clamy was forced to use `DanglingUntriaged-notes` while
moving a file. This is unexpected. Especially given this behavior was
tested [0].

Root Cause:
-----------

The root cause is a divergence in between the depot_tool implementation
[1][2] using `include_deletes=False` and Chromes's mocks implementation
[3][4] using `include_deletes=True`.

The test was correctly written, but the environment not correctly
simulated ;-(
This patches reconcile the two.

[0]: https://source.chromium.org/chromium/chromium/src/+/main:PRESUBMIT_test.py;l=5144-5167
[1]: https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:presubmit_support.py;l=810-817
[2]: https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:presubmit_support.py;l=1377?q=%22def%20AffectedSourceFiles%22%20-f:third_party
[3]: https://source.chromium.org/chromium/chromium/src/+/main:PRESUBMIT_test_mocks.py;l=106-107
[4]: https://source.chromium.org/chromium/chromium/src/+/main:PRESUBMIT_test_mocks.py;l=273-275

Bug: chromium:1395297
Change-Id: I646adbe9e53dfe606bfcfacd41b4f794d49042be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5447014
Reviewed-by: Dominic Battre <battre@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1291133}
2024-04-23 07:53:04 +00:00
Daniel Cheng
99f90e6b0c Revert "PRESUBMIT.py type annotation for MockFile {Old,New}Content"
This reverts commit a4d9b63b54.

Reason for revert: Breaks some presubmit builders; see crbug.com/1505878

Original change's description:
> PRESUBMIT.py type annotation for MockFile {Old,New}Content
>
> Using strings instead of a Sequence[str] is a common error. This
> prevented a bug in to be caught previously:
> https://chromium-review.googlesource.com/c/chromium/src/+/5012813
>
> Apparently, the same error was made ~50 times.
>
> Bug: chromium:1395297
> Change-Id: I7b580a57522742b0dbbbdbfc274aa3b8d63af789
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5017939
> Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1230109}

Bug: chromium:1395297
Change-Id: Ieb9be89929908725944aefb247a9b418af0e0e8a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5067065
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230256}
2023-11-28 22:54:40 +00:00
Arthur Sonzogni
a4d9b63b54 PRESUBMIT.py type annotation for MockFile {Old,New}Content
Using strings instead of a Sequence[str] is a common error. This
prevented a bug in to be caught previously:
https://chromium-review.googlesource.com/c/chromium/src/+/5012813

Apparently, the same error was made ~50 times.

Bug: chromium:1395297
Change-Id: I7b580a57522742b0dbbbdbfc274aa3b8d63af789
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5017939
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230109}
2023-11-28 20:30:26 +00:00
Luciano Pacheco
23d752b0ca Files app: Add presubmit to block @ts-ignore in TS files.
Fix the `MockFile` to output the same string value of the
implementation.

Bug: b:289003444

Change-Id: I36529ef112af6e81a9e84f6dbb0777ce97e3d543
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4975179
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Ben Reich <benreich@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: Wenbo Jie <wenbojie@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215153}
2023-10-25 22:49:36 +00:00
Ian Vollick
9d42a072b2 Initialize MockInputApi's verbosity
With this change, the input api's verbosity is set up by looking for
the '--verbose' argument.

credit: approach was recommended by brucedawson@.

Bug: None
Change-Id: I1e71dc2f798d63e2391496d885467787738b5168
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4247059
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Ian Vollick <vollick@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1104813}
2023-02-14 01:21:14 +00:00
Avi Drissman
2497659363 Update copyright headers in the top-level files
This CL was generated manually.

No-Try: true
Bug: 1098010
Change-Id: I23f14f4c85edc1c6498fb40d2f415031398324b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3887619
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1045836}
2022-09-12 15:24:31 +00:00
Joanmarie Diggs
0991fc6acd Fix build in Python 3.11 (invalid mode: 'rU')
In Python 3.11, 'U' ("universal newline") is no longer accepted in
the file mode, having been deprecated in Python 3.3. The "universal
newline" is used by default when a file is open in text mode.

This commit removes the 'U' from the two (non-third-party) places
it is used.

Bug: 1357549
Change-Id: I3305707858d8ba7a9f518656a9b97dc1702bbe94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3859535
Reviewed-by: Mike Pinkerton <pinkerton@chromium.org>
Commit-Queue: Joanmarie Diggs <jdiggs@igalia.com>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1040794}
2022-08-30 06:00:13 +00:00
Thorben Troebst
2d24c70657 Add exception in DOCTYPE presubmit check for WPT importer.
There is no upstream consensus yet if or how we should label tests
in quirks mode. So we disable <!DOCTYPE html> check for imported tests
for now.

Bug: 534962
Change-Id: I2f07e0a808f4a651e10e187a3f4fc8e0e2225117
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3823148
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Weizhong Xia <weizhong@google.com>
Commit-Queue: Thorben Troebst <troebst@google.com>
Cr-Commit-Position: refs/heads/main@{#1033691}
2022-08-10 20:20:16 +00:00
Gao Sheng
a79ebd4d91 Fix some issues in PRESUBMIT script
When I read the Chromium source, I first noticed that some python files for presubmit located in the root directory had some problems (like incorrect function names, indentation, typos, etc.), so I tried to fix them.

BUG=nobug

Change-Id: I3646b9fc1761d3cd2af884aba8d815d09665e7be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3812981
Reviewed-by: Erik Staab <estaab@chromium.org>
Commit-Queue: Erik Staab <estaab@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032601}
2022-08-08 17:25:59 +00:00
Bruce Dawson
344ab26d57 Skip changes that are NOPS when there are no diffs
CheckAddedDepsHaveTargetApprovals and CheckStableMojomChanges only look
at lines that have changed. This makes them expensive (OldContents() is
one of the most expensive presubmit functions) and guarantees that they
will not find anything when run with --all or --files, when there are no
changed lines.

Therefore this change pragmatically returns early from these functions
when no_diffs is true. This reduces "presubmit --all" times on my test
machine by about 6 minutes, or 5-10%, allowing for faster iteration
times.

Bug: 1309977
Change-Id: I3a947efa6a59d562aa27f80fdda3f7ad38993352
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3671444
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Jesse McKenna <jessemckenna@google.com>
Cr-Commit-Position: refs/heads/main@{#1010839}
2022-06-04 11:35:10 +00:00
Takuto Ikuta
dca102247d Reland "mojo: drop py2 compatibility"
This reverts commit 28c3f06318.

Reason for revert:
include fix for presubmit.

Original change's description:
> Revert "mojo: drop py2 compatibility"
>
> This reverts commit 42775cc82e.
>
> Reason for revert: causes http://crbug.com/1315672
>
> Original change's description:
> > mojo: drop py2 compatibility
> >
> > Python2 is not used for Chromium build now.
> >
> > Bug: 1309804
> > Change-Id: I77b767ae72d82faaaa00dd1cce15e73f890ec568
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3581234
> > Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> > Reviewed-by: Ken Rockot <rockot@google.com>
> > Commit-Queue: Ken Rockot <rockot@google.com>
> > Cr-Commit-Position: refs/heads/main@{#991607}
>
> Bug: 1309804
> Change-Id: Iee05768e1a785a2273af57854c4ffde51922254a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3584231
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Andrey Kosyakov <caseq@chromium.org>
> Commit-Queue: Lei Zhang <thestig@chromium.org>
> Owners-Override: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#991666}

Bug: 1309804
Fixed: 1315672
Change-Id: Ib6150ca75c2f06607b73ae09a3f0864ebc92cdbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3583686
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#991868}
2022-04-13 02:51:21 +00:00
Bruce Dawson
3740e073f3 Fix Windows path limits in RunEsLintChecks
When running "git cl presubmit --all" RunEsLintChecks may be called with
~1,100 or more arguments. This leads to a command line that is too long
for Windows to handle. This change invokes eslint multiple times to
avoid hitting the limit.

This change was initially landed as crrev.com/c/3554791 but that change
used the wrong return type and was ultimately done at the wrong level in
the call hierarchy. RunEsLintChecks is the right place to do this change
because it has the list of affected files as a discrete list.

This change can be (and has been) tested with this command (using the
recently added --files option) to make sure it runs to completion:

    git cl presubmit --files=*.js --force

For much faster results return early from PanProjectChecks in
depot_tools/presubmit_canned_checks.py.

See crrev.com/c/3554633 for another example of fixing this issue.

This change also adds is_windows to the MockInputAPI - it exists in the
real InputAPI class.

Bug: 1309977, 1312819
Change-Id: Ib2e0bb287b4050b09206b1d2c7155bbc519a4b34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3572912
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#989961}
2022-04-07 16:17:22 +00:00
Giovanni Ortuño Urquidi
ab84da6d01 Fix CheckAssertAshOnlyCode presubmit
Follow up for https://crrev.com/c/3325066 that adds a test to check
deleted files are ignored and sets include_deletes to true in
the mock AffectedFiles function to match the real function.

Bug: 1278154
Change-Id: I713f462b4741f8c9d5d13e4ed576788e0de57b95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3325628
Commit-Queue: Giovanni Ortuno Urquidi <ortuno@chromium.org>
Auto-Submit: Giovanni Ortuno Urquidi <ortuno@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/main@{#950362}
2021-12-10 00:53:21 +00:00
Lukasz Anforowicz
7016d05e80 Presubmit checks that reject raw_ptr<T> in Renderer-only code.
Bug: 1073933
Change-Id: I2ab8ce4c0f73d763a784e4252ed2704a2a9f087a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3296265
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Bartek Nowierski <bartekn@chromium.org>
Reviewed-by: Keishi Hattori <keishi@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#946313}
2021-11-30 03:56:27 +00:00
Henrique Ferreiro
81d5800272 Fix MockInputApi.FilterSourceFile regex check
The InputApi mock was using re.search() instead of re.match(). This
meant that some tests in PRESUBMIT_tests.py would pass while the regex
wasn't working on production.

Change-Id: I5225afaa44602bfb0d8d16a1a4d0d021e1e81bb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3302819
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/main@{#946145}
2021-11-29 21:27:19 +00:00
Kevin McNee
967dd2d241 Add presubmit to cc an MPArch watchlist for uses of concerning APIs
With the MPArch project which enables projects like bfcache,
prerendering, and fenced frames, a number of assumptions in the code
base relating to a tab only having one page at a time are no longer
valid [1].

In the interest of avoiding backsliding, let's set up a watchlist for
uses of APIs which can contribute to these problematic assumptions.

[1] https://docs.google.com/document/d/1NginQ8k0w3znuwTiJ5qjYmBKgZDekvEPC22q0I4swxQ/edit?usp=sharing

Bug: 1190019
Change-Id: If06c08a922a8d80129c59bd9ba03e726fed0f25c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3276815
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#941694}
2021-11-15 16:09:29 +00:00
Dirk Pranke
e3c9c62d25 Reland "Migrate //PRESUBMIT*.py to Python3."
This reverts commit abee50a262.

Reason for revert: Underlying fix to
tools/translation/helper/git_helper has landed.

Original change's description:
> Revert "Migrate //PRESUBMIT*.py to Python3."
>
> This reverts commit 8b59f97def.
>
> Reason for revert:
> Breaks uploading CLs which change localized strings. See
> https://bugs.chromium.org/p/chromium/issues/detail?id=1209392.
>
> Original change's description:
> > Migrate //PRESUBMIT*.py to Python3.
> >
> > This CL migrates the root-level PRESUBMIT checks, their associated
> > tests, and and one other file that got pulled along for the ride)
> > to run under Python3 instead of Python2.
> >
> > Bug: 816629
> > Change-Id: I75f3edb34ca72458432ba54f3afa022e027f8eb9
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2877897
> > Commit-Queue: Dirk Pranke <dpranke@google.com>
> > Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#883002}
>
> Bug: 816629
> Fixed: 1209392
> Change-Id: Icf0c084f1db3d20ca76600eb67cc3f6e81b3c9f9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2899404
> Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Yutaka Hirano <yhirano@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#883359}

Bug: 816629
Change-Id: Ie70748076c06e3ebcacd18e3d69f105d94a5e5ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2901242
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#884028}
2021-05-18 18:35:59 +00:00
Kyle Horimoto
abee50a262 Revert "Migrate //PRESUBMIT*.py to Python3."
This reverts commit 8b59f97def.

Reason for revert:
Breaks uploading CLs which change localized strings. See
https://bugs.chromium.org/p/chromium/issues/detail?id=1209392.

Original change's description:
> Migrate //PRESUBMIT*.py to Python3.
>
> This CL migrates the root-level PRESUBMIT checks, their associated
> tests, and and one other file that got pulled along for the ride)
> to run under Python3 instead of Python2.
>
> Bug: 816629
> Change-Id: I75f3edb34ca72458432ba54f3afa022e027f8eb9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2877897
> Commit-Queue: Dirk Pranke <dpranke@google.com>
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#883002}

Bug: 816629
Fixed: 1209392
Change-Id: Icf0c084f1db3d20ca76600eb67cc3f6e81b3c9f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2899404
Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883359}
2021-05-17 04:04:41 +00:00
Dirk Pranke
8b59f97def Migrate //PRESUBMIT*.py to Python3.
This CL migrates the root-level PRESUBMIT checks, their associated
tests, and and one other file that got pulled along for the ride)
to run under Python3 instead of Python2.

Bug: 816629
Change-Id: I75f3edb34ca72458432ba54f3afa022e027f8eb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2877897
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#883002}
2021-05-14 16:39:40 +00:00
Dirk Pranke
e2cbf0b8e5 Update the inclusive-language presubmit check to only check chromium src.
The //PRESUBMIT.py checks may sometimes be run on a bot that is actually
testing changes to a repo other than chromium src (e.g., v8 or ANGLE
or something). Sometimes it makes sense to run the presubmit changes
anyway, but the inclusive language check should only be run on actual
changes to chromium/src, since that's what the allowlist checks against.

This CL tweaks the check to exit early on changes for other repos, and
removes the temporary workaround we added earlier today in
f0b0b46c/#{868614).

Bug: 1194996
Change-Id: I0332768a655528e0de0fd52c63ee17ebc15b50e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2801150
Reviewed-by: Sean McCullough <seanmccullough@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#869219}
2021-04-05 18:51:52 +00:00
seanmccullough
f0b0b46ce0 [chromium/src PRESUBMIT] add failsafe for inclusive language check
If the exempt directories file is missing, just log and continue.

Bug: 1194996
Change-Id: Ibd2bad1c9a4f3f485fb7933dfea7a630400a3654
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2800492
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Sean McCullough <seanmccullough@chromium.org>
Cr-Commit-Position: refs/heads/master@{#868614}
2021-04-01 18:49:52 +00:00
Dominic Battre
645d4234a6 Check deprecation of preferences
It's a common mistake that developers just remove Register...Pref()
calls for preferences they don't need anymore. If they do this, the
preference stays in the prefs files on disk for ever. A proper approach
is to first ClearPref() the preference for some releases and then to
remove the code.

This CL introduces a presubmit warning if we detect that a
Register...Pref() call is removed from a non-unittest.

Bug: 1153014
Change-Id: If8f19933de039553ef47e0ddce12eb194df45ce1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560205
Commit-Queue: Dominic Battré <battre@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833730}
2020-12-04 16:14:10 +00:00
Josip Sokcevic
8b6cc43b85 Use inclusive parameter names in PRESUBMIT.py
Bug: 1098562
Change-Id: I10e83b99a480d2d96b911e26b09e8db5d34a082e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333301
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795088}
2020-08-05 17:45:33 +00:00
Robert Ma
0303a3ada3 Use the new inclusive API in blink PRESUBMIT
Change the root PRESUBMIT_test_mocks.py as well to include the new API.
A compatibility layer is added to support the old API for now, and
should be removed when the old API is removed.

Fixed: 1108326
Bug: 1098560
Change-Id: I562686f265779cbdaf33134fd4d5af4bdcae6e0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314196
Commit-Queue: Robert Ma <robertma@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Robert Ma <robertma@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790926}
2020-07-22 18:48:48 +00:00
Chris Hall
59f8d0c7c6 Add presubmit check for relnotes field in accessibility changes.
R=akihiroota,dmazzoni,jam,dpranke

Change-Id: I37d5035967941da1d2e3d671426133668b87f0f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2162427
Commit-Queue: Chris Hall <chrishall@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Akihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#764594}
2020-05-01 07:31:19 +00:00
Dan Beam
35b10c1a1f Remove --color from ESLint output when running in presubmit
Fixed: 862792
Change-Id: I250e91a1db5f8df71fff33c17c7a04a9fd6c8739
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1937584
Commit-Queue: Dan Beam <dbeam@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719450}
2019-11-27 01:17:34 +00:00
Alexei Svitkine
137d4c668b Fix PRESUMBIT_tests.py on Windows.
MockInputApi was returning MockFile objects instead of strings
from LocalPaths() API, which apparently trips up Windows Python
APIs, but not Unix ones.

Bug: 984360
Change-Id: I0a14cc07a9406d84d6b20d104d002fe67cc4ae86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1706577
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Alexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678454}
2019-07-17 21:28:24 +00:00
Julian Pastarmov
4f7af53fcb Fix the PRESUBMIT.py script to properly invoke grit
The grd reader is invoked from _GetGrdMessages with defines which
specify "chromium" build.

Drive-by fix for the MockFile to support basename on Windows.

BUG=984910
TEST=A modified grd fail doesn't trip the presubmit run.

Change-Id: I1b30dcaf8b91d40292e631ba854b4f0dfa54de69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1705799
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Julian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678407}
2019-07-17 19:25:37 +00:00
Wei-Yin Chen (陳威尹)
b1ce35493b Check parameter types in FilterSourceFile() mock
Parameters |white_list| and |black_list| in FilterSourceFile()
should be iterables, and it's fairly easy to wrongly pass a string
instead.

This checking caught _CheckCrbugLinksHaveHttps in unit tests.

Bug: 869103
Change-Id: I1cd6d62c3fa2b1500d9d7b6b35794f40e35378af
Reviewed-on: https://chromium-review.googlesource.com/1155379
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579288}
2018-07-31 02:37:01 +00:00
Vaclav Brozek
f01ed503dc Add tests for 'ForTesting' presubmit check
The root PRESUBMIT.py contains
_CheckNoProductionCodeUsingTestOnlyFunctions which checks against
including a call to a 'for testing only' method in production code.
That check has not been tested. This CL adds two tests for it.

Additionally, the CL also fixes two issues in the presubmit tests:
 * FilterSourceFile in PRESUBMIT_test_mocks.py did not match the
   production version from tools/depot_tools/presubmit_support.py: the
   production requires the filename to be in the whitelist, while the
   mock version was OK with just not being in the blacklist. The CL
   modifies the mock version to match the production.
 * The test for _CheckAndroidTestJUnitInheritance did not adhere to
   the whitelisted filename pattern (*Test.java). This CL changes the
   names of the fake files to match the pattern.

Bug: 821981
Change-Id: I65edf07ddb2ae26ad7d08ceb7cf4d51b482b5e56
Reviewed-on: https://chromium-review.googlesource.com/966605
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Vaclav Brozek <vabr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543783}
2018-03-16 19:38:24 +00:00
Zhiling Huang
45cabf3788 Run pydeps check only in src.
Bug: 803245
Change-Id: I645e82663991cd012ced5f19a056d08bbc2c797d
Reviewed-on: https://chromium-review.googlesource.com/952281
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Zhiling Huang <hzl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542297}
2018-03-10 00:50:03 +00:00
Sylvain Defresne
a8b73d2584 Ensure autorelease pool is drained between tests
The testing::Test fixture (used by TEST macro) does not drain the
autorelease pool after a test. PlatformTest should be used.

Add a PRESUBMIT check that neither TEST nor testing::Test is used
in iOS Objective-C++ test files. Files are assumed to be iOS if
either their base name match '\bios\b' or one of the component in
the path is 'ios'.

Expand MockInputApi to filter files in mocks of AffectedFiles and
AffectedSourceFiles function, adding missing mocked functions too.
Fix unit tests that were failing after the filtering is correctly
implemented.

Bug: none
Change-Id: I0af99b6658b8e15888dfcfb94345eb879ab9fd37
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Reviewed-on: https://chromium-review.googlesource.com/937204
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539829}
2018-02-28 15:45:54 +00:00
Daniel Cheng
7052cdff01 Auto-CC ipc-security-reviews@ when changing IPC-related files.
Bug: 786386
Change-Id: I28d5809389aa86ee274b17725ca5312d4b8bb3ae
Reviewed-on: https://chromium-review.googlesource.com/776411
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518329}
2017-11-21 19:23:29 +00:00
Daniel Cheng
264a447d21 Add tests for enforcing C++ dependencies in PRESUBMIT
This CL omits tests for directories where dependencies aren't checked:
PRESUBMIT test mocks is missing support for FileSourceFilter. This will
be added to test mocks along with the missing tests in a followup CL.

Bug: 763980
Change-Id: Ibf9265911f32d24f446e690d9ec05ddb7a61f198
Reviewed-on: https://chromium-review.googlesource.com/671812
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505189}
2017-09-28 22:17:59 +00:00
Yoland Yan
b92fa52719 Add Presubmit Warnings for Junit4
These presubmit warnings prevent people from adding new JUnit3 tests or
use inheritance in JUnit4 testing, it also prevent people from using
the deprecated JUnit framework.

For more on JUnit4 migration, please check
//testing/android/docs/junit4.md

Bug: 640116
Change-Id: I941b595f6fbc01ac60a2647ab0af64482596d9cc
Reviewed-on: https://chromium-review.googlesource.com/634603
Commit-Queue: Yoland Yan <yolandyan@chromium.org>
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#497790}
2017-08-28 17:37:06 +00:00
Daniel Cheng
13ca61a886 Enforce that mojo manifests are covered by security reviewers.
Since mojo manifests don't have a consistent naming convention, this
simply looks for JSON files with the "interface_provider_specs" key:
there are some manifests that don't specify this, but the important
part for security review is auditing what's exposed between processes.

Bug: 695922
Change-Id: Id30dae51ecc0cbfa35650ead14ef2dfd081c23d7
Reviewed-on: https://chromium-review.googlesource.com/621707
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#497410}
2017-08-25 15:11:25 +00:00
dpapad
5c9c24ec6d js_checker.py: Restore smoke tests for linting violations.
Restoring test to ensure that document.getElementById() calls are flagged as
style violations, now that these checks are performed via ESLint. These tests
are not meant to be exhaustive, instead they just validate that our PRESUBMIT
integration with ESLint works.

BUG=720034

Review-Url: https://codereview.chromium.org/2917473002
Cr-Commit-Position: refs/heads/master@{#476014}
2017-05-31 20:51:34 +00:00
jbriance
2c51e821a6 Presubmit: Skip third_party for fwd decl warning
Skip presubmit warning when the introduced useless forward
declaration is made in third_party (with the exception of
blink). Take the opportunity to fix one test and style.

BUG=662195
TEST=PRESUBMIT_test.py ForwardDeclarationTest

Review-Url: https://codereview.chromium.org/2568473002
Cr-Commit-Position: refs/heads/master@{#437833}
2016-12-12 08:27:18 +00:00
jbriance
9e12f16d49 Presubmit: Warn about useless forward declarations
Checks that added or removed lines in affected header files
do not lead to new useless class or struct forward declaration.

BUG=662195
TEST=PRESUBMIT_test.py ForwardDeclarationTest

Review-Url: https://codereview.chromium.org/2532583002
Cr-Commit-Position: refs/heads/master@{#434449}
2016-11-25 07:59:45 +00:00
pastarmovj
89f7ee10f0 Adds new logging type SYSLOG which logs to the system log.
On Windows this type logs to the Event Log and on POSIX systems it logs to the messages log (or its equvalent).

As a side effect of adding the presubmit check for it this
CL fixes running the presumbit checks tests on Windows.

BUG=642115

Review-Url: https://codereview.chromium.org/2296783002
Cr-Commit-Position: refs/heads/master@{#419758}
2016-09-20 14:59:43 +00:00
rdevlin.cronin
1136682513 [Closure Externs] Fix presubmit check
Have the presubmit script check all affected files instead of only
those in the presubmit directory. Avoids false positives.

BUG=469920

Review-Url: https://codereview.chromium.org/1925273002
Cr-Commit-Position: refs/heads/master@{#390968}
2016-05-02 17:07:22 +00:00