[x] Have you added an entry to the CHANGELOG.md file's [Unreleased] section?
Changes proposed in this Pull Request:
This pull request adds a new Automatic option for phpCodeSniffer.standard. When this new option is used the extension will attempt to find one of the configuration file types that we've defined. It will traverse from the document's directory to the workspace root seeking out an appropriate file.
As part of this work I also went ahead and refactored the way that the standard works a little bit. There's no longer a need to check for type strings and I've removed the StandardType enum entirely.
Closes #59.
How to test the changes in this Pull Request:
Set phpCodeSniffer.standard to Automatic in the settings.
Create a workspace that has both a root phpcs.xml file and a phpcs.xml file in a nested directory.
Create a PHP file in the nested directory and make sure it violates the nested coding standard but not the one at the root.
Delete the nested coding standard and the errors should go away.
Rename the root file to .phpcs.xml and verify that it still works.
What do you think of this solution? If it's not too much trouble, could you try this PR out with your workspace and see if it works like you'd expect it to?
All Submissions:
Changes proposed in this Pull Request:
This pull request adds a new
Automatic
option forphpCodeSniffer.standard
. When this new option is used the extension will attempt to find one of the configuration file types that we've defined. It will traverse from the document's directory to the workspace root seeking out an appropriate file.As part of this work I also went ahead and refactored the way that the standard works a little bit. There's no longer a need to check for type strings and I've removed the
StandardType
enum entirely.Closes #59.
How to test the changes in this Pull Request:
phpCodeSniffer.standard
toAutomatic
in the settings.phpcs.xml
file and aphpcs.xml
file in a nested directory..phpcs.xml
and verify that it still works.