Skip to content

Commit 275ce52

Browse files
lavaleriseebees
andauthored
chore: Add CI check for formatting (#249)
* Apply suggestions from code review Co-authored-by: seebees <[email protected]>
1 parent ed13fb5 commit 275ce52

File tree

153 files changed

+25766
-25248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+25766
-25248
lines changed

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "src/test/resources/aws-encryption-sdk-test-vectors"]
22
path = src/test/resources/aws-encryption-sdk-test-vectors
3-
url = https://github.com/awslabs/private-aws-encryption-sdk-test-vectors-staging.git
3+
url = https://github.com/awslabs/aws-encryption-sdk-test-vectors.git
44
[submodule "aws-encryption-sdk-specification"]
55
path = aws-encryption-sdk-specification
6-
url = https://github.com/awslabs/private-aws-encryption-sdk-specification-staging.git
6+
url = https://github.com/awslabs/aws-encryption-sdk-specification.git

buildspec.yml

+5
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ batch:
2323
env:
2424
env:
2525
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0
26+
- identifier: static_analysis
27+
buildspec: codebuild/static-analysis.yml
28+
env:
29+
env:
30+
image: aws/codebuild/amazonlinux2-x86_64-standard:3.0

codebuild/compliance.yml renamed to codebuild/static-analysis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ phases:
44
install:
55
runtime-versions:
66
nodejs: 12
7+
java: corretto11
78
build:
89
commands:
10+
- mvn com.coveo:fmt-maven-plugin:check
911
- ./util/test-conditions.sh

pom.xml

+10
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,16 @@
199199
</execution>
200200
</executions>
201201
</plugin>
202+
203+
<plugin>
204+
<groupId>com.coveo</groupId>
205+
<artifactId>fmt-maven-plugin</artifactId>
206+
<version>2.10</version>
207+
<!-- Configure no goals. -->
208+
<!--Until our CI builds no longer depend on Java 8, skip this during build.-->
209+
<!--We instead manually check this in Java 11 environments to block builds, -->
210+
<!--And additionally check this explicitly through Github Actions.-->
211+
</plugin>
202212
</plugins>
203213
</build>
204214

src/main/java/com/amazonaws/encryptionsdk/AwsCrypto.java

+849-843
Large diffs are not rendered by default.

src/main/java/com/amazonaws/encryptionsdk/CommitmentPolicy.java

+25-25
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@
33

44
package com.amazonaws.encryptionsdk;
55

6-
import com.amazonaws.encryptionsdk.CryptoAlgorithm;
7-
86
public enum CommitmentPolicy {
9-
ForbidEncryptAllowDecrypt,
10-
RequireEncryptAllowDecrypt,
11-
RequireEncryptRequireDecrypt;
7+
ForbidEncryptAllowDecrypt,
8+
RequireEncryptAllowDecrypt,
9+
RequireEncryptRequireDecrypt;
1210

13-
public boolean algorithmAllowedForEncrypt(CryptoAlgorithm algorithm) {
14-
switch (this) {
15-
case ForbidEncryptAllowDecrypt:
16-
return !algorithm.isCommitting();
17-
case RequireEncryptAllowDecrypt:
18-
case RequireEncryptRequireDecrypt:
19-
return algorithm.isCommitting();
20-
default:
21-
throw new UnsupportedOperationException("Support for commitment policy " + this + " not yet built.");
22-
}
11+
public boolean algorithmAllowedForEncrypt(CryptoAlgorithm algorithm) {
12+
switch (this) {
13+
case ForbidEncryptAllowDecrypt:
14+
return !algorithm.isCommitting();
15+
case RequireEncryptAllowDecrypt:
16+
case RequireEncryptRequireDecrypt:
17+
return algorithm.isCommitting();
18+
default:
19+
throw new UnsupportedOperationException(
20+
"Support for commitment policy " + this + " not yet built.");
2321
}
22+
}
2423

25-
public boolean algorithmAllowedForDecrypt(CryptoAlgorithm algorithm) {
26-
switch (this) {
27-
case ForbidEncryptAllowDecrypt:
28-
case RequireEncryptAllowDecrypt:
29-
return true;
30-
case RequireEncryptRequireDecrypt:
31-
return algorithm.isCommitting();
32-
default:
33-
throw new UnsupportedOperationException("Support for commitment policy " + this + " not yet built.");
34-
}
24+
public boolean algorithmAllowedForDecrypt(CryptoAlgorithm algorithm) {
25+
switch (this) {
26+
case ForbidEncryptAllowDecrypt:
27+
case RequireEncryptAllowDecrypt:
28+
return true;
29+
case RequireEncryptRequireDecrypt:
30+
return algorithm.isCommitting();
31+
default:
32+
throw new UnsupportedOperationException(
33+
"Support for commitment policy " + this + " not yet built.");
3534
}
35+
}
3636
}

0 commit comments

Comments
 (0)