exonum-java-binding
exonum-java-binding copied to clipboard
Add strict formatter [ECR-4138]
Overview
- Review c4eef90 for changes in configuration and Contributing guide.
- edbf7d7 shows what it does:
- Some builder/stream chains are compressed in a single line:
.setPayload(ExonumMessage.newBuilder().setAnyTx(anyTx(payload)).build().toByteString())is too much. - Some artifacts in array initializers.
- Some builder/stream chains are compressed in a single line:
- Subsequent commits fix some artifacts.
See: https://jira.bf.local/browse/ECR-4138
Definition of Done
- [ ] There are no TODOs left in the code
- [ ] Change is covered by automated tests
- [ ] The coding guidelines are followed
- [ ] Public API has Javadoc
- [ ] Method preconditions are checked and documented in the Javadoc of the method
- [ ] Changelog is updated if needed (in case of notable or breaking changes)
- [ ] The continuous integration build passes
overall looks ok. There are the following major points to notice (to summarize):
- One-line chains in builders, streams, etc. Will be difficult to analyze traces in case of exceptions
checkArgumentsstatements become more complex, new param at new line
Will be difficult to analyze traces in case of exceptions
I'd add that it sometimes hurts readability, e.g.,
HashCode valueHash =
HASH_FUNCTION.newHasher().putByte(BLOB_PREFIX).putBytes(value.toByteArray()).hash();
or
Stream<String> packageDirs =
artifactClasses.stream().map(Class::getPackage).distinct().map(this::getPath);