0

Android: Add presubmit warning to encourage errorprone-style parameter comments

E.g. instead of
  bar(/* param */ null)
or:
  bar(null /* param */)
it should be:
  bar(/* param= */ null)

So that errorprone will enforce the parameter name is correct.

Bug: None
Change-Id: Ifb9c99d3db392c2fe85e7ff9398ee5dfea9fb0f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4936726
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1214851}
This commit is contained in:
Andrew Grieve
2023-10-25 14:56:48 +00:00
committed by Chromium LUCI CQ
parent 4e0d339996
commit d99e3c0580
2 changed files with 19 additions and 1 deletions
styleguide/java
tools/android/checkstyle

@ -231,7 +231,19 @@ Values of `Integer` type are also supported, which allows using a sentinel
* `TODO(username): Some sentence here.`
* `TODO(crbug.com/123456): Even better to use a bug for context.`
### Code Formatting
### Parameter Comments
Use [parameter comments] when they aid in the readability of a function call.
E.g.:
```java
someMethod(/* enabled= */ true, /* target= */ null, defaultValue);
```
[parameter comments]: https://errorprone.info/bugpattern/ParameterName
### Default Field Initializers
* Fields should not be explicitly initialized to default values (see
[here](https://groups.google.com/a/chromium.org/d/topic/chromium-dev/ylbLOvLs0bs/discussion)).