Skip to content

Commit 0a32678

Browse files
committed
Add linting and code formatting as an optional profile to maven, can be run with "./mvnw package -Pbug-check"
1 parent c6936aa commit 0a32678

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

app/backend/.mvn/jvm.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
2+
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
3+
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
4+
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED

app/backend/pom.xml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@
1515
<description>This sample demonstrates a few approaches for creating ChatGPT-like experiences over your own data using the Retrieval Augmented Generation pattern</description>
1616
<properties>
1717
<java.version>17</java.version>
18+
1819
<spring-cloud-azure.version>4.9.0</spring-cloud-azure.version>
1920
<azure-search.version>11.6.0-beta.8</azure-search.version>
2021
<azure-openai.version>1.0.0-beta.2</azure-openai.version>
2122
<semantic-kernel.version>0.2.9-alpha</semantic-kernel.version>
2223
<mockito-inline.version>4.5.1</mockito-inline.version>
24+
<maven.compiler-plugin.version>3.11.0</maven.compiler-plugin.version>
25+
26+
<maven.spotless-plugin.version>2.40.0</maven.spotless-plugin.version>
27+
<google.java.format.version>1.18.1</google.java.format.version>
28+
<com.uber.nullaway.version>0.10.14</com.uber.nullaway.version>
29+
<google.errorprone.core.version>2.22.0</google.errorprone.core.version>
30+
<maven.spotbugs-plugin.version>4.7.3.6</maven.spotbugs-plugin.version>
2331
</properties>
2432

2533
<dependencyManagement>
@@ -117,4 +125,107 @@
117125
</plugins>
118126
</build>
119127

128+
<profiles>
129+
<profile>
130+
<id>bug-check</id>
131+
<activation>
132+
<activeByDefault>false</activeByDefault>
133+
</activation>
134+
<build>
135+
<plugins>
136+
<plugin>
137+
<groupId>org.apache.maven.plugins</groupId>
138+
<artifactId>maven-compiler-plugin</artifactId>
139+
<version>${maven.compiler-plugin.version}</version>
140+
<configuration>
141+
<source>${java.version}</source>
142+
<target>${java.version}</target>
143+
<release>${java.version}</release>
144+
<encoding>${project.build.sourceEncoding}</encoding>
145+
<showWarnings>true</showWarnings>
146+
<compilerArgs>
147+
<arg>-XDcompilePolicy=simple</arg>
148+
<arg>-Xplugin:ErrorProne
149+
-XepOpt:NullAway:AnnotatedPackages=com.microsoft.openai.samples.rag
150+
-Xep:AlmostJavadoc:OFF -Xep:MissingSummary:OFF
151+
-Xep:UnusedVariable:OFF -Xep:EmptyBlockTag:OFF
152+
</arg>
153+
</compilerArgs>
154+
<annotationProcessorPaths>
155+
<path>
156+
<groupId>com.google.errorprone</groupId>
157+
<artifactId>error_prone_core</artifactId>
158+
<version>${google.errorprone.core.version}</version>
159+
</path>
160+
<path>
161+
<groupId>com.uber.nullaway</groupId>
162+
<artifactId>nullaway</artifactId>
163+
<version>${com.uber.nullaway.version}</version>
164+
</path>
165+
</annotationProcessorPaths>
166+
</configuration>
167+
</plugin>
168+
<plugin>
169+
<groupId>com.diffplug.spotless</groupId>
170+
<artifactId>spotless-maven-plugin</artifactId>
171+
<version>${maven.spotless-plugin.version}</version>
172+
<executions>
173+
<execution>
174+
<id>check</id>
175+
<goals>
176+
<goal>check</goal>
177+
</goals>
178+
<phase>compile</phase>
179+
</execution>
180+
<execution>
181+
<id>apply</id>
182+
<goals>
183+
<goal>apply</goal>
184+
</goals>
185+
<phase>process-sources</phase>
186+
</execution>
187+
</executions>
188+
<configuration>
189+
<java>
190+
<googleJavaFormat>
191+
<version>${google.java.format.version}</version>
192+
<style>AOSP</style>
193+
<reflowLongStrings>true</reflowLongStrings>
194+
</googleJavaFormat>
195+
<licenseHeader>
196+
<content>// Copyright (c) Microsoft. All rights reserved.</content>
197+
</licenseHeader>
198+
<toggleOffOn />
199+
</java>
200+
</configuration>
201+
</plugin>
202+
<plugin>
203+
<groupId>com.github.spotbugs</groupId>
204+
<artifactId>spotbugs-maven-plugin</artifactId>
205+
<version>${maven.spotbugs-plugin.version}</version>
206+
<configuration>
207+
<excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
208+
<effort>Max</effort>
209+
<!-- Lower when more project is stable -->
210+
<threshold>Normal</threshold>
211+
</configuration>
212+
<executions>
213+
<execution>
214+
<goals>
215+
<goal>spotbugs</goal>
216+
<goal>check</goal>
217+
</goals>
218+
</execution>
219+
</executions>
220+
</plugin>
221+
<!-- Check compatibility with Android API -->
222+
<plugin>
223+
<groupId>org.codehaus.mojo</groupId>
224+
<artifactId>animal-sniffer-maven-plugin</artifactId>
225+
</plugin>
226+
</plugins>
227+
</build>
228+
</profile>
229+
</profiles>
230+
120231
</project>

0 commit comments

Comments
 (0)