Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update checkstyle rules and suppressions #18025

Closed
wants to merge 5 commits into from

Conversation

samvaity
Copy link
Member

@samvaity samvaity commented Dec 8, 2020

@check-enforcer
Copy link

check-enforcer bot commented Dec 8, 2020

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaulation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run java - [service] - ci

@samvaity samvaity force-pushed the checkstyle-updates branch 3 times, most recently from 6ddd5be to dc2eef7 Compare December 9, 2020 19:30
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on resourcemanager packages.

You can ping us if any issue on sdk/<service>/azure-resourcemanager-<service>.

@ChenTanyi @xccc-msft

@@ -45,8 +45,25 @@
<suppress checks="Header" files="com.azure.core.implementation.OptionSerializer"/>
<suppress checks="Header" files="eventgrid[/\\](models|implementation)[/\\].*\.java"/>

<!-- Cryptography Client exception for service client instantiation as it provides client side crypto and is not entirely based on REST service -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files=".*CryptographyAsyncClient.java"/>
<!-- Custom checkstyle rules only check track 2 libraries -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on configuration in parent POMs these checks should never run on Track 1 or management plane, they will only run on modules that use azure-sdk-client-parent as the parent POM.


<!-- Package-private helper methods grouped together -->
<suppress checks="OverloadMethodsDeclarationOrderCheck" files=".*[/\\](azure-messaging-servicebus)[/\\].*\.java"/>
<suppress checks="OverloadMethodsDeclarationOrderCheck" files="com.azure.storage.file.share.FileSmbProperties.java"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on what OverloadMethodsDeclarationOrderCheck is we should look at enforcing this in the future as it is a non-breaking change

2. Instance variables. First the public class variables, then protected, then package level (no access modifier), and then private.
3. Constructors
4. Methods -->
<module name="DeclarationOrder"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any configuration options for this check? I'm wondering if we could start with a simplified version where the separate code types, class variables, instance variables, constructors, and methods, need to be group without the more intricate scoping orders.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I beleive we could skip/ignore access modifiers validation. But still keep the ordering in place with this

<module name="DeclarationOrder">
                <property name="ignoreModifiers" value="false" />
        </module>

@samvaity samvaity marked this pull request as draft December 30, 2020 13:16
@samvaity samvaity force-pushed the checkstyle-updates branch 2 times, most recently from 8fa130e to 0c8af3d Compare December 30, 2020 22:32
Copy link
Member

@vcolin7 vcolin7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments on the checkstyle suppressions and code changes to Key Vault :)


<!-- Suppress LineLength for samples and tests -->
<suppress checks="LineLength" files=".*[/\\](samples|test)[/\\].*\.java"/>

<!-- Suppress LineLength for Keyvault on Preview 3. https://github.com/Azure/azure-sdk-for-java/issues/5335 -->
<suppress checks="LineLength" files=".*[/\\]com[/\\]azure[/\\]security[/\\]keyvault[/\\]"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we fixed all line length issues on Key Vault, so if we check this in it will probably fail.

@@ -180,32 +199,19 @@ Duration getDefaultPollingInterval() {
.flatMap(certificateOperationResponse -> Mono.just(certificateOperationResponse.getValue()));
}

private Function<PollingContext<DeletedCertificate>, Mono<DeletedCertificate>> activationOperation(String certificateName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This activation operation is related to the flow for deleting a Certificate, as opposed to the one above which is used for creating one. I think it would be better to just rename them to createCertificateActivationOperation and deleteCertificateActivationOperation and have them live next to the code they're more relevant to.

@@ -1395,6 +1395,15 @@ Duration getDefaultPollingInterval() {
}
}

Mono<Response<CertificateIssuer>> getIssuerWithResponse(String issuerName, Context context) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have getIssuer appear before both getIssuerWithResponse methods like we do with most of our operations.

@@ -1452,6 +1452,15 @@ Duration getDefaultPollingInterval() {
}
}

Mono<Response<CertificateIssuer>> deleteIssuerWithResponse(String issuerName, Context context) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, we should probably have deleteIssuer appear before both deleteIssuerWithResponse methods like we do with most of our operations.

@@ -64,6 +64,16 @@ public KeyVaultTrustManager(KeyStore keyStore) {
}
}

@Override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have the overload with less arguments appear before the ones that add to the list. Feels like the more natural progression to me.

@@ -403,6 +403,23 @@ public KeyVaultKey getKey(String name, String version) {
return getKeyWithResponse(name, version, Context.NONE).getValue();
}

/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should appear before the other getKey overload.

* @throws HttpResponseException if {@code name} is empty string.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<KeyVaultSecret> getSecret(String name) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this method up to appear before its other overload.

final Map<String, String> properties;
private final List<HttpPipelinePolicy> policies;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason this is not grouped with the ClientLogger instance below?

Comment on lines -488 to -489
<suppress checks="Indentation" files="com.azure.security.keyvault.administration.implementation.RoleAssignmentsImpl"/>
<suppress checks="Indentation" files="com.azure.security.keyvault.administration.implementation.RoleDefinitionsImpl"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these checks no longer fail?


<!-- TODO: Synapse access control API does not support PagedResponse and Response. -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck"
files="com.azure.analytics.synapse.accesscontrol.AccessControlAsyncClient"/>

<!-- Public API already exposed: Common vocabulary errors, refer to Java Spec: https://azure.github.io/azure-sdk/java_introduction.html,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the checkstyle issue flagging these KeyVault vocabulary violations fixed?

@joshfree joshfree added EngSys This issue is impacting the engineering system. Infrastructure labels Jan 13, 2021
@samvaity
Copy link
Member Author

samvaity commented Feb 19, 2021

Closing this to focus on including smaller changes.

@samvaity samvaity closed this Feb 19, 2021
@samvaity samvaity deleted the checkstyle-updates branch June 22, 2021 20:40
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-java that referenced this pull request Mar 7, 2022
Dev sentinel 2022 01 01 preview (Azure#18025)

* Adds base for updating Microsoft.SecurityInsights from version preview/2021-10-01-preview to version 2022-01-01-preview

* Updates readme

* Updates API version in new specs and examples

* SourceControl API 2022-01-01-preview version - adding new attribute to SourceControl model (Azure#17849)

* SourceControl 2022-01-01-preview version change

* fix validation error

* prettified

* prettified

Co-authored-by: debjyoti11 <[email protected]>

* New metadata API (Azure#17942)

* metadata changes

* addressed changes

* updated enum kind

* updated values as well

Co-authored-by: Roey Ben Chaim <[email protected]>

* added new enum to kind (Azure#17994)

Co-authored-by: Roey Ben Chaim <[email protected]>

* Add flag to rotate webhook secret (Azure#17989)

Co-authored-by: debjyoti11 <[email protected]>

* Align definitions with stable version (Azure#17931)

* Align definitions with stable version

* align scheduled rule and template properties with stable

* Note: We are creating a new api-version with this change. Watchlists.json 2022-01-01-preview parameter name changes (Azure#17848)

* changed source to sourceType and watchlistAlias to alias

* Update CreateWatchlistAndWatchlistItems.json

* Update CreateWatchlistItem.json

* Update DeleteWatchlist.json

* Update DeleteWatchlistItem.json

* Update GetWatchlistByAlias.json

* Update GetWatchlistItemById.json

* Update GetWatchlistItems.json

* Update GetWatchlistByAlias.json

* added missing params to match stable version

* Revert "added missing params to match stable version"

This reverts commit a30a709613f94266d0eaba6495c92be43221a282.

Reverting by 1 commit

* refreshing pipeline

* reverting lint diff change

* attempting to fix RemovedPath breaking changes

* Revert "attempting to fix RemovedPath breaking changes"

This reverts commit 2f96ee3c050fde4c166bf730b0a1b5faff07cfc1.

reverting attempt at correcting breaking changes. cannot match preview
to stable without breaking everything.

* adding back source type for backwards compatibility, added response descriptions, corrected PR comments

* adding missing bracket

* ran npm run prettier-fix to correct style issues

* resolving model/definition errors

* Revert "resolving model/definition errors"

This reverts commit fd67a4f813d923965cefad50999010820446a107.

Reverting prettier changes made to other branches

* Revert "ran npm run prettier-fix to correct style issues"

This reverts commit 3055791e00e956fff3a62e24d8313dde96daa00c.

* update

* Update DeleteWatchlist.json

* Update Watchlists.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* fixing styling issues on Delete example

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* ran npm run prettier on DeleteWatchlist.json

* Update Watchlists.json

* reverting alias to watchlistAlias

Co-authored-by: Hassan Chawiche <[email protected]>

* Rename system to AutoAssigned (Azure#18061)

* Rename system to AutoAssigned

* Add example to list operations

* Update API version in NRT examples

* Execute validation tools and fix results (Azure#17733)

* Execute validation tools and fic results

* Prettyfieir GetIoTById.json

* Watchlists.json-2022-01-01-preview-parameterNameChanges (reverted PR reference for files changed -> https://github.com/Azure/azure-rest-api-specs/pull/17848/files) (Azure#18085)

* changed source to sourceType and watchlistAlias to alias

* Update CreateWatchlistAndWatchlistItems.json

* Update CreateWatchlistItem.json

* Update DeleteWatchlist.json

* Update DeleteWatchlistItem.json

* Update GetWatchlistByAlias.json

* Update GetWatchlistItemById.json

* Update GetWatchlistItems.json

* Update GetWatchlistByAlias.json

* added missing params to match stable version

* Revert "added missing params to match stable version"

This reverts commit a30a709613f94266d0eaba6495c92be43221a282.

Reverting by 1 commit

* refreshing pipeline

* reverting lint diff change

* attempting to fix RemovedPath breaking changes

* Revert "attempting to fix RemovedPath breaking changes"

This reverts commit 2f96ee3c050fde4c166bf730b0a1b5faff07cfc1.

reverting attempt at correcting breaking changes. cannot match preview
to stable without breaking everything.

* adding back source type for backwards compatibility, added response descriptions, corrected PR comments

* adding missing bracket

* ran npm run prettier-fix to correct style issues

* resolving model/definition errors

* Revert "resolving model/definition errors"

This reverts commit fd67a4f813d923965cefad50999010820446a107.

Reverting prettier changes made to other branches

* Revert "ran npm run prettier-fix to correct style issues"

This reverts commit 3055791e00e956fff3a62e24d8313dde96daa00c.

* update

* Update DeleteWatchlist.json

* Update Watchlists.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* fixing styling issues on Delete example

* Update DeleteWatchlist.json

* Update DeleteWatchlist.json

* ran npm run prettier on DeleteWatchlist.json

* Update Watchlists.json

* reverting alias to watchlistAlias

* fixing type version

* Update Watchlists.json

* Update DeleteWatchlist.json

* fixing commas

Co-authored-by: Hassan Chawiche <[email protected]>
Co-authored-by: Usman Hasan <[email protected]>

* Done (Azure#17843)

Co-authored-by: Roy Reinhorn <[email protected]>

* AutomationRules 2022-01-01-preview: Add constraints (Azure#18099)

* add contraints (alinged with the latest stable version)

Co-authored-by: debroy <[email protected]>
Co-authored-by: debjyoti11 <[email protected]>
Co-authored-by: RoeyBC <[email protected]>
Co-authored-by: Roey Ben Chaim <[email protected]>
Co-authored-by: Laith Hisham <[email protected]>
Co-authored-by: ushasan <[email protected]>
Co-authored-by: Hassan Chawiche <[email protected]>
Co-authored-by: shschwar <[email protected]>
Co-authored-by: Usman Hasan <[email protected]>
Co-authored-by: royrein <[email protected]>
Co-authored-by: Roy Reinhorn <[email protected]>
Co-authored-by: dosegal <[email protected]>
Co-authored-by: Arthur Ning <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EngSys This issue is impacting the engineering system. Infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants