ObliviousHarmony / vscode-php-codesniffer

A VS Code extension for integrating PHP_CodeSniffer.
https://marketplace.visualstudio.com/items?itemName=obliviousharmony.vscode-php-codesniffer
Other
40 stars 2 forks source link

Worker's Working Directory Shouldn't Change #60

Closed ObliviousHarmony closed 1 year ago

ObliviousHarmony commented 1 year ago

Description

When phpCodeSniffer.autoExecutable is enabled, the extension will infer the working directory of phpcs based on how it executes the linter. It will be set to the directory containing the composer.json it found the phpcs executable in, otherwise, it will fall back to the workspace root.

Since the path in phpCodeSniffer.standardCustom can be relative, we can easily leave users confused about why their standard isn't working like they expect it to.

Expected Behavior

The working directory should be consistent so that standards will not be relative.

ObliviousHarmony commented 1 year ago

It's worth pointing out that the README.md file already explicitly says it will resolve from the workspace root. It's clear that this behavior wasn't even documented.

ObliviousHarmony commented 1 year ago

It would also probably be a good idea to provide an error if the custom standard file being referenced does not exist.