in our code we sometimes have this
public class Demo{
    public String value(){
        if (something){  
            while(true){
                ...
            }
        }
    }
}
I'm currently trying to configure my checkstyle configuration to force developers to have a space before '{':
public class Demo {
    public String value() {
        if (something) {  
            while(true) {
                ...
            }
        }
    }
}
but I can't get it to work. Does anybody know the correct checkstyle configuration for this particular setup? I want to check this code as part of my gradle build
If you use eclipse you could have a look at "Window/Preferences/Java/Code Style/Formatter". You can set almost everything.
For your problem :

If you want use checkstyle you can go to "Window/Preferences/Checkstyle/New ...".
And doing some thing like that : 

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With