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

Help: update list of config options #809

Merged
merged 1 commit into from
Feb 15, 2025

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Feb 11, 2025

Description

Follow up on #447

I noticed while working on something else that some typical config options were missing from the list in the help text.

The difference between the previously listed ones and the additional options I'm now adding to the list, is that the original set of options are options which the Config class manages and for which it has a default value, while the additional options I'm now adding are used at runtime in various places by PHPCS, but do not have default value management in the Config class.

Whether default value handling of these options should be added to the Config class is up for debate, however, making it more discoverable that these options exist and can be used, seems like an easy win for usability.

  • installed_paths is probably the best known one and is used to register external standards with PHPCS. It is used in the Util\Standards class.
  • php_version is a way to tell PHPCS what PHP version the code is supposed to run on. It is used by select sniffs.
  • ignore_errors_on_exit and ignore_warnings_on_exit influence the exit code used by PHPCS and is used in the Runner class.

These additional options are all mentioned and described in more detail in the wiki: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options

Suggested changelog entry

The -h option now contains a more extensive list of "config" options which can be set.

Related issues/external references

Fixes squizlabs/PHP_CodeSniffer#2412
/cc @aik099

Follow up on 447

I noticed while working on something else that some typical config options were missing from the list in the help text.

The difference between the previously listed ones and the additional options I'm now adding to the list, is that the original set of options are options which the `Config` class manages and for which it has a default value, while the additional options I'm now adding are used at runtime in various places by PHPCS, but do not have default value management in the `Config` class.

Whether default value handling of these options should be added to the `Config` class is up for debate, however, making it more discoverable that these options _exist_ and can be used, seems like an easy win for usability.

* `installed_paths` is probably the best known one and is used to register external standards with PHPCS. It is used in the `Util\Standards` class.
* `php_version` is a way to tell PHPCS what PHP version they code is supposed to run on. It is used by select sniffs.
* `ignore_errors_on_exit` and `ignore_warnings_on_exit` influence the exit code used by PHPCS and is used in the `Runner` class.

These additional options are all mentioned and described in more detail in the wiki: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options

Fixes squizlabs/PHP_CodeSniffer 2412
@jrfnl jrfnl merged commit 530cc74 into master Feb 15, 2025
59 checks passed
@jrfnl jrfnl deleted the feature/sq-2412-help-list-predefined-config-options branch February 15, 2025 22:00
@aik099
Copy link

aik099 commented Feb 16, 2025

Nice. Thank you @jrfnl .

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

Successfully merging this pull request may close these issues.

The "phpcs" doesn't use error exit code when invalid standard is given
3 participants