checkstyle / checkstyle/checkstyle
Indentation: Checkstyle reports errors on correctly formatted nested / fluent code
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 4.2k
- Avg merge
- 22h 23m
- Merged PRs (30d)
- 232
Description
The following is correctly formatted (in my opinion):
```
{ cs } » javac Temp.java
{ cs } » cat Temp.java
import java.util.List;
/**
* Test
*/
public class Temp {
/**
* test
*
* @param strings test
*/
private void test(final List strings) {
final StringBuilder sb1 = new StringBuilder();
final StringBuilder sb2 = new StringBuilder();
strings.add(
2,
sb1.append("a")
.append("b") //violation
.append(sb2 //violation
.append("a2") //violation
.append("b2") //violation
.toString()) //violation
.toString()); //violation
}
}
{ cs } » cat config.xml
{ cs } » java -jar checkstyle-7.5.1-all.jar -c config.xml Temp.java
Starting audit...
[ERROR] ...\Temp.java:18: '.' have incorrect indentation level 16, expected level should be 12. [Indentation]
[ERROR] ...\Temp.java:19: '.' have incorrect indentation level 16, expected level should be 12. [Indentation]
[ERROR] ...\Temp.java:20: '.' have incorrect indentation level 20, expected level should be 12. [Indentation]
[ERROR] ...\Temp.java:21: '.' have incorrect indentation level 20, expected level should be 12. [Indentation]
[ERROR] ...\Temp.java:22: '.' have incorrect indentation level 20, expected level should be 12. [Indentation]
[ERROR] ...\Temp.java:23: '.' have incorrect indentation level 16, expected level should be 12. [Indentation]
Audit done.
Checkstyle ends with 6 errors.
```
Expected: no errors
Contributor guide
Assessment
This issue has not been assessed yet.