dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.57k stars 1.44k forks source link

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

Closed shadowwa closed 11 months ago

shadowwa commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

w0rp commented 11 months ago

Cheers! :beers: