GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] CommentRequired: make property names consistent by snuyanzin · Pull Request #2069 · pmd/pmd

Conversation

@snuyanzin

@snuyanzin snuyanzin commented Oct 15, 2019

Copy link
Copy Markdown
Contributor

The PR fixes #1683 by introducing a separate property for class comment and making header property checking only header top-level comments

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ghost

ghost commented Oct 15, 2019 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
1 Message
📖 This changeset introduces 6939 new violations, 0 new errors and 0 new configuration errors,
removes 6933 violations, 2 errors and 2 configuration errors.
Full report
✅ This changeset introduces 6939 new violations, 0 new errors and 0 new configuration errors,
removes 6933 violations, 2 errors and 2 configuration errors.
Full report
✅ This changeset introduces 14995 new violations, 0 new errors and 0 new configuration errors,
removes 6931 violations, 2 errors and 2 configuration errors.
Full report

Generated by 🚫 Danger

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@snuyanzin

snuyanzin commented Oct 15, 2019

Copy link
Copy Markdown
Contributor Author

I changed default value for headerCommentRequirement to reduce the number of violations in the report

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

adangel
adangel requested changes Oct 19, 2019
View reviewed changes

@adangel adangel left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for your PR!
Unfortunately, I don't think we can merge it as is: We should try to keep the change as backwards compatible as possible. This means:

  • Introducing a new property for class comments ✅ - already done: "classCommentRequirement"
  • Deprecate the property "headerCommentRequirement" - since this will be replaced by the correctly named "classCommentRequirement".
    • You can achieve this by starting the property description with the string "Deprecated! ". Then it will be rendered in the documentation as deprecated.
    • To make the change for the users easier, we should then
      • log a deprecation warning, if this property is not the default (the default is, as before Required).
      • If the new property is the default value but the old, deprecated property is not, then use the value of the old deprecated property. This is the case, if some user configured the rule using the deprecated property
      • If the new property is not the default value, then we ignore the deprecated property value. The new property will be used. We would still log a warning, if the old deprecated property has a non-default value - because then the user configured both properties, which is wrong.
  • We might introduce a new property "packageCommentRequired" in order to check for formal comments for packages. However, this is completely different:
    • package javadoc comments are not in every file, but only in the file package-info.java
    • if the file package-info.java doesn't exist, we won't analyze it, so we can't require this comment
    • the only check we could do here is "Unwanted"
    • So, I'm not sure, whether checking for package comments makes sense at all?
  • IMHO header comments (such as license headers, ...) are not javadoc (/** ... */) comments, but normal (/* ... */) comments. The rule however only checks for javadoc/formal comments. So, header comments are irrelevant for this rule.
  • We should also improve the rule description: It currently talks about comments, which is not precise. We should clarify, that this rule only checks javadoc (formal) comments.
    • Change the rule description in this file:

      pmd/pmd-java/src/main/resources/category/java/documentation.xml

      Line 34 in a178142

      Denotes whether comments are required (or unwanted) for specific language elements.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread .../src/test/resources/net/sourceforge/pmd/lang/java/rule/documentation/xml/CommentRequired.xml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...java/src/main/java/net/sourceforge/pmd/lang/java/rule/documentation/CommentRequiredRule.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@adangel adangel changed the title [java][PMD-1683] Separate header comment from CommentRequired as class comm… [java] CommentRequired: Renamed property headerCommentRequirement Oct 19, 2019
@adangel adangel changed the title [java] CommentRequired: Renamed property headerCommentRequirement [java] CommentRequired: Rename property headerCommentRequirement Oct 19, 2019
@adangel adangel changed the title [java] CommentRequired: Rename property headerCommentRequirement [java] CommentRequired: make property names consistent Oct 19, 2019
@adangel adangel added the is:WIP For PRs that are not fully ready, or issues that are actively being tackled label Oct 25, 2019
snuyanzin and others added 4 commits December 17, 2019 12:30
@snuyanzin @adangel
[java] CommentRequired: Separate header comment from class comment an…
88ff3f0
…d header top-level comment

Refs pmd#1683
@snuyanzin @adangel
[java] CommentRequired: Make headerCommentRequirement ignored by defa…
6cec748
…ult, make tests more targeted

Refs pmd#1683
@adangel
[java] CommentRequired: Deprecated property "headerCommentRequirement"
d8ed0cf
@adangel
[doc] Update release notes, refs pmd#2069, fixes pmd#1683
3ec8914
@adangel adangel mentioned this pull request Dec 17, 2019
[java] CommentRequired property names are inconsistent #1683
Closed
@adangel
adangel force-pushed the PMD-1683 branch from 7adc4e0 to 3ec8914 Compare December 17, 2019 14:53
@adangel adangel added this to the 6.21.0 milestone Dec 17, 2019
@adangel adangel removed the is:WIP For PRs that are not fully ready, or issues that are actively being tackled label Dec 17, 2019
@adangel
adangel merged commit 3ec8914 into pmd:master Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@adangel adangel adangel requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

6.21.0

Development

Successfully merging this pull request may close these issues.

[java] CommentRequired property names are inconsistent

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@snuyanzin @adangel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.