0
Commit Graph

18 Commits

Author SHA1 Message Date
Benjamin Williams
715f02399b [iOS] Add presubmit check to enforce shared Chrome iOS color management
This CL introduces a new presubmit check to enforce using shared Chrome
iOS colors by requiring all new colors to be added to
ios/chrome/common/ui/colors/ and providing helpful warnings to users
when colors are modified.

Technical implementation:
- Adds CheckNewColorIntroduction presubmit check that monitors colorset
  file changes
- Implements error checking for new colors added outside
  ios/chrome/common/ui/colors/
- Provides warnings for modified colors
- Adds FormatMessageWithFiles helper for consistent error reporting

Critical conditions:
- Errors: New colors must be added to ios/chrome/common/ui/colors/
- Warnings: Generated for:
  - New colors added to ios/chrome/common/ui/colors/ (to check for
    duplicates)
  - Modifications to existing colors (to ensure shared color usage)

Usage constraints:
- Affects all changes to .colorset/Contents.json files
- Full test coverage included to validate different color modification
  scenarios

Change-Id: I01fc85d553be7d6e234bd4d29fc353c55bc26ba3
Fixed: 397741197
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6281073
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Commit-Queue: Benjamin Williams <bwwilliams@google.com>
Reviewed-by: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422462}
2025-02-20 04:44:09 -08:00
Federica Germinario
2ce51a841d [ios] Add presubmit check to limit use of NSUserDefaults
This CL adds a presubmit check trying to limit new usage of
NSUserDefaults.
Note that this check provides a WARNING message.

This check does not cover all scenarios and can produce some false
positives (in case the developer uses the pattern code to get
the content of an existing userDefault key).

Bug: none
Change-Id: Ie78b731ff5517a5c2d331494b2e76c66f630c6dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6179973
Reviewed-by: Mark Cogan <marq@chromium.org>
Commit-Queue: Federica Germinario <fedegermi@google.com>
Cr-Commit-Position: refs/heads/main@{#1411606}
2025-01-27 06:44:10 -08:00
Aliona DANGLA
bc39d1af1d [iOS] Remove forward ChromeBrowserState presubmit check
Bug: 358053899
Change-Id: I3a3350d4ac5c08642993381189cf566d2f910aae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5953254
Commit-Queue: Mark Cogan <marq@chromium.org>
Reviewed-by: Mark Cogan <marq@chromium.org>
Commit-Queue: Aliona Dangla <alionadangla@chromium.org>
Auto-Submit: Aliona Dangla <alionadangla@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1372645}
2024-10-23 12:53:36 +00:00
Federica Germinario
6aeebd4a79 [ios] Add presubmit check to improve unittests
This CL adds a presubmit check which checks if new changes in
unit test code can be improved by giving a warning message.

Example of lines that can be improved:
(EXPECT_TRUE or EXPECT_FALSE) +
(isEqualToString: or isEqualToData: or isEqualToArray:)

This CL also fixed the error_message string of:
_CheckHasNoChromeBrowserStateForwardDeclaration

Bug: none
Change-Id: I46a3593c7d9d41c54cdf87986895e295553e01c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5866150
Commit-Queue: Federica Germinario <fedegermi@google.com>
Reviewed-by: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1356410}
2024-09-17 11:59:15 +00:00
Mark Cogan
3f3cb7d0b9 [iOS] Add PRESUBMIT for ChromeBrowserState forward declaration.
Adds a PRESUBMIT check to catch forward-declarations of
ChromeBrowserState, which (for the time being) should instead be
done with the forwarding header.

The check for this is intentionally quite narrow.

Bug: 359821340
Change-Id: I143cd68ad37ccb69a03f17014ec3819f6c2fde5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5797169
Auto-Submit: Mark Cogan <marq@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1344010}
2024-08-20 08:39:40 +00:00
Mark Cogan
cc4c1eab0c Update ios/ PRESUBMIT to warn for b/ TODO links.
This CL changes the ios/ PRESUBMIT to warn if b/ links are used in
TODOs.

Also fixes some error messages. In the singular, inserts an 'a' for
correctness ("without a bug number" vs "without bug number"). Also now
the parentheses opened with "(expected format is" is now closed before
the final colon.

Bug: 326058403
Change-Id: I863a013120939e3fe20656b064c8d095e30b1223
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5343955
Reviewed-by: Asami Doi <asamidoi@chromium.org>
Commit-Queue: Mark Cogan <marq@chromium.org>
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1269465}
2024-03-07 09:31:29 +00:00
Peter Kasting
06d4831924 Consistently test ARC support with HAS_FEATURE.
This makes it slightly easier to grep for existing instances.

Bug: none
Change-Id: Ia3fdfe6112db675ce5404c2d83d4b8470e6e3f0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5142327
Owners-Override: Mark Mentovai <mark@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1239837}
2023-12-20 22:26:14 +00:00
Avi Drissman
3d243a4ce2 Add presubmit error for ARC boilerplate
The ARC boilerplate isn't needed any more and is being removed across
the codebase. Add a presubmit to avoid getting any more committed.

The presubmit change alone landed earlier and was reverted because it
wasn't ready. Now this lands along with other related changes.

Bug: 1468376
Change-Id: I9a7fdc66ed5daa1d623e3226fdf4e9004c071d5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4727321
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1177895}
2023-08-01 16:53:59 +00:00
Tomasz Jurkiewicz
55a0aa18d4 Accept buganizer tickets in TODO comments.
Bug: b/271240665
Change-Id: Ib30bec0d383f882dd2ad3b22a647e3257b2229f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4295220
Commit-Queue: Tomek Jurkiewicz <tju@google.com>
Reviewed-by: Mark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1111730}
2023-03-01 18:53:46 +00:00
Avi Drissman
ea1be23a8b Update copyright headers in ipc/, ios/, infra/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c95.

No-Try: true
Bug: 1098010
Change-Id: I958bc4caa48822ca0d15594e906783852cd0c499
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3893343
Reviewed-by: Mark Mentovai <mark@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047189}
2022-09-14 23:29:06 +00:00
Gauthier Ambard
f85c5f14a7 [iOS] Add a PRESUBMIT check for pipes in comments
This CL adds a check to prevent adding additional pipes to disambiguate
symbols and variables in comments. Backticks should be used instead.

Bug: 1311955
Change-Id: Ib0bef6ba7692200c40fe91fbb6781ed173cfc84f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3892349
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Mark Cogan <marq@chromium.org>
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1046855}
2022-09-14 11:26:54 +00:00
Gauthier Ambard
1981d62c90 [iOS] Reformat PRESUBMIT
It seems that the files were not following `git cl format --python`.

Bug: 1311955
Change-Id: I12261053e32395979c4fc2dbe92ee921435ba8f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3891284
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Auto-Submit: Gauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1046284}
2022-09-13 09:34:49 +00:00
Petro Akzhygitov
db9b35162c Add a presubmit check for adding #include preprocessor directives
– Added a presubmit check and testsed it

Bug: 1328809
Change-Id: If6d5eb9d2231eebd7ad097e9673c951c950754cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3663127
Reviewed-by: Mark Cogan <marq@chromium.org>
Commit-Queue: Petro Akzhygitov <pakzhygitov@google.com>
Cr-Commit-Position: refs/heads/main@{#1019989}
2022-07-01 08:21:50 +00:00
Vaclav Brozek
cdc7defb01 Run PRESUBMIT_test.py in subdirectories
Right now, changes to //PRESUBMIT.py trigger running
//PRESUBMIT_test.py during presubmit checks.

However, this does not happen for PRESUBMITs in subdirectories, of
which there is a number with associated PRESUBMIT_test. This CL allows
running the associated PRESUBMIT_test.

Bug: 821981
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation;master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I057f4d736992795dde7dd0d329ed3773d22553dc
Reviewed-on: https://chromium-review.googlesource.com/966906
Commit-Queue: Vaclav Brozek <vabr@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544318}
2018-03-20 09:54:35 +00:00
Gauthier Ambard
7fc07bf6ad Fix PRESUBMIT check for ARC guard
The check is failing because it was written as if the content of the
file returned with f.NewContents() is a string. It is actually a list.
This CL fixes it.

The check never worked.

Bug: 798289
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Icfd216bbcaee78671878b65ac412b9063bd24509
Reviewed-on: https://chromium-review.googlesource.com/847372
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526452}
2018-01-02 09:58:03 +00:00
stkhapugin@chromium.org
d7eac5cca8 Remove constant duplication in presubmit test.
Makes presubmit test use an existing constant from PRESUBMIT.py.

Bug: 762461
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I4fcfed6430f166390c9aa1fd24109d73e8709cc0
Reviewed-on: https://chromium-review.googlesource.com/845620
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526301}
2017-12-28 17:29:58 +00:00
stkhapugin@chromium.org
0066f73c3e Add a presubmit check for ARC compile guards in new .mm files for iOS.
Implements a new presubmit check that verifies that newly created .mm
files have a proper compile guard.

For example:

$ touch ios/asdf.mm
$ git commit -am "asdf" && git cl upload

Running presubmit upload checks ...

** Presubmit ERRORS **
Found new Objective-C implementation file without compile guard. Please use the following compile guard:
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif

ios/asdf.mm


Bug: 762461
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ice720c8ddf5db2f11b12e56c0877619d612fa9ef
Reviewed-on: https://chromium-review.googlesource.com/844696
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526292}
2017-12-28 10:44:32 +00:00
Sylvain Defresne
fcda19fd7a [ios] Add a PRESUBMIT check for TODO.
All TODOs in src/ios/ should follow the format TODO(crbug.com/######)
so add a PRESUBMIT.py check (and corresponding unit tests) for that.

BUG=677203

Change-Id: I360ad75c786f292d3a8ada8df519cb451c1c2828
Reviewed-on: https://chromium-review.googlesource.com/538613
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#482589}
2017-06-27 10:26:23 +00:00