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

fix tempfile for phpmd, to be able to use phpmd 2.14.0 #4617

Merged
merged 1 commit into from
Dec 10, 2023

Conversation

shadowwa
Copy link
Contributor

phpmd, until version 2.13.0 was taking the file to test as first argument (%s) and ignored the last argument (%t)
since version 2.14.0 if a last argument is given, phpmd exits with this message:

Can't find the custom report class: cleancode,codesize,controversial,design,naming,unusedcode

Moreover, phpmd is checking the filename hence show diagnostic for saved buffer only.

With this modification, phpmd 2.14.0 is able to run correctly and the diagnostic is done on the temp file provided by Ale and is refreshed even if the buffer is not yet saved.

@w0rp
Copy link
Member

w0rp commented Sep 27, 2023

How does phpmd behave in older versions if supplied with these arguments? If it works just as well for versions that go back a few years, we can make this change.

If this changes breaks older versions, we can support both versions by chaining the command with a version check. Have a search for ale#semver in the codebase. Note that AssertLinter can accept a List for the expected output to check every command in a chain that is run to test version commands.

@shadowwa
Copy link
Contributor Author

I've tried with the earliest versions available on packagist.org:

  • phpmd 1.5.0 (2013-07-26) works fine out of the box with theses arguments.
  • phpmd 1.4.0 (2012-09-07) works fine with theses arguments (but since ruleset cleancode was introduce in phpmd 1.5.0, you just have to remove cleancode from g:ale_php_phpmd_ruleset option in .vimrc, if you want to test it).

@w0rp w0rp merged commit ecc796b into dense-analysis:master Dec 10, 2023
6 checks passed
@w0rp
Copy link
Member

w0rp commented Dec 10, 2023

Cheers! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants