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

Config: revamp the help screen(s) #447

Merged
merged 1 commit into from
Apr 28, 2024
Merged

Commits on Apr 28, 2024

  1. Config: revamp the help screen(s)

    This PR attempts to make the help information more informative and to improve the readability and findability of options.
    
    This should be seen as a first step to address user concerns about difficulty in finding the options they are looking for and understanding how certain options work, like seen in the recent months in tickets 10/294/419, 248, 322, 415 and 434.
    
    The format for the new screens is inspired by similar help screens as currently in use in various other typical CLI tools, like PHPUnit and PHPStan.
    This includes the choice for the use of colours and which colours to use.
    
    The option descriptions are based on the previously available option descriptions with some improvements where I deemed those appropriate.
    I've elected to keep the descriptions short though as this is a help screen, not a tutorial.
    
    Notes:
    * I've chosen to move the logic to generate the help screen to a separate (internal) class.
        This new class is fully covered by tests, including various QA tests which function as error-prevention when new options would be added.
    * The output, by default, is not coloured, as PHPCS default to `--no-colors`. To get coloured output, either ensure the `colors` option is saved as `1` in the user-specific configuration using `--config-set colors 1` (making PHPCS default to `--colors`) or pass `--colors` on the command line.
        Note: if `--colors` is passed on the command line _after the `-h` argument, it will have no effect. This is a symptom of how the CLI argument processing currently works and is considered as out of scope of this issue.
    * The output will respect the `report-width` setting (which defaults to `auto`, i.e. width of the current screen), as long as the `report-width` is 60 columns or more.
        If the `report-width` is set to below 60 columns, a width of 60 will be used anyway to allow for displaying the texts.
    * `colors` and `report-width` settings as saved to a `CodeSniffer.conf` file via `--config-set` will be respected when displaying the help screens.
    * `colors` and `report-width` settings provided via a custom ruleset have no effect on the help screens.
    
    Todo:
    - [ ] Update Wiki [Usage](https://github.com/phpcsstandards/PHP_CodeSniffer/wiki/Usage) page before tagging the release which will contain this change.
    jrfnl committed Apr 28, 2024
    Configuration menu
    Copy the full SHA
    b0f05e3 View commit details
    Browse the repository at this point in the history