pmd / pmd/pmd-eclipse-plugin

incorrect detection of missing comment

Open
#138 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
99
Forks
42
Avg merge
20h 19m
Merged PRs (30d)
19

Description

When running the latest PMD plugin on our code we get a violation report we believe to be false positive.
PMD plugin version used is: 4.18.0.v20201024-1129
Containing PMD version: 6.29.0

The project used is open source: https://github.com/eclipse/titan.EclipsePlug-ins
The file where we get the report is: https://github.com/eclipse/titan.EclipsePlug-ins/blob/master/org.eclipse.titan.runtime/src/org/eclipse/titan/runtime/core/TitanLoggerApi.java
in line : 1382
violation report: "CommentRequired: Public method and constructor comments are required"

The code in question looks like this:
"
/**
* Gives access to the field id.
* Turning the template into a specific value template if needed.
*
* @return the field id.
* */
public TitanInteger_template get_field_id() {
set_specific();
return id;
}
"
As it can be seen while the function is truly public ... it also visibly has a comment.
What makes this issue more interesting is that this does not look like a consistent problem.
The public function directly following this one (with very similar signature and comment shape/form/content) does not have this violation reported on it.
I have attached 2 images showing both functions together and the reported violation.
kép
kép

Please note this happens several times in the code ... this occurrence was just the smallest I could find to demonstrate the issue.

Please also note, that this file is generated and so quite large (>160K lines).
This might play a role in creating the issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the CommentRequired violation using PMD plugin 4.18.0.v20201024-1129 and PMD 6.29.0 against org.eclipse.titan.runtime/src/org/eclipse/titan/runtime/core/TitanLoggerApi.java, focusing on line 1382. Compare the reported method with the following public method and inspect whether the generated file size affects comment detection. Done means the false positive is explained and corrected or reliably reproduced with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.