Closed jrfnl closed 4 months ago
The PR changes --colors
to be the default, but the help text is wrong regarding that.
The PR changes
--colors
to be the default, but the help text is wrong regarding that.
I don't believe it does. From the original PR description:
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.
Okay, maybe I misunderstood what the change was when reading the code.
At the suggestion of @GaryJones - this is what the "before" looked like:
PHPCS:
PHPCBF:
Rebased without (further) changes after the merge of #445 to drop the commits which belonged to #445. Marking as ready for review.
If there is no further feedback I will merge this in a couple of days.
Rebased without changes, just squashed the commits together. Merging once the build passes.
👉🏻 This PR depends on PR #445 .
Description
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:
--no-colors
. To get coloured output, either ensure thecolors
option is saved as1
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. See #448.report-width
setting (which defaults toauto
, i.e. width of the current screen), as long as thereport-width
is 60 columns or more. If thereport-width
is set to below 60 columns, a width of 60 will be used anyway to allow for displaying the texts.colors
andreport-width
settings as saved to aCodeSniffer.conf
file via--config-set
will be respected when displaying the help screens.colors
andreport-width
settings provided via a custom ruleset have no effect on the help screens.Todo:
Suggested changelog entry
The help screens have received a face-lift.
Types of changes
Testing this PR
To test this PR manually:
phpcs.phar
/phpcbf.phar
files generated as build artifacts in the GH Actions workflows (these can be found on the "Summary" page of the latest "Test" workflow run for this PR).phpcs --colors -h
phpcbf --colors -?
phpcs --no-colors -h
phpcbf --no-colors --help
--report-width=#
(passed on the command-line before the-h
).I'm in particularly looking for feedback on the choices made regarding:
Screenshots
New Help screen for PHPCS
New Help screen for PHPCBF