Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] scanner run fails with => Error (1): Attribute without value => PMD internal error => No adapter exists for type com.google.summit.ast.declaration.VariableDeclarationGroup #1439

Open
vnehess opened this issue Apr 16, 2024 · 3 comments
Labels
Bug - Need more info BUG P2 Malfunctioning Often

Comments

@vnehess
Copy link

vnehess commented Apr 16, 2024

Description:
When the scanner is run on a specific file in my apex source tree, the scanner will fail and exit with the following message
`
Error (1): Attribute without value
Line: 4
Column: 1
Char: >

`

I've traced this down to an invalid XML payload from the PMD engine
Screenshot 2024-04-16 at 2 39 02 PM

The problem appears to be this string returned from PMD:
<pmd xmlns= \"http://pmd.sourceforge.net/report/2.0.0\" xmlns:xsi= \"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation= \"http://pmd.sourceforge.net/report/2.0.0 http://pmd.sourceforge.net/report_2_0_0.xsd\" version= \"7.0.0\" timestamp= \"2024-04-16T14:14:33.966\" No adapter exists for type com.google.summit.ast.declaration.VariableDeclarationGroup\nNo adapter exists for type com.google.summit.ast.declaration.VariableDeclarationGroup\nNo adapter exists for type com.google.summit.ast.declaration.VariableDeclarationGroup\n>\n<file name= \"/Users/ronhess/Repositories/PLM/src/main/default/classes/AuditTrail.cls\">\n<violation...

Note this is invalid XML because the string 'No adapter exists for type com.google.summit.ast.declaration.VariableDeclarationGroup'.
does not have the form Attribute="value"

Documentation:
Please find attached the XML generated by PmdEngine.js : processStdOut()
Untitled-1.txt

Steps To Reproduce:
I have a specific file that causes this (PMD) to fail when specified as the target.
A full run of all Apex class files works as expected.

Expected Behavior:
The individual file is scanned and issues are reported.

Screenshots:

Screenshot 2024-04-16 at 2 44 59 PM

Desktop:

Additional Context:
The issue does not occur for every file, only a few individual files.
My goal is to run the scanner on files changed in a Pull Request, I would like to specify only a few files on the command line.
If I run the scanner on my entire apex code base, it does work as expected, only when an individual or small group of classes is run does this failure occur.
example :
fails: sf scanner run -f html -o ~/scannerapex.html --target ./src/main/default/classes/AuditTrail.cls --category '!Documentation,!Design'
works sf scanner run -f html -o ~/scannerapex.html --target ./src/main/default/classes/ --category '!Documentation,!Design'

Workaround:

I've tried to limit the rule set reported, but that does not resolve the issue

Urgency:

prevents me from using the v4.0.0 scanner in my CI pipeline

@jag-j
Copy link
Collaborator

jag-j commented May 7, 2024

Thanks for reporting this @vnehess and tracking down the root cause. Though this appears to be an issue on the PMD side, we should be able to handle this gracefully. I'll go ahead and create a bug for us to look into this. Thanks!

@jag-j jag-j added the BUG P2 Malfunctioning Often label May 7, 2024
Copy link

git2gus bot commented May 7, 2024

This issue has been linked to a new work item: W-15708421

@stephen-carter-at-sf
Copy link
Collaborator

@vnehess would it be possible to narrow it down to the file that is causing the issue and then send us that file so that we can reproduce it. Then on our end, we hopefully will be able to surface this error much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug - Need more info BUG P2 Malfunctioning Often
Projects
None yet
Development

No branches or pull requests

3 participants