Skip to content

Commit 13cbfbe

Browse files
committed
Polish README formatting
1 parent 17f65dd commit 13cbfbe

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

README.adoc

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
:release-version: 0.0.7
22
:checkstyle-version: 8.18
3-
## Spring Java Format
3+
== Spring Java Format
44

5-
### What is this?
5+
=== What is this?
66
A set of plugins that can be applied to any Java project to provide a consistent "`Spring`" style.
77
The set currently consists of:
88

@@ -13,9 +13,9 @@ Since the aim of this project is to provide consistency, each plugin is not gene
1313
You need to change your code to match the required conventions.
1414
You can't configure the plugin conventions to match your style!
1515

16-
### Maven
16+
=== Maven
1717

18-
#### Source Formatting
18+
==== Source Formatting
1919

2020
For source formatting, add the `spring-javaformat-maven-plugin` to your `build` plugins as follows:
2121

@@ -67,7 +67,7 @@ If you want to enforce that all code matches the required style, add the followi
6767
</build>
6868
----
6969

70-
#### Checkstyle
70+
=== Checkstyle
7171

7272
To enforce checksyle conventions add the checkstyle plugin and include a dependency on `spring-javaformat-checkstyle`:
7373

@@ -110,9 +110,9 @@ To enforce checksyle conventions add the checkstyle plugin and include a depende
110110
</build>
111111
----
112112

113-
### Gradle
113+
=== Gradle
114114

115-
#### Source Formatting
115+
==== Source Formatting
116116
For source formatting, add the `spring-javaformat-gradle-plugin` to your `build` plugins as follows:
117117

118118
[source,groovy,indent=0,subs="normal"]
@@ -132,7 +132,7 @@ For source formatting, add the `spring-javaformat-gradle-plugin` to your `build`
132132
The plugin adds `format` and `checkFormat` tasks to your project.
133133
The `checkFormat` task is automatically applied when running the standard Gradle `check` task.
134134

135-
#### Checkstyle
135+
==== Checkstyle
136136
To enforce checksyle conventions add the checkstyle plugin and include a dependency on `spring-javaformat-checkstyle`:
137137

138138
[source,groovy,indent=0,subs="normal"]
@@ -162,7 +162,7 @@ Your `checkstyle.xml` file should look then like this:
162162
----
163163

164164

165-
### Eclipse
165+
=== Eclipse
166166
The Eclipse plugin provides a custom formatter implementation and automatically applies project specific settings.
167167
The plugin is automatically activated whenever the Maven or Gradle plugins are discovered in a project build script.
168168

@@ -182,7 +182,7 @@ You can download the latest version from
182182
https://repo.spring.io/release/io/spring/javaformat/io.spring.javaformat.eclipse.site/{release-version}[repo.spring.io]
183183
or use the https://dl.bintray.com/spring/javaformat-eclipse/[update site].
184184

185-
### IntelliJ IDEA
185+
=== IntelliJ IDEA
186186
The IntelliJ plugin provides custom formatter support for IDEA.
187187
The plugin is automatically activated whenever the Maven or Gradle plugins are discovered in a project build script.
188188
A Spring Java Format icon (image:spring-javaformat-intellij/spring-javaformat-intellij-plugin/src/main/resources/spring-javaformat/formatOn.png[title="Icon"]) will also be displayed in the status bar to indicate the formatter is active.
@@ -191,39 +191,39 @@ You can use the standard `code` -> `reformat code` action to format the code.
191191
To install the plugin use the `spring-javaformat-intellij-plugin` jar file.
192192
You can download the latest version from https://repo.spring.io/release/io/spring/javaformat/spring-javaformat-intellij-plugin/{release-version}[repo.spring.io].
193193

194-
### About the conventions
194+
=== About the conventions
195195
Most of the coding conventions and style comes from the Spring Framework and Spring Boot projects.
196196
Spring Framework manually formats code, where as Spring Boot uses automatic formatting.
197197

198-
### Tips
198+
=== Tips
199199
Formatting and Checkstyle alone are not enough to produce truly consistent code.
200200
Here are some tips that we've found useful when developing Spring Boot.
201201

202-
#### Wrapping
202+
==== Wrapping
203203
The source formatter intentionally uses a low character count of 90 chars for wrapping.
204204
If you're used to longer lines, this can take some getting used to.
205205
Specifically, if you have many nesting levels things can start to look quite bad.
206206

207207
Generally, if you see code bunched up to the right of your screen you should take that as a signal to use the "`extract method`" refactor.
208208
Extracting small private methods will improve formatting and it helps when reading the code and debugging.
209209

210-
#### Whitespace
210+
==== Whitespace
211211
Keeping whitespace lines out method bodies can help make the code easier to scan.
212212
If blank lines are only included between methods it becomes easier to see the overall structure of the class.
213213
If you find you need whitespace inside your method, consider if extracting a private method might give a better result.
214214

215-
#### Comments
215+
==== Comments
216216
Try to add javadoc for each public method and constant.
217217
Private methods shouldn't generally need javadoc, unless it provides a natural place to document unusual behavior.
218218

219219
The checkstyle rules will enforce that all public classes have javadoc.
220220
They will also ensure that `@author` tags are well formed.
221221

222-
#### Final
222+
==== Final
223223
Private members should be `final` whenever possible.
224224
Local variable and parameters should generally not be explicitly declared as final since it adds so much noise.
225225

226-
#### Read-down methods, fields and parameters
226+
==== Read-down methods, fields and parameters
227227
Methods don't need to be organized by scope.
228228
There's no need to group all `private`, `protected` and `public` methods together.
229229
Instead try to make your code easy to read when scanning the file from top to bottom.

0 commit comments

Comments
 (0)