Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

PMD validate error #567

Closed
abrm099 opened this issue Jun 28, 2021 · 8 comments · Fixed by #635
Closed

PMD validate error #567

abrm099 opened this issue Jun 28, 2021 · 8 comments · Fixed by #635
Assignees
Labels
bug Something isn't working

Comments

@abrm099
Copy link

abrm099 commented Jun 28, 2021

Describe the bug
When the Azure Devops pipeline runs PMD static code analysis via sfpowerscripts sfpowerkit as per the following command line,
npx sfdx sfpowerkit:source:pmd -d force-app-package_src_delta/force-app -f text -r setup/pmd-ruleset.xml --version=6.36.0 --loglevel INFO

I gives the following warning
{"name":"Pmd","hostname":"fv-az69-443","pid":2528,"level":40,"msg":"[\n 'WARNING:',\n '--ruleset has been deprecated and will be removed in a future version. Use --rulesets instead.'\n]","time":"2021-06-28T09:50:29.900Z","v":0}

WARNING: --ruleset has been deprecated and will be removed in a future version. Use --rulesets instead.

and the tasks exist with error code 4
##[error]Exit with error code 4

To Reproduce

  1. sfdx sfpowerkit:source:pmd -d force-app-package_src_delta/force-app -f text -r setup/pmd-ruleset.xml --version=6.36.0 --loglevel INFO

Expected behavior
None of the errors highlighted where critical errors so the task should have passed.

Screenshots
image
image
image

Desktop (please complete the following information):

Installing plugin sfpowerkit... yarn add v1.22.10
Installing plugin sfpowerkit... info No lockfile found.Installing plugin sfpowerkit... [1/4] Resolving packages...Installing plugin sfpowerkit... [2/4] Fetching packages...Installing plugin sfpowerkit... [3/4] Linking dependencies...Installing plugin sfpowerkit... [4/4] Building fresh packages...Installing plugin sfpowerkit... success Saved lockfile.Installing plugin sfpowerkit... success Saved 339 new dependencies.Installing plugin sfpowerkit... info Direct dependenciesInstalling plugin sfpowerkit... └─ [email protected] plugin sfpowerkit... info All dependenciesInstalling plugin sfpowerkit... ├─ @hapi/[email protected] plugin sfpowerkit... ├─ @salesforce/[email protected] plugin sfpowerkit... ├─ @types/[email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... ├─ [email protected] plugin sfpowerkit... └─ [email protected] plugin sfpowerkit... Done in 13.01s.Installing plugin sfpowerkit... installed v3.1.5
warning sfpowerkit > [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see request/request#3142
warning sfpowerkit > [email protected]: request has been deprecated, see request/request#3142
warning sfpowerkit > salesforce-alm > [email protected]: request has been deprecated, see request/request#3142
warning sfpowerkit > salesforce-alm > [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see request/request#3142
warning sfpowerkit > @salesforce/core > jsforce > [email protected]: request has been deprecated, see request/request#3142
warning sfpowerkit > request > [email protected]: this library is no longer supported
warning sfpowerkit > request > [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning sfpowerkit > salesforce-alm > @salesforce/source-deploy-retrieve > @salesforce/core > jsforce > [email protected]: request has been deprecated, see request/request#3142
warning "sfpowerkit > [email protected]" has unmet peer dependency "typescript@>=2.7".
warning "sfpowerkit > @salesforce/command > @oclif/[email protected]" has unmet peer dependency "@oclif/config@^1".
The plugin [sfpowerkit] is not digitally signed but it is allow-listed.
Finished digital signature check.

@azlam-abdulsalam
Copy link
Contributor

Azure Pipelines using sfpowerscripts azure pipelines is deprecated. Please use sfpowerkit directly using cli

@abrm099
Copy link
Author

abrm099 commented Jun 29, 2021

Hi

I have just run the same command using a Command line script task and I am getting the same result. I don't think this is related to any deprecation as this only started happening on the 28th of June.
image
image
These commands ran previously when it was running correctly.
image
No commands like orevious.
image

@azlam-abdulsalam azlam-abdulsalam transferred this issue from dxatscale/sfpowerkit Jun 29, 2021
@azlam-abdulsalam
Copy link
Contributor

@abrm099 sfpowerscripts provide the functionality whether to break etc. sfpowerkit just run's PMD and produce a report.

You might need to use this command
https://sfpowerscripts.dxatscale.io/commands/command-glossary#sfdx-sfpowerscripts-analyze-pmd

@azlam-abdulsalam
Copy link
Contributor

Please refer to https://github.com/Accenture/sfpowerkit/issues/514 for the enhancement done on PMD command

@abrm099
Copy link
Author

abrm099 commented Jul 7, 2021

Ok so based on all my trials and tribulations, at the end of the day SFPowerscripts changed how they handle PMD and how PMD responds, SFPowerscripts have made changes to respond in the same manner as PMD. So any violation regardless of its priority returns and exit code of 4. This happens when calling the command directly or using PMD SFPowscript tasks. So for now what I have decided todo is to comment out all none priority 1 rules and run PMD using command line task.

@azlam-abdulsalam
Copy link
Contributor

Ah got it, sfpowerscripts haven't properly handled sfpowerkit PMD changes. Will fix it in this release

@azlam-abdulsalam azlam-abdulsalam added this to the Release - August 21 milestone Jul 7, 2021
@azlam-abdulsalam azlam-abdulsalam self-assigned this Jul 7, 2021
@azlam-abdulsalam azlam-abdulsalam added the bug Something isn't working label Jul 7, 2021
@rody
Copy link
Contributor

rody commented Jul 27, 2021

@abrm099 if you are using sfpowerkit directly, you can use the following flags to control when PMD should "fail":

  • --minimumpriority=minimumpriority which sets the priority threshold
  • --[no-]failonviolation to activate or desactivate the failure (useful if you only want to generate a report)

@azlam-abdulsalam It seems that the README in sfpowerkit is not up to date for the PMD command. I've raised an issue for that at https://github.com/Accenture/sfpowerkit/issues/547

@azlam-abdulsalam
Copy link
Contributor

Yep, @Caitlyn-Mills will be updating this shortly. Thanks @rody

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants