Skip to content

Commit

Permalink
Migrate Metrics Advisor, Mixed Reality, Models Repository, Monitor, a…
Browse files Browse the repository at this point in the history
…nd OpenAI to new Checkstyle and Spotbugs pattern (#42967)

Migrate Metrics Advisor, Mixed Reality, Models Repository, Monitor, and OpenAI to new Checkstyle and Spotbugs pattern
  • Loading branch information
alzimmermsft authored Nov 15, 2024
1 parent 517aaea commit ea44eda
Show file tree
Hide file tree
Showing 67 changed files with 1,897 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
<suppress checks="LineLength" files="messages.properties"/>

<!-- OpenTelemetry tracing are plugin packages and shouldn't be referenced -->
<suppress checks="IllegalImport" files=".*[/\\]com[/\\]azure[/\\]monitor[/\\]opentelemetry[/\\]*"/>
<suppress checks="IllegalImport" files=".*[/\\]com[/\\]azure[/\\]spring[/\\]cloud[/\\]autoconfigure[/\\]monitor[/\\]*"/>
<suppress checks="IllegalImport" files="com.azure.messaging.eventhubs.*Sample.*java"/>
<suppress checks="IllegalImport" files="com.azure.messaging.eventhubs.*Test.*java"/>
Expand Down Expand Up @@ -123,18 +122,6 @@
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck"
files="com.azure.containers.containerregistry.ContainerRegistryContentClient.java"/>

<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
files="com.azure.monitor.opentelemetry.exporter.AzureMonitorExporter.java"/>

<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
files="com.azure.monitor.opentelemetry.exporter.AzureMonitorExporterOptions"/>

<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
files="com.azure.monitor.opentelemetry.autoconfigure.AzureMonitorAutoConfigure.java"/>

<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
files="com.azure.monitor.opentelemetry.autoconfigure.AzureMonitorAutoConfigureOptions"/>

<!-- JavadocInlineTagCheck Suppression for now, which need code owner's attention -->
<suppress checks="com.azure.tools.checkstyle.checks.JavadocInlineTagCheck"
files="com.azure.security.keyvault.keys.(KeyClient|KeyAsyncClient).java"/>
Expand All @@ -161,9 +148,6 @@
<!-- This class overrides a method that throws, so it cannot be avoided. -->
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck" files="com.azure.security.keyvault.jca.KeyVaultTrustManager"/>

<suppress checks="."
files=".*[/\\]monitor[/\\]implementation[/\\]"/>

<!-- Suppress ConfigurationCredentialsPolicy for HttpPipelinePolicyCheck.
This suppression need to be deleted after AzConfig using AAD credential.
Issue Link: https://github.com/Azure/azure-sdk-for-java/issues/5131 -->
Expand All @@ -175,7 +159,6 @@

<!-- Suppress the check on code-gen classes -->
<suppress checks="Indentation" files="com.azure.security.keyvault.administration.implementation.(RoleAssignmentsImpl|RoleDefinitionsImpl)"/>
<suppress checks="Indentation" files="com.azure.ai.metricsadvisor.implementation.AzureCognitiveServiceMetricsAdvisorRestAPIOpenAPIV2Impl"/>
<!-- Checkstyle suppressions for the auto generated Chat Client Implementation -->
<suppress checks="com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck" files="com.azure.communication.chat.implementation.AzureCommunicationChatServiceImpl.java"/>
<!-- Checkstyle suppressions for the auto generated Phone Number Administration Implementation -->
Expand Down Expand Up @@ -225,10 +208,6 @@
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files="com.azure.messaging.eventhubs.(EventHubBufferedProducerClient|EventHubBufferedProducerAsyncClient).java"/>
<suppress checks="com.azure.tools.checkstyle.checks.UseCaughtExceptionCauseCheck" files="com.azure.messaging.eventhubs.EventDataBatch.java"/>

<!-- Checkstyle suppression for OpenAI client APIs that use Flux instead of PagedFlux for methods that return a collection -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files="com.azure.ai.openai.(OpenAIClient|OpenAIAsyncClient).java"/>
<!-- Checkstyle suppression for OpenAI Assistants client APIs that use Flux instead of PagedFlux for methods that return a collection -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files="com.azure.ai.openai.assistants.(AssistantsClient|AssistantsAsyncClient).java"/>
<!-- Checkstyle suppression for Inference client APIs that use Flux instead of PagedFlux for methods that return a collection -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files="com.azure.ai.inference.(ChatCompletionsClient|ChatCompletionsAsyncClient).java"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@
<Field name="errorInformationList"/>
<Bug pattern="SE_BAD_FIELD"/>
</Match>

<!-- Exception is required to catch, ref: code comment in the OrderbyRowComparer::compare() method -->
<Match>
<Class name="com.azure.cosmos.implementation.query.orderbyquery.OrderbyRowComparer"/>
Expand Down Expand Up @@ -1832,12 +1832,6 @@
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
</Match>

<Match>
<Class name="com.azure.ai.metricsadvisor.implementation.models.InfluxDBParameter"/>
<Method name="getUserName"/>
<Bug pattern="NM_CONFUSING"/>
</Match>

<!-- False positives -->
<Match>
<Class name="com.azure.security.keyvault.jca.KeyVaultKeyStore"/>
Expand All @@ -1854,14 +1848,6 @@
<Bug pattern="SE_BAD_FIELD"/>
</Match>

<!-- This is an internal type used to hold the request body which will not be mutated outside this class -->
<Match>
<Or>
<Class name="com.azure.monitor.ingestion.implementation.LogsIngestionRequest"/>
</Or>
<Bug pattern="EI_EXPOSE_REP2,EI_EXPOSE_REP"/>
</Match>

<!-- Machine generated classes for MAA service generate spotBugs errors -->
<Match>
<Or>
Expand Down Expand Up @@ -1980,19 +1966,5 @@
<Bug pattern="LI_LAZY_INIT_STATIC"/>
</Match>

<!-- Returning a new copy of the object is not necessary -->
<Match>
<Class name="~com\.azure\.ai\.openai\.models\.(AudioTranscriptionOptions|AudioTranslationOptions)"/>
<Method name="&lt;init&gt;"/>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>

<!-- False positive, it throws an IllegalArgumentException if non-exist method parameter type passed.-->
<Match>
<Class name="com.azure.ai.openai.implementation.MultipartDataHelper"/>
<Method name="serializeRequest"/>
<Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE"/>
</Match>

<!-- Comment to force CI to run Spotbugs against all SDKs -->
</FindBugsFilter>
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">
<!-- This file is generated by the /eng/scripts/linting_suppression_generator.py script. -->

<suppressions>
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataFeedTransforms.java" checks="JavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DetectionConfigurationTransforms.java" checks="JavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.MetricsAdvisorImpl.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AlertConfigurationTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AnomalyAlertConfigurationHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AnomalyDetectionConfigurationHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AnomalyHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AnomalyTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureBlobDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureCosmosDbDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureDataExplorerDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureDataLakeStorageGen2DataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureEventHubsDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureLogAnalyticsDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureTableDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataFeedHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataFeedIngestionProgressHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataFeedIngestionStatusHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataFeedMetricAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataFeedTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceCredentialEntityTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceDataLakeGen2SharedKeyAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceServicePrincipalAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceServicePrincipalInKeyVaultAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceSqlServerConnectionStringAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DetectionConfigurationTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.HookHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.HookTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.IncidentHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.IncidentRootCauseHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.IncidentRootCauseTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.IncidentTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.InfluxDbDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricAnomalyFeedbackHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricBoundaryConditionHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricEnrichedSeriesDataHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricEnrichedSeriesDataTransformations.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricFeedbackHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricSeriesDataHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricSeriesDataTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricSeriesDefinitionHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricSeriesDefinitionTransforms.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MongoDbDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MySqlDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.PostgreSqlDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.SqlServerDataFeedSourceAccessor.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.Utility.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.package-info.java" checks="MissingJavadocPackageCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AnomalyTransforms.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureBlobDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureCosmosDbDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureDataExplorerDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureDataLakeStorageGen2DataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureEventHubsDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureLogAnalyticsDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AzureTableDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataFeedMetricAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceDataLakeGen2SharedKeyAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceServicePrincipalAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceServicePrincipalInKeyVaultAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceSqlServerConnectionStringAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.HookTransforms.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.IncidentRootCauseTransforms.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.IncidentTransforms.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.InfluxDbDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricEnrichedSeriesDataTransformations.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricSeriesDataTransforms.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MetricSeriesDefinitionTransforms.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MongoDbDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.MySqlDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.PostgreSqlDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.SqlServerDataFeedSourceAccessor.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.AnomalyTransforms.java" checks="com.azure.tools.checkstyle.checks.JavadocThrowsChecks" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.DataSourceCredentialEntityTransforms.java" checks="com.azure.tools.checkstyle.checks.JavadocThrowsChecks" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.HookTransforms.java" checks="com.azure.tools.checkstyle.checks.JavadocThrowsChecks" />
<suppress files="com.azure.ai.metricsadvisor.implementation.util.Utility.java" checks="com.azure.tools.checkstyle.checks.JavadocThrowsChecks" />
<suppress files="com.azure.ai.metricsadvisor.implementation.MetricsAdvisorImplBuilder.java" checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" />
</suppressions>
4 changes: 4 additions & 0 deletions sdk/metricsadvisor/azure-ai-metricsadvisor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
--add-exports com.azure.core/com.azure.core.implementation.http=ALL-UNNAMED
--add-opens com.azure.ai.metricsadvisor/com.azure.ai.metricsadvisor=ALL-UNNAMED
</javaModulesSurefireArgLine>

<checkstyle.suppressionsLocation>checkstyle-suppressions.xml</checkstyle.suppressionsLocation>
<spotbugs.skip>false</spotbugs.skip>
<spotbugs.excludeFilterFile>spotbugs-exclude.xml</spotbugs.excludeFilterFile>
</properties>

<dependencies>
Expand Down
Loading

0 comments on commit ea44eda

Please sign in to comment.