Skip to main content
Participant
September 1, 2010
Question

What is the rationale behind the "UnusedParameterRule"?

  • September 1, 2010
  • 1 reply
  • 804 views

Hi,

I wonder if someone can explain the following questions regarding the "UnusedParameterRule":

  1. Why is it a blocker?
    I can imagine a developer gets a warning when he (or she) doesn't use the passed parameters - but I really don't understand why it is a blocker...
  2. (Maybe redundant) Where can I find more information about this (and other) rule(s) and the reasons for creating it/them?
    It is possible I used the wrong search terms, but I really did not find anything... except an example, and I understand the example as such, but not the why!

And I know I can change the severity of the rule or ignore the rule entirely, but it is important to me to understand why I should or shouldn't...

TIA,

Mylène

This topic has been closed for replies.

1 reply

Adobe Employee
September 1, 2010

Hi Mylène,

The default severity of a rule is always subject to change depending on the project.

One could argue that an unused formal parameter hits maintainability, and hence would be a blocker.

For that one, I would agree with you. I think that should be a warning by default.

FYI, in the Java PMD documentation website (http://pmd.sourceforge.net/rules/unusedcode.html) states:

Avoid passing parameters to methods or constructors and then not using those parameters.    

and they provide a (too?) simple example.

You can open a ticket on JIRA so that we change the default severity.

Cheers,

Xavier

Participant
September 1, 2010

Thanks,

I will

Mylène

Adobe Employee
September 2, 2010

The issue has been fixed against trunk and closed on JIRA

Cheers,

Xavier