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

Add Diagnostics for Maven Name and Description #2405

Merged

Conversation

alzimmermsft
Copy link
Member

Adds diagnostics to Java's ApiView for the Maven package name and description. Additionally, makes minor changes to the NoLocalesInJavadocUrlDiagnosticRule to use a single pass Pattern instead of looping on containing each individual locale tested.

@alzimmermsft alzimmermsft self-assigned this Dec 8, 2021
@check-enforcer-staging
Copy link

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).

Comment on lines 21 to 23
private static final Pattern MAVEN_NAME = Pattern.compile("Microsoft Azure client library for .*");
private static final Pattern MAVEN_DESCRIPTION =
Pattern.compile("This package contains the Microsoft Azure .* client library");
Copy link
Member

Choose a reason for hiding this comment

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

Since we are using the same diagnostic rules for Spring, ARM and Android, this rule may not apply to them.

Copy link
Member

Choose a reason for hiding this comment

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

Yep - you should enforce common description styles for each separately.

@ghost ghost added the no-recent-activity There has been no recent activity on this issue. label Mar 11, 2022
@ghost
Copy link

ghost commented Mar 11, 2022

Hi @alzimmermsft. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days.

@ghost ghost removed the no-recent-activity There has been no recent activity on this issue. label Mar 15, 2022
Comment on lines 60 to 62
diagnostics.add(new MavenPackageAndDescriptionDiagnosticRule(
MavenPackageAndDescriptionDiagnosticRule.DEFAULT_MAVEN_NAME,
MavenPackageAndDescriptionDiagnosticRule.DEFAULT_MAVEN_DESCRIPTION));
Copy link
Member

Choose a reason for hiding this comment

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

We can instead have an empty args ctor for MavenPackageAndDescriptionDiagnosticRule that uses the default name and description.

String nameId = getId("name", pom.getName());
if (!mavenName.matcher(pom.getName()).matches()) {
listing.addDiagnostic(new Diagnostic(DiagnosticKind.WARNING, nameId,
"Maven library name should follow the pattern 'Microsoft Azure client library for <service name>'.",
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this diagnostic message use the name passed in to the ctor?

if (!mavenName.matcher(pom.getName()).matches()) {
listing.addDiagnostic(new Diagnostic(DiagnosticKind.WARNING, nameId,
"Maven library name should follow the pattern 'Microsoft Azure client library for <service name>'.",
"https://azure.github.io/azure-sdk/java_introduction.html#java-maven-name"));
Copy link
Member

Choose a reason for hiding this comment

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

How do we get the link for non-default names?

String descriptionId = getId("description", pom.getDescription());
if (!mavenDescription.matcher(pom.getDescription()).matches()) {
listing.addDiagnostic(new Diagnostic(DiagnosticKind.WARNING, descriptionId,
"Maven library description should follow the pattern 'This package contains the Microsoft Azure <service> client library'.",
Copy link
Member

Choose a reason for hiding this comment

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

Same here - use description provided in the ctor.

Copy link
Member

@srnagar srnagar left a comment

Choose a reason for hiding this comment

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

LGTM

@alzimmermsft alzimmermsft merged commit c12915f into Azure:main Mar 16, 2022
@alzimmermsft alzimmermsft deleted the AddDiagnosticsForMavenNameAndDescription branch March 16, 2022 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants