benmatselby / sublime-phpcs

🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
812 stars 126 forks source link

phpcs_additional_args --runtime-set not working due to empty duplicate #206

Closed MichelleBlanchette closed 1 year ago

MichelleBlanchette commented 1 year ago

Relates to issue https://github.com/benmatselby/sublime-phpcs/issues/155

I'm wanting to use --runtime-set testVersion 5.6- but it isn't working. It seems the argument gets duplicated with an empty value, making the original value obsolete.

phpcs.sublime-settings

    "phpcs_additional_args": {
        "-n": "",
        "--standard": "WordPress,PHPCompatibilityWP",
        "--runtime-set": "testVersion 5.6-"
    },

Sublime Console Output

[Phpcs] phpcs --report=checkstyle --runtime-set testVersion 5.6 --runtime-set --standard=WordPress,PHPCompatibilityWP -n <REDACTED>.php

Attempted workarounds that didn't resolve the issue:

Environment

MichelleBlanchette commented 1 year ago

I'm not a Python developer, but I think the for-loop just needs to be continued after the --runtime-set arg key and its value are appended to the set of arguments. The duplicate is likely caused by the args.append(arg) at the end of the loop.

https://github.com/benmatselby/sublime-phpcs/blob/c516c15ff9567a81c81363f1b9016101ca2e618e/phpcs.py#L214-L222

MichelleBlanchette commented 1 year ago

I understand this package is no longer maintained, so I've switched to using the main SublimeLinter package set: https://packagecontrol.io/packages/SublimeLinter-phpcs

benmatselby commented 1 year ago

Hey @MichelleBlanchette

Apologies, you're right, I don't use SublimeText anymore. I hope SublimeLinter meets your requirements :)