Skip to content

Change method name 'desc' to 'setDescription', 'size' to 'getNumViolations'#1957

Closed
pdhung3012 wants to merge 2 commits into
pmd:masterfrom
pdhung3012:master
Closed

Change method name 'desc' to 'setDescription', 'size' to 'getNumViolations'#1957
pdhung3012 wants to merge 2 commits into
pmd:masterfrom
pdhung3012:master

Conversation

@pdhung3012

Copy link
Copy Markdown

The class PropertyBuilder is used to represent PropertyBuilder. This method named 'desc' is to specify the description of this property. Thus, the method name 'setDescription' is more intuitive than 'desc'.

The class PropertyBuilder is used to represent Report. This method named 'size' is to get number of violations. Thus, the method name 'getNumViolations' is more intuitive than 'size'.

@ghost

ghost commented Aug 1, 2019

Copy link
Copy Markdown
1 Message
📖 This changeset introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

@jsotuyod jsotuyod left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@pdhung3012 thanks for the PR and taking your time to work on PMD.

However, this is not a change we can accept.

Firstly, the PR includes 2 completely separate changes, so it should be split into 2 PRs. However, both of these changes are changing the names of public methods, meaning this is a breaking API change and something we can't do without:

  1. Properly deprecating and documenting this on a minor release to give users proper time to accommodate.
  2. Actually getting rid of deprecated methods on the next major release (7.0.0)

And finally, I'm not particularly in favor of changing desc for setDescription. As you stated, this is a builder, which provides a fluent API. A setter should, by convention return void. Moreover, changing this method alone would be completely inconsistent with all other methods in property builders, such as defaultValue.

I think the change on Report however is positive. Please consider submitting a PR with only that change, but considering:

  1. The old size() method should not be removed, but simply @Deprecated, and have it internally call the new non-deprecated method.
  2. Document this change on https://pmd.github.io/pmd-6.17.0/pmd_next_major_development.html#list-of-currently-deprecated-apis (this file)

@adangel adangel added the is:WIP For PRs that are not fully ready, or issues that are actively being tackled label Aug 4, 2019
@pdhung3012

Copy link
Copy Markdown
Author

Thanks, I will close this PR and create a new PR.

@pdhung3012 pdhung3012 closed this Aug 4, 2019
@pdhung3012

Copy link
Copy Markdown
Author

@pdhung3012 thanks for the PR and taking your time to work on PMD.

However, this is not a change we can accept.

Firstly, the PR includes 2 completely separate changes, so it should be split into 2 PRs. However, both of these changes are changing the names of public methods, meaning this is a breaking API change and something we can't do without:

  1. Properly deprecating and documenting this on a minor release to give users proper time to accommodate.
  2. Actually getting rid of deprecated methods on the next major release (7.0.0)

And finally, I'm not particularly in favor of changing desc for setDescription. As you stated, this is a builder, which provides a fluent API. A setter should, by convention return void. Moreover, changing this method alone would be completely inconsistent with all other methods in property builders, such as defaultValue.

I think the change on Report however is positive. Please consider submitting a PR with only that change, but considering:

  1. The old size() method should not be removed, but simply @Deprecated, and have it internally call the new non-deprecated method.
  2. Document this change on https://pmd.github.io/pmd-6.17.0/pmd_next_major_development.html#list-of-currently-deprecated-apis (this file)

Thank you. I created a new PR at #1960

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

is:WIP For PRs that are not fully ready, or issues that are actively being tackled

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants