- Notifications
You must be signed in to change notification settings - Fork 30
Add strict formatter [ECR-4138] #1377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: accessize-views-ECR-XYZ
Are you sure you want to change the base?
Add strict formatter [ECR-4138] #1377
Conversation
Added a plugin that could reformat all the code automatically to match the Google Java Code Style: https://google.github.io/styleguide/javaguide.html
| new byte[] { | ||
| (byte) 0xef, | ||
| (byte) 0xcd, | ||
| (byte) 0xab, | ||
| (byte) 0x89, | ||
| (byte) 0x67, | ||
| (byte) 0x45, | ||
| (byte) 0x23, | ||
| (byte) 0x01, // up to here, same bytes as above | ||
| (byte) 0x01, | ||
| (byte) 0x02, | ||
| (byte) 0x03, | ||
| (byte) 0x04, | ||
| (byte) 0x05, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another unfortunate artifactj.
| Java code must follow the [Google code style](https://google.github.io/styleguide/javaguide.html). | ||
| [Checkstyle](http://checkstyle.sourceforge.net/index.html) checks the project | ||
| during `validate` phase (i.e., _before_ compilation) of the build. You can also run it manually: | ||
| [The format plugin](https://github.com/coveooss/fmt-maven-plugin) checks the project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hope it works well with IDEA's code format feature 🙃
| version, revision, buildTime); | ||
| ZonedDateTime buildTime = | ||
| ZonedDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneOffset.UTC); | ||
| logger.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💩
| /** | ||
| * Provides factory methods to concisely create | ||
| * {@link com.exonum.core.messages.Blockchain.CallInBlock}s. | ||
| * Provides factory methods to concisely create {@link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionable improvement
| * @param txPosition a zero-based position of the transaction in the block | ||
| * @throws IndexOutOfBoundsException if position is negative or greater than | ||
| * {@value Integer#MAX_VALUE} | ||
| * @throws IndexOutOfBoundsException if position is negative or greater than {@value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
questionable improvement
| public static final ExecutionStatus SUCCESS = ExecutionStatus.newBuilder() | ||
| .setOk(Empty.getDefaultInstance()) | ||
| .build(); | ||
| /** A successful execution status. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| public static TypeAdapter<TransactionLocation> typeAdapter(Gson gson) { | ||
| return new AutoValue_TransactionLocation.GsonTypeAdapter(gson); | ||
| } | ||
| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| * <p>A map entry contains <em>a copy</em> of the data in the corresponding map index. | ||
| * Unlike {@link java.util.Map.Entry}, it does not reflect the changes made to the map | ||
| * since this entry had been created. | ||
| * <p>A map entry contains <em>a copy</em> of the data in the corresponding map index. Unlike {@link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO: code reading experience becomes worse here
| public KeyPair generateKeyPair(byte[] seed) { | ||
| checkArgument(hasLength(seed, SEED_BYTES), | ||
| "Seed byte array has invalid size (%s), must be %s", seed.length, SEED_BYTES); | ||
| checkArgument( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
| public boolean verify(byte[] message, byte[] signature, PublicKey publicKey) { | ||
| checkArgument(hasLength(publicKey.toBytesNoCopy(), PUBLIC_KEY_BYTES), | ||
| "Public key has invalid size (%s), must be %s", publicKey.size(), PUBLIC_KEY_BYTES); | ||
| checkArgument( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
| /** | ||
| * Creates a {@code KeyPair} from two byte arrays, representing {@code privateKey} | ||
| * and {@code publicKey}. All arrays are defensively copied. | ||
| * Creates a {@code KeyPair} from two byte arrays, representing {@code privateKey} and {@code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't like such splitting tags
| overall looks ok. There are the following major points to notice (to summarize):
|
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); |
Overview
.setPayload(ExonumMessage.newBuilder().setAnyTx(anyTx(payload)).build().toByteString())is too much.See: https://jira.bf.local/browse/ECR-4138
Definition of Done