Skip to content

Commit ac49ad9

Browse files
JudeNiroshanzvigrinberg
authored andcommitted
feat: use Google java spotless formatter
Signed-off-by: Jude Niroshan <[email protected]>
1 parent a3d5f72 commit ac49ad9

File tree

64 files changed

+11104
-10246
lines changed

Some content is hidden

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

64 files changed

+11104
-10246
lines changed

pom.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,13 +702,15 @@ limitations under the License.]]>
702702
</format>
703703
</formats>
704704
<java>
705-
<palantirJavaFormat>
706-
<version>2.39.0</version> <!-- optional -->
707-
<style>PALANTIR</style> <!-- or AOSP/GOOGLE (optional) -->
708-
</palantirJavaFormat>
705+
<googleJavaFormat>
706+
<style>GOOGLE</style> <!-- or AOSP (optional) -->
707+
<reflowLongStrings>true</reflowLongStrings> <!-- optional -->
708+
</googleJavaFormat>
709709
<licenseHeader>
710710
<file>${project.basedir}/license-header</file> -->
711711
</licenseHeader>
712+
<removeUnusedImports />
713+
<formatAnnotations />
712714
</java>
713715
</configuration>
714716
<executions>

src/main/java/com/redhat/exhort/Api.java

Lines changed: 81 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -24,91 +24,93 @@
2424
import java.util.Set;
2525
import java.util.concurrent.CompletableFuture;
2626

27-
/** The Api interface is used for contracting API implementations. **/
27+
/** The Api interface is used for contracting API implementations. * */
2828
public interface Api {
2929

30-
public static final String CYCLONEDX_MEDIA_TYPE = "application/vnd.cyclonedx+json";
30+
public static final String CYCLONEDX_MEDIA_TYPE = "application/vnd.cyclonedx+json";
3131

32-
enum MediaType {
33-
APPLICATION_JSON,
34-
TEXT_HTML,
35-
MULTIPART_MIXED;
32+
enum MediaType {
33+
APPLICATION_JSON,
34+
TEXT_HTML,
35+
MULTIPART_MIXED;
3636

37-
@Override
38-
public String toString() {
39-
return this.name().toLowerCase().replace("_", "/");
40-
}
37+
@Override
38+
public String toString() {
39+
return this.name().toLowerCase().replace("_", "/");
4140
}
41+
}
4242

43-
/** POJO class used for aggregating multipart/mixed analysis requests. */
44-
class MixedReport {
45-
public final byte[] html;
46-
public final AnalysisReport json;
47-
48-
public MixedReport(final byte[] html, final AnalysisReport json) {
49-
this.html = html;
50-
this.json = json;
51-
}
52-
53-
public MixedReport() {
54-
this.html = new byte[0];
55-
this.json = new AnalysisReport();
56-
}
57-
58-
@Override
59-
public boolean equals(final Object o) {
60-
if (this == o) return true;
61-
if (o == null || this.getClass() != o.getClass()) return false;
62-
var that = (MixedReport) o;
63-
return Arrays.equals(this.html, that.html) && Objects.equals(this.json, that.json);
64-
}
65-
66-
@Override
67-
public int hashCode() {
68-
return 31 * Objects.hash(json) + Arrays.hashCode(html);
69-
}
43+
/** POJO class used for aggregating multipart/mixed analysis requests. */
44+
class MixedReport {
45+
public final byte[] html;
46+
public final AnalysisReport json;
47+
48+
public MixedReport(final byte[] html, final AnalysisReport json) {
49+
this.html = html;
50+
this.json = json;
51+
}
52+
53+
public MixedReport() {
54+
this.html = new byte[0];
55+
this.json = new AnalysisReport();
7056
}
7157

72-
/**
73-
* Use for creating a stack analysis HTML report for a given manifest file.
74-
*
75-
* @param manifestFile the path for the manifest file
76-
* @return a mixed reports for both HTML and JSON wrapped in a CompletableFuture
77-
* @throws IOException when failed to load the manifest file
78-
*/
79-
CompletableFuture<MixedReport> stackAnalysisMixed(String manifestFile) throws IOException;
80-
81-
/**
82-
* Use for creating a stack analysis HTML report for a given manifest file.
83-
*
84-
* @param manifestFile the path for the manifest file
85-
* @return the HTML report as a String wrapped in a CompletableFuture
86-
* @throws IOException when failed to load the manifest file
87-
*/
88-
CompletableFuture<byte[]> stackAnalysisHtml(String manifestFile) throws IOException;
89-
90-
/**
91-
* Use for creating a stack analysis deserialized Json report for a given manifest file.
92-
*
93-
* @param manifestFile the path for the manifest file
94-
* @return the deserialized Json report as an AnalysisReport wrapped in a CompletableFuture
95-
* @throws IOException when failed to load the manifest file
96-
*/
97-
CompletableFuture<AnalysisReport> stackAnalysis(String manifestFile) throws IOException;
98-
99-
/**
100-
* Use for creating a component analysis deserialized Json report for a given type and content.
101-
*
102-
* @param manifestType the type of the manifest, i.e. {@code pom.xml}
103-
* @param manifestContent a byte array of the manifest's content
104-
* @return the deserialized Json report as an AnalysisReport wrapped in a CompletableFuture
105-
* @throws IOException when failed to load the manifest content
106-
*/
107-
CompletableFuture<AnalysisReport> componentAnalysis(String manifestType, byte[] manifestContent) throws IOException;
108-
109-
CompletableFuture<AnalysisReport> componentAnalysis(String manifestFile) throws IOException;
110-
111-
CompletableFuture<Map<ImageRef, AnalysisReport>> imageAnalysis(Set<ImageRef> imageRefs) throws IOException;
112-
113-
CompletableFuture<byte[]> imageAnalysisHtml(Set<ImageRef> imageRefs) throws IOException;
58+
@Override
59+
public boolean equals(final Object o) {
60+
if (this == o) return true;
61+
if (o == null || this.getClass() != o.getClass()) return false;
62+
var that = (MixedReport) o;
63+
return Arrays.equals(this.html, that.html) && Objects.equals(this.json, that.json);
64+
}
65+
66+
@Override
67+
public int hashCode() {
68+
return 31 * Objects.hash(json) + Arrays.hashCode(html);
69+
}
70+
}
71+
72+
/**
73+
* Use for creating a stack analysis HTML report for a given manifest file.
74+
*
75+
* @param manifestFile the path for the manifest file
76+
* @return a mixed reports for both HTML and JSON wrapped in a CompletableFuture
77+
* @throws IOException when failed to load the manifest file
78+
*/
79+
CompletableFuture<MixedReport> stackAnalysisMixed(String manifestFile) throws IOException;
80+
81+
/**
82+
* Use for creating a stack analysis HTML report for a given manifest file.
83+
*
84+
* @param manifestFile the path for the manifest file
85+
* @return the HTML report as a String wrapped in a CompletableFuture
86+
* @throws IOException when failed to load the manifest file
87+
*/
88+
CompletableFuture<byte[]> stackAnalysisHtml(String manifestFile) throws IOException;
89+
90+
/**
91+
* Use for creating a stack analysis deserialized Json report for a given manifest file.
92+
*
93+
* @param manifestFile the path for the manifest file
94+
* @return the deserialized Json report as an AnalysisReport wrapped in a CompletableFuture
95+
* @throws IOException when failed to load the manifest file
96+
*/
97+
CompletableFuture<AnalysisReport> stackAnalysis(String manifestFile) throws IOException;
98+
99+
/**
100+
* Use for creating a component analysis deserialized Json report for a given type and content.
101+
*
102+
* @param manifestType the type of the manifest, i.e. {@code pom.xml}
103+
* @param manifestContent a byte array of the manifest's content
104+
* @return the deserialized Json report as an AnalysisReport wrapped in a CompletableFuture
105+
* @throws IOException when failed to load the manifest content
106+
*/
107+
CompletableFuture<AnalysisReport> componentAnalysis(String manifestType, byte[] manifestContent)
108+
throws IOException;
109+
110+
CompletableFuture<AnalysisReport> componentAnalysis(String manifestFile) throws IOException;
111+
112+
CompletableFuture<Map<ImageRef, AnalysisReport>> imageAnalysis(Set<ImageRef> imageRefs)
113+
throws IOException;
114+
115+
CompletableFuture<byte[]> imageAnalysisHtml(Set<ImageRef> imageRefs) throws IOException;
114116
}

src/main/java/com/redhat/exhort/Provider.java

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,50 +21,50 @@
2121
import java.nio.file.Path;
2222

2323
/**
24-
* The Provider abstraction is used for contracting providers providing a {@link Content}
25-
* per manifest type for constructing backend requests.
26-
**/
24+
* The Provider abstraction is used for contracting providers providing a {@link Content} per
25+
* manifest type for constructing backend requests.
26+
*/
2727
public abstract class Provider {
28-
/**
29-
* Content is used to aggregate a content buffer and a content type.
30-
* These will be used to construct the backend API request.
31-
**/
32-
public static class Content {
33-
public final byte[] buffer;
34-
public final String type;
28+
/**
29+
* Content is used to aggregate a content buffer and a content type. These will be used to
30+
* construct the backend API request.
31+
*/
32+
public static class Content {
33+
public final byte[] buffer;
34+
public final String type;
3535

36-
public Content(byte[] buffer, String type) {
37-
this.buffer = buffer;
38-
this.type = type;
39-
}
36+
public Content(byte[] buffer, String type) {
37+
this.buffer = buffer;
38+
this.type = type;
4039
}
40+
}
4141

42-
/** The ecosystem of this provider, i.e. maven. */
43-
public final Ecosystem.Type ecosystem;
42+
/** The ecosystem of this provider, i.e. maven. */
43+
public final Ecosystem.Type ecosystem;
4444

45-
protected final ObjectMapper objectMapper = new ObjectMapper();
45+
protected final ObjectMapper objectMapper = new ObjectMapper();
4646

47-
protected Provider(Ecosystem.Type ecosystem) {
48-
this.ecosystem = ecosystem;
49-
}
47+
protected Provider(Ecosystem.Type ecosystem) {
48+
this.ecosystem = ecosystem;
49+
}
5050

51-
/**
52-
* Use for providing content for a stack analysis request.
53-
*
54-
* @param manifestPath the Path for the manifest file
55-
* @return A Content record aggregating the body content and content type
56-
* @throws IOException when failed to load the manifest file
57-
*/
58-
public abstract Content provideStack(Path manifestPath) throws IOException;
51+
/**
52+
* Use for providing content for a stack analysis request.
53+
*
54+
* @param manifestPath the Path for the manifest file
55+
* @return A Content record aggregating the body content and content type
56+
* @throws IOException when failed to load the manifest file
57+
*/
58+
public abstract Content provideStack(Path manifestPath) throws IOException;
5959

60-
/**
61-
* Use for providing content for a component analysis request.
62-
*
63-
* @param manifestContent the content of the manifest file
64-
* @return A Content record aggregating the body content and content type
65-
* @throws IOException when failed to load the manifest content
66-
*/
67-
public abstract Content provideComponent(byte[] manifestContent) throws IOException;
60+
/**
61+
* Use for providing content for a component analysis request.
62+
*
63+
* @param manifestContent the content of the manifest file
64+
* @return A Content record aggregating the body content and content type
65+
* @throws IOException when failed to load the manifest content
66+
*/
67+
public abstract Content provideComponent(byte[] manifestContent) throws IOException;
6868

69-
public abstract Content provideComponent(Path manifestPath) throws IOException;
69+
public abstract Content provideComponent(Path manifestPath) throws IOException;
7070
}

0 commit comments

Comments
 (0)