Skip to content

Commit 4630f66

Browse files
authored
chore: Fix checkstyle plugin (#408)
* add accessModifiers * Fix exclusion/suppression of tests regarding prompt registry * Fix new checkstyle violations * Fix more checkstyle violations * remove duplicate module block --------- Co-authored-by: Jonas Israel <[email protected]>
1 parent 95fc79e commit 4630f66

File tree

16 files changed

+47
-12
lines changed

16 files changed

+47
-12
lines changed

.pipeline/checkstyle-suppressions.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
<suppress files="[/\\]core[/\\]model[/\\]" checks=".*"/>
1111
<suppress files="[/\\]openai[/\\]generated[/\\]model[/\\]" checks=".*"/>
1212
<suppress files="[/\\]orchestration[/\\]model[/\\]" checks=".*"/>
13-
<suppress files="[/\\]grounding[/\\]api[/\\]" checks=".*"/>
13+
<suppress files="[/\\]grounding[/\\]client[/\\]" checks=".*"/>
1414
<suppress files="[/\\]grounding[/\\]model[/\\]" checks=".*"/>
15+
<suppress files="[/\\]registry[/\\]client[/\\]" checks=".*"/>
16+
<suppress files="[/\\]registry[/\\]model[/\\]" checks=".*"/>
1517
<!-- Suppress TODOs -->
16-
<suppress files="OpenAiChatMessage.java" checks="TodoComment" lines="257,7" />
18+
<suppress files="OpenAiChatMessage.java" checks="TodoComment" lines="261,7" />
1719
<suppress files="ChatCompletionResponseMessage.java" checks="TodoComment" lines="53,34" />
1820
<suppress files="CreateChatCompletionRequest.java" checks="TodoComment" lines="73,47" />
1921
</suppressions>

.pipeline/checkstyle.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
<property name="checkFirstSentence" value="false"/>
3535
<property name="severity" value="info"/>
3636
</module>
37-
<module name="JavadocVariable">
38-
<property name="accessModifiers" value="protected"/>
39-
<property name="severity" value="info"/>
40-
</module>
4137
<module name="MissingJavadocMethod">
4238
<property name="scope" value="protected"/>
4339
<property name="severity" value="info"/>
@@ -47,7 +43,7 @@
4743
<property name="severity" value="info"/>
4844
</module>
4945
<module name="JavadocMethod">
50-
<property name="accessModifiers" value="protected"/>
46+
<property name="accessModifiers" value="protected, public"/>
5147
<property name="allowedAnnotations" value="Override"/>
5248
<property name="severity" value="info"/>
5349
</module>
@@ -56,7 +52,7 @@
5652
<property name="severity" value="info"/>
5753
</module>
5854
<module name="JavadocVariable">
59-
<property name="accessModifiers" value="protected"/>
55+
<property name="accessModifiers" value="protected, public"/>
6056
<property name="severity" value="info"/>
6157
</module>
6258
<module name="IllegalCatch">

.pipeline/spotbugs-exclusions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<Package name="com.sap.ai.sdk.orchestration.model"/>
88
<Package name="com.sap.ai.sdk.grounding.client"/>
99
<Package name="com.sap.ai.sdk.grounding.model"/>
10+
<Package name="com.sap.ai.sdk.prompt.registry.model"/>
11+
<Package name="com.sap.ai.sdk.prompt.registry.client"/>
1012
</Or>
1113
</Match>
1214
<Match>

core/src/main/java/com/sap/ai/sdk/core/common/ClientResponseHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class ClientResponseHandler<T, E extends ClientException>
4444
* Set the {@link ObjectMapper} to use for parsing JSON responses.
4545
*
4646
* @param jackson The {@link ObjectMapper} to use
47+
* @return the current instance of {@link ClientResponseHandler} with the changed object mapper
4748
*/
4849
@Beta
4950
@Nonnull

core/src/main/java/com/sap/ai/sdk/core/common/ClientStreamingHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class ClientStreamingHandler<D extends StreamedDelta, E extends ClientExc
2525
* Set the {@link ObjectMapper} to use for parsing JSON responses.
2626
*
2727
* @param jackson The {@link ObjectMapper} to use
28+
* @return the current instance of {@link ClientStreamingHandler} with the changed object mapper
2829
*/
2930
@Nonnull
3031
public ClientStreamingHandler<D, E> objectMapper(@Nonnull final ObjectMapper jackson) {

core/src/main/java/com/sap/ai/sdk/core/common/StreamedDelta.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public interface StreamedDelta {
3737
* <p>{@code content_filter}: Omitted content due to a flag from our content filters
3838
*
3939
* <p>{@code null}: API response still in progress or incomplete
40+
*
41+
* @return the finish reason or null.
4042
*/
4143
@Nullable
4244
String getFinishReason();

foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public OpenAiClient withApiVersion(@Nonnull final String apiVersion) {
9797
*
9898
* @param destination The specific {@link HttpDestination} to use.
9999
* @see AiCoreService#getInferenceDestination(String)
100+
* @return a new OpenAI client.
100101
*/
101102
@Beta
102103
@Nonnull

foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatMessage.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ public OpenAiChatUserMessage addContent(@Nonnull final ContentPart... content) {
146146
@Type(value = ContentPartImage.class, name = "image_url")
147147
})
148148
public interface ContentPart {
149-
/** Get the type of the content part. */
149+
/**
150+
* Get the type of the content part.
151+
*
152+
* @return The type of the content part as string.
153+
*/
150154
@Nonnull
151155
String getType();
152156
}

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ public OrchestrationChatResponse chatCompletion(
102102
* Generate a completion for the given prompt.
103103
*
104104
* @param prompt a text message.
105-
* @return A stream of message deltas
105+
* @param config the configuration to use
106+
* @return a stream of message deltas
106107
* @throws OrchestrationClientException if the request fails or if the finish reason is
107108
* content_filter
108109
* @since 1.1.0

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public OrchestrationModuleConfig withMaskingConfig(
140140
* @link <a
141141
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/input-filtering">SAP
142142
* AI Core: Orchestration - Input Filtering</a>
143-
* @param contentFilters one or more content filters to apply to the input.
143+
* @param contentFilter a filter to apply to the input.
144+
* @param contentFilters zero or more additional content filters to apply to the input.
144145
* @return a new {@code OrchestrationModuleConfig} instance with the specified input filters
145146
* added.
146147
*/
@@ -174,7 +175,8 @@ public OrchestrationModuleConfig withInputFiltering(
174175
* @link <a
175176
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/output-filtering">SAP
176177
* AI Core: Orchestration - Output Filtering</a>
177-
* @param contentFilters one or more content filters to apply to the output.
178+
* @param contentFilter a filter to apply to the input.
179+
* @param contentFilters zero or more additional content filters to apply to the input.
178180
* @return a new {@code OrchestrationModuleConfig} instance with the specified output filters
179181
* added.
180182
*/

0 commit comments

Comments
 (0)