To make the Spotless Java code formatter apply the 'this' keyword on local fields and methods, you can use the following configuration in your .spotless.yaml file:
java:
googleJavaFormat:
style: AOSP
onlyIf:
- hasUnformattedCode
additionalFileMatchers: []
filters:
- type: replace
pattern: "([a-zA-Z0-9_]+)\\("
replacement: "this.$1("
exclude:
- "src/main/java/*.proto"
This configuration uses the Google Java Format to format the code and adds a replace filter that applies the 'this' keyword on local fields and methods. The exclude property is used to exclude any proto files that may cause issues with the regex pattern.
Asked: 2022-07-31 11:00:00 +0000
Seen: 10 times
Last updated: Jul 15 '22