PMD Errors in WSDL to Apex Classes?

Question:
I am building an AppExchange app and have used WSDL to Apex to generate a Metadata service class. However, the generated class throws PMD errors in the “Code Style” category. The specific errors include:
- The local variable name
response_map_x
doesn’t match code style. - The method parameter name
type_x
doesn’t match code style. - The instance field name
AllOrNoneHeader_hns
doesn’t match code style. - The instance field name
timeout_x
doesn’t match code style.
Can I add this Apex class to the “False Positive” list while submitting my app for the AppExchange security review?
Answer:
The “Code Style” category of PMD rules is not relevant for AppExchange security reviews. You should focus only on the rules required for AppExchange submissions. Salesforce provides a custom PMD variant called pmd-appexchange
specifically tailored for preparing your managed packages for the security review process.
Boost your career with expert Salesforce training in Noida—join our free demo and start your journey to certification today!!!
To avoid irrelevant rules like the Code Style category, you can run the scan with the AppExchange-specific ruleset. Use the following command:
codesf scanner run --engine pmd-appexchange
This command ensures that only the required rules are scanned and reported. Adding the generated Apex class to the “False Positive” list is unnecessary because the Code Style category is excluded from the security review process. Following Salesforce’s official documentation on Code Analyzer and PMD rules should suffice to address your concerns.
Summing Up:
When preparing an AppExchange app, focus on security review requirements rather than irrelevant warnings like code style PMD errors. Issues such as mismatched variable or field names in WSDL-generated Metadata service classes fall under “code style,” which is not evaluated during security review. To streamline the process, use the pmd-appexchange
engine, a specialized PMD variant aligning with security review standards. Running sf scanner run --engine pmd-appexchange
ensures analysis against only relevant rules, avoiding distractions from stylistic violations. Prioritizing AppExchange-specific rules over general code style guidelines saves time and ensures compliance. Stylistic errors need not be marked as false positives, as they do not impact the review. Instead, leverage Salesforce’s custom tools to meet security and functional criteria for smooth submission.
Salesforce Training in Noida – Accelerate Your Career Today!
Unlock your potential with our industry-recognized Salesforce training program in Noida, tailored for aspiring professionals and seasoned experts alike. Gain in-depth knowledge of Salesforce CRM, hands-on experience with real-world projects, and expert guidance to help you ace certifications like Salesforce Admin and Developer. Our curriculum is designed to make you job-ready and elevate your career to new heights.
Our focuses on practical, industry-relevant learning. Salesforce training in Noida With personalized guidance, comprehensive course materials, and expert support for certification and interview prep, we make sure you’re job-ready.
Enroll today for a free demo session and take the first step towards a successful Salesforce career!!!