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

Exclude javadoc @link from linelength #2414

Merged
merged 7 commits into from
Oct 3, 2022

Conversation

proggeo
Copy link
Contributor

@proggeo proggeo commented Sep 28, 2022

@link in javadoc should not break into multiple lines

Before this PR

Using @link with a long reference would trigger LineLength violation.

After this PR

@link javadoc comment lines are exempted from LineLength check

Possible downsides?

@palantirtech
Copy link
Member

Thanks for your interest in palantir/gradle-baseline, @proggeo! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@changelog-app
Copy link

changelog-app bot commented Sep 28, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Exclude javadoc @link from linelength

@link in javadoc should not break into multiple lines

Before this PR

Using @link with a long reference would trigger LineLength violation.

After this PR

@link javadoc comment lines are exempted from LineLength check

Possible downsides?

Check the box to generate changelog(s)

  • Generate changelog entry

@@ -49,7 +49,7 @@
</module>
<module name="LineLength"> <!-- Java Style Guide: No line-wrapping -->
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://|\* \{@link"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think just the {@link piece is sufficient, no need to match * {@link, this way we match a href handling.

Copy link
Contributor Author

@proggeo proggeo Oct 3, 2022

Choose a reason for hiding this comment

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

imo we should still encourage shorter lines. i.e., something like

* My amazing function runs the eternal engine. See {@link com.superlongcorpname.thebestteamever.AmazingEternalEngine#runThisSuperDuperAmazingEngine}

should still be forced to look like

* My amazing function runs the eternal engine. See 
* {@link com.superlongcorpname.thebestteamever.AmazingEternalEngine#runThisSuperDuperAmazingEngine}

Copy link
Contributor

Choose a reason for hiding this comment

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

I get that, however consistency is more important with this sort of thing than optimality.

For example, how would this work in the context of a list in javadoc (or other nested structure used in high-quality documentation).

If we want to bike-shed on optimality, the following results in the smallest maximum line length, but isn't covered by either suppression (which is fine imo because it matches the behavior of a href!)

/**
 * My amazing function runs the eternal engine. See {@link
 * com.superlongcorpname.thebestteamever.AmazingEternalEngine#runThisSuperDuperAmazingEngine
 * }
 */

Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@bulldozer-bot bulldozer-bot bot merged commit 2e1d5c8 into palantir:develop Oct 3, 2022
@svc-autorelease
Copy link
Collaborator

Released 4.180.0

bulldozer-bot bot pushed a commit to palantir/witchcraft-api that referenced this pull request Oct 3, 2022
###### _excavator_ is a bot for automating changes across repositories.

Changes produced by the roomba/latest-baseline-oss check.

# Release Notes
## 4.180.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Improvement | exempt @link javadoc comment from LineLength check | palantir/gradle-baseline#2414 |



To enable or disable this check, please contact the maintainers of Excavator.
This was referenced Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants