GeezerVison is showing github.com — [apex] Support suppression via //NOPMD · Issue #1087 · pmd/pmd
[apex] Support suppression via //NOPMD #1087DescriptionAffects PMD Version:
All versions
Rule:
//NOPMD
Description:
//NOPMD has no effect
Code Sample demonstrating the issue:
This will fail:
return new Map<Id, SObject> (Database.query(//NOPMD
soqlQuery
));
This will work:
return new Map<Id, SObject> (Database.query(NOPMD
soqlQuery
));
Obviously, this cannot compile on Salesforce... But could it be that comments are ignored?
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
CLI Activityjsotuyod commented on May 9, 2018 changed the title [-][apex] - //NOPMD is not working[/-] [+][apex] //NOPMD is not working[/+] on May 9, 20180cv commented on May 9, 2018 Thanks for the quick answer. Java, along maybe EcmaScript? I've the feeling that there is something implemented here
|
suppressMap = new HashMap<>(); |
which is missing here
|
suppressMap = new HashMap<>(); |
But I couldn't figure out the apex.jorje methods (to get the Comments) to build something similar. jsotuyod commented on May 9, 2018 Yes, ES supports it too. For Apex we can't. The Jorje Parser drops all comments, they are not made available for us. yippie commented on May 10, 2018 This is really unfortunate as it throws a LOT of false positives (particularly around CRUD checks and test assertion checks) Reacted by Christophe Vidal, SnugSFBay, Jordan Pike and Francesco Carmagnola jsotuyod commented on May 10, 2018 @yippie if you have false positives, you should report them back to us so we can fix them rather than have them suppressed. rsoesemann commented on May 10, 2018 0cv commented on May 14, 2018 @rsoesemann - thanks (but in case of classes, this is not really selective to suppress all the warning of a given class). But anyway, can you suggest how to suppress warnings from Components and VF Pages?
1- <!-- NOPMD --> doesn't seem to work (neither do <!-- //NOPMD --> nor //NOPMD, nor NOPMD)
2- Adding @SuppressWarnings('PMD'), within or not <!-- ... --> is not doing anything either. jsotuyod commented on May 14, 2018 @Krisa we can't currently suppress warnings in VF. Using <!-- NOPMD --> should be possible, but some coding is needed to support it. If anyone is up to the challenge, look me up on gitter and I'll gladly give you pointers Reacted by Robert Sösemann jsotuyod commented on Sep 23, 2018 Thanks for @jeffhube's work on #1314 we now have the groundwork to include support for // NOPMD on Apex.
If anyone is up for the challenge, please contact me and I'll help you figure out the way forward. marcalbaladejo commented on Jan 2, 2019 Hi @jsotuyod, the support for //NOPMD has been finally added for APEX? or will it be shortly?
thanks! jsotuyod commented on Jan 2, 2019 @marcalbaladejo it's not been added yet.
The core PMD team is currently focused on gearing up for PMD 7.0.0, which is mainly breaking changes we have accumulated over the last year or so.
6.11.0 is also in the works, but mainly contains:
- Community contributions
- Actual bug fixes (ie: crashes upon certain code structures)
- Deprecations we want to include in 6.x before removal in 7.0.0
- Low hanging fruit we come upon on our daily PMD usage
If anyone is interested on working on this and submit a PR, we can gladly assist in the process. marcalbaladejo commented on Jan 3, 2019 Thanks @jsotuyod!, for now I've done my own sfdx plugin that cleans up the output checking against the source code, to find the suppress markers. Reacted by tomaswrk19 and Edmondo Porcu changed the title [-][apex] //NOPMD is not working[/-] [+][apex] Support suppression via //NOPMD[/+] on Feb 13, 2020
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|