You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Virendra singh Rajpurohit <vi...@gmail.com> on 2019/07/13 20:31:52 UTC

[GSoC][Commons][Statistics][Descriptive] PMD violation : Avoid short class names like Mean

Hi All,
I'm working on "Commons-Statistics-descriptive". While developing project
with public Mean, Variance & StandardDeviation classes, my project BUILD
FAILED because of PMD violation for short Class name "Mean". Help me with
it. Also,Commons-Maths had a class "Mean", so it should work. Don't know
what is the problem here. If it doesn't work, what should I name "Mean"
class?

[image: Mean-ShortClassName.PNG]


--
Thanks  & Regards
*Virendra Singh Rajpurohit*

Re: [GSoC][Commons][Statistics][Descriptive] PMD violation : Avoid short class names like Mean

Posted by Virendra singh Rajpurohit <vi...@gmail.com>.
Hi Alex,
Thanks for the solution. It worked for me. I added a
violationSuppressXPath  for ShortClassName.
I found one more solution to it. We can add
"@SuppressWarnings("PMD.ShortClassName")" Annotation in the class. I
thought to mention this in mail. It can be helpful to someone else who has
the same issue.

-- 
Thanks & Regards
*Virendra Singh Rajpurohit*

Re: [GSoC][Commons][Statistics][Descriptive] PMD violation : Avoid short class names like Mean

Posted by Alex Herbert <al...@gmail.com>.

> On 13 Jul 2019, at 21:31, Virendra singh Rajpurohit <vi...@gmail.com> wrote:
> 
> Hi All,
> I'm working on "Commons-Statistics-descriptive". While developing project with public Mean, Variance & StandardDeviation classes, my project BUILD FAILED because of PMD violation for short Class name "Mean". Help me with it. Also,Commons-Maths had a class "Mean", so it should work. Don't know what is the problem here. If it doesn't work, what should I name "Mean" class?
> 
> 

Since this is the best name for the class then it is OK to make a rule exception.

Have a look at:

src/main/resources/pmd/pmd-ruleset.xml

This is from the main directory root for statistics parent.

Add a violationSuppressXPath for the rule that is the problem. There are already some other suppressions in the file so you just need to get the rule ref correct and adapt the rest. The rule ref should be in the PMD result xml file generated in the target directory when you run ‘mvn pmd:pmd’.

Alex



> 
> 
> --  
> Thanks  & Regards 
> Virendra Singh Rajpurohit
> 
>