Skip to content

Commit 8880830

Browse files
authored
Basic copilot copyedit of style-guideline.md (#14506)
1 parent d10bca4 commit 8880830

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

docs/contributing/style-guideline.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ We follow the [Google Java Style Guide](https://google.github.io/styleguide/java
66

77
The build will fail if the source code is not formatted according to the google java style.
88

9-
The main goal is to avoid extensive reformatting caused by different IDEs having different opinion
10-
about how things should be formatted by establishing.
9+
The main goal is to avoid extensive reformatting caused by different IDEs having different opinions
10+
about how things should be formatted by establishing a consistent standard.
1111

1212
Running
1313

@@ -23,7 +23,7 @@ Running
2323
./gradlew spotlessCheck
2424
```
2525

26-
runs formatting verify task only.
26+
runs the formatting verification task only.
2727

2828
### Pre-commit hook
2929

@@ -37,7 +37,7 @@ git config core.hooksPath .githooks
3737

3838
### Editorconfig
3939

40-
As additional convenience for IntelliJ users, we provide `.editorconfig`
40+
As additional convenience for IntelliJ users, we provide an `.editorconfig`
4141
file. IntelliJ will automatically use it to adjust its code formatting settings.
4242
It does not support all required rules, so you still have to run
4343
`spotlessApply` from time to time.
@@ -55,8 +55,8 @@ To run these checks locally:
5555

5656
## Static imports
5757

58-
We leverage static imports for many common types of operations. However, not all static methods or
59-
constants are necessarily good candidates for a static import. The following list is a very
58+
We use static imports for many common types of operations. However, not all static methods or
59+
constants are necessarily good candidates for a static import. The following list is a
6060
rough guideline of what are commonly accepted static imports:
6161

6262
- Test assertions (JUnit and AssertJ)
@@ -70,8 +70,8 @@ rough guideline of what are commonly accepted static imports:
7070

7171
Some of these are enforced by checkstyle rules:
7272

73-
- look for `RegexpSinglelineJava` in `checkstyle.xml`
74-
- use `@SuppressWarnings("checkstyle:RegexpSinglelineJava")` to suppress the checkstyle warning
73+
- Look for `RegexpSinglelineJava` in `checkstyle.xml`
74+
- Use `@SuppressWarnings("checkstyle:RegexpSinglelineJava")` to suppress the checkstyle warning
7575

7676
## Ordering of class contents
7777

@@ -84,7 +84,7 @@ The following order is preferred:
8484
- Nested classes
8585

8686
If methods call each other, it's nice if the calling method is ordered (somewhere) above
87-
the method that it calls. So, for one example, a private method would be ordered (somewhere) below
87+
the method that it calls. For example, a private method would be ordered (somewhere) below
8888
the non-private methods that use it.
8989

9090
In static utility classes (where all members are static), the private constructor
@@ -102,7 +102,7 @@ Method parameters and local variables should never be declared `final`.
102102

103103
## `@Nullable` annotation usage
104104

105-
[Note: this section is aspirational, as opposed to a reflection of the current codebase]
105+
**Note: this section is aspirational, as opposed to a reflection of the current codebase**
106106

107107
All parameters and fields which can be `null` should be annotated with `@Nullable`
108108
(specifically `javax.annotation.Nullable`, which is included by the
@@ -125,7 +125,7 @@ plugins {
125125
## java.util.Optional usage
126126

127127
Following the reasoning from [Writing a Java library with better experience (slide 12)](https://speakerdeck.com/trustin/writing-a-java-library-with-better-experience?slide=12),
128-
usage of `java.util.Optional` is kept at a minimum in this project.
128+
usage of `java.util.Optional` is kept to a minimum in this project.
129129

130130
It is ok to use `Optional` in places where it does not leak into public API signatures.
131131

@@ -137,9 +137,9 @@ itself uses it.
137137
Avoid allocations whenever possible on the hot path (instrumentation code).
138138
This includes `Iterator` allocations from collections; note that
139139
`for(SomeType t : plainJavaArray)` does not allocate an iterator object.
140-
Non-allocating stream api usage on the hot path is acceptable but may not
141-
fit the surrounding code style; this is a judgement call. Note that
142-
some stream apis make it much more difficult to allocate efficiently
140+
Non-allocating stream API usage on the hot path is acceptable but may not
141+
fit the surrounding code style; this is a judgment call. Note that
142+
some stream APIs make it much more difficult to allocate efficiently
143143
(e.g., `collect` with presized sink data structures involves
144144
convoluted `Supplier` code, or lambdas passed to `forEach` might be
145145
capturing/allocating lambdas).

0 commit comments

Comments
 (0)