You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GH Actions: add automation for generating output examples for the wiki (#20)
* GH Actions: prepare the workflow for auto-generating output snippets
* Run phpcs/phpcbf commands to auto-generate output blocks
* GH Actions/basic QA: add shellcheck job
As this repo now contains a shell script to find & replace placeholders for output snippets in the wiki files with real output, let's also run a minimal QA check on the code of the shell script.
Refs:
* https://github.com/koalaman/shellcheck
* https://github.com/koalaman/shellcheck/wiki
---------
Co-authored-by: jrfnl <[email protected]>
Co-authored-by: Dan Wallis <[email protected]>
The automation for the PHP_CodeSniffer wiki allows for running `phpcs`/`phpcbf` commands to generate output examples for the documentation using the `build/wiki-command-replacer.sh` script.
4
+
5
+
Sometimes a command will need some code to run `phpcs`/`phpcbf` over to obtain the output to display in the wiki.
6
+
7
+
The code samples needed for this, should be placed in this directory.
Copy file name to clipboardExpand all lines: wiki/Fixing-Errors-Automatically.md
+1-72Lines changed: 1 addition & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,78 +36,7 @@ PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
36
36
37
37
To automatically fix as many sniff violations as possible, use the `phpcbf` command instead of the `phpcs` command. While most of the PHPCS command line arguments can be used by PHPCBF, some are specific to reporting and will be ignored. Running PHPCBF with the `-h` or `--help` command line arguments will print a list of commands that PHPCBF will respond to. The output of `phpcbf -h` is shown below.
38
38
```text
39
-
Usage:
40
-
phpcbf [options] <file|directory>
41
-
42
-
Scan targets:
43
-
<file|directory> One or more files and/or directories to check, space separated.
44
-
- Check STDIN instead of local files and directories.
45
-
--stdin-path=<stdinPath> If processing STDIN, the file path that STDIN will be processed as.
46
-
--file-list=<fileList> Check the files and/or directories which are defined in the file to which the
47
-
path is provided (one per line).
48
-
--filter=<filter> Check based on a predefined file filter. Use either the "GitModified" or
49
-
"GitStaged" filter, or specify the path to a custom filter class.
50
-
--ignore=<patterns> Ignore files based on a comma-separated list of patterns matching files and/or
51
-
directories.
52
-
--extensions=<extensions> Check files with the specified file extensions (comma-separated list).
53
-
Defaults to php,inc/php,js,css.
54
-
The type of the file can be specified using: ext/type; e.g. module/php,es/js.
55
-
-l Check local directory only, no recursion.
56
-
57
-
Rule Selection Options:
58
-
--standard=<standard> The name of, or the path to, the coding standard to use. Can be a
59
-
comma-separated list specifying multiple standards. If no standard is
60
-
specified, PHP_CodeSniffer will look for a [.]phpcs.xml[.dist] custom ruleset
61
-
file in the current directory and those above it.
62
-
--sniffs=<sniffs> A comma-separated list of sniff codes to limit the scan to. All sniffs must be
63
-
part of the standard in use.
64
-
--exclude=<sniffs> A comma-separated list of sniff codes to exclude from the scan. All sniffs
65
-
must be part of the standard in use.
66
-
67
-
-i Show a list of installed coding standards.
68
-
69
-
Run Options:
70
-
--bootstrap=<bootstrap> Run the specified file(s) before processing begins. A list of files can be
71
-
provided, separated by commas.
72
-
--parallel=<processes> The number of files to be checked simultaneously. Defaults to 1 (no parallel
73
-
processing).
74
-
If enabled, this option only takes effect if the PHP PCNTL (Process Control)
75
-
extension is available.
76
-
--suffix=<suffix> Write modified files to a filename using this suffix ("diff" and "patch" are
77
-
not used in this mode).
78
-
79
-
-d <key[=value]> Set the [key] php.ini value to [value] or set to [true] if value is omitted.
80
-
Note: only php.ini settings which can be changed at runtime are supported.
81
-
82
-
Reporting Options:
83
-
--report-width=<reportWidth> How many columns wide screen reports should be. Set to "auto" to use current
84
-
screen width, where supported.
85
-
--basepath=<basepath> Strip a path from the front of file paths inside reports.
86
-
87
-
-w Include both warnings and errors (default).
88
-
-n Do not include warnings. Shortcut for "--warning-severity=0".
89
-
--severity=<severity> The minimum severity required to display an error or warning. Defaults to 5.
90
-
--error-severity=<severity> The minimum severity required to display an error. Defaults to 5.
91
-
--warning-severity=<severity> The minimum severity required to display a warning. Defaults to 5.
92
-
93
-
--ignore-annotations Ignore all "phpcs:..." annotations in code comments.
94
-
--colors Use colors in screen output.
95
-
--no-colors Do not use colors in screen output (default).
96
-
-p Show progress of the run.
97
-
-q Quiet mode; disables progress and verbose output.
98
-
99
-
Configuration Options:
100
-
--encoding=<encoding> The encoding of the files being checked. Defaults to "utf-8".
101
-
--tab-width=<tabWidth> The number of spaces each tab represents.
102
-
103
-
--runtime-set <key> <value> Set a configuration option to be applied to the current scan run only.
104
-
105
-
Miscellaneous Options:
106
-
-h, -?, --help Print this help message.
107
-
--version Print version information.
108
-
-v Verbose output: Print processed files.
109
-
-vv Verbose output: Print ruleset and token output.
Copy file name to clipboardExpand all lines: wiki/Usage.md
+3-117Lines changed: 3 additions & 117 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,103 +10,7 @@
10
10
Running PHP_CodeSniffer with the `-h` or `--help` command line arguments will print a list of commands that PHP_CodeSniffer will respond to. The output of `phpcs -h` is shown below.
11
11
12
12
```text
13
-
Usage:
14
-
phpcs [options] <file|directory>
15
-
16
-
Scan targets:
17
-
<file|directory> One or more files and/or directories to check, space separated.
18
-
- Check STDIN instead of local files and directories.
19
-
--stdin-path=<stdinPath> If processing STDIN, the file path that STDIN will be processed as.
20
-
--file-list=<fileList> Check the files and/or directories which are defined in the file to which the
21
-
path is provided (one per line).
22
-
--filter=<filter> Check based on a predefined file filter. Use either the "GitModified" or
23
-
"GitStaged" filter, or specify the path to a custom filter class.
24
-
--ignore=<patterns> Ignore files based on a comma-separated list of patterns matching files
25
-
and/or directories.
26
-
--extensions=<extensions> Check files with the specified file extensions (comma-separated list).
27
-
Defaults to php,inc/php,js,css.
28
-
The type of the file can be specified using: ext/type; e.g. module/php,es/js.
29
-
-l Check local directory only, no recursion.
30
-
31
-
Rule Selection Options:
32
-
--standard=<standard> The name of, or the path to, the coding standard to use. Can be a
33
-
comma-separated list specifying multiple standards. If no standard is
34
-
specified, PHP_CodeSniffer will look for a [.]phpcs.xml[.dist] custom ruleset
35
-
file in the current directory and those above it.
36
-
--sniffs=<sniffs> A comma-separated list of sniff codes to limit the scan to. All sniffs must
37
-
be part of the standard in use.
38
-
--exclude=<sniffs> A comma-separated list of sniff codes to exclude from the scan. All sniffs
39
-
must be part of the standard in use.
40
-
41
-
-i Show a list of installed coding standards.
42
-
-e Explain a standard by showing the names of all the sniffs it includes.
43
-
--generator=<generator> Show documentation for a standard. Use either the "HTML", "Markdown" or
44
-
"Text" generator.
45
-
46
-
Run Options:
47
-
-a Run in interactive mode, pausing after each file.
48
-
--bootstrap=<bootstrap> Run the specified file(s) before processing begins. A list of files can be
49
-
provided, separated by commas.
50
-
--cache[=<cacheFile>] Cache results between runs. Optionally, <cacheFile> can be provided to use a
51
-
specific file for caching. Otherwise, a temporary file is used.
52
-
--no-cache Do not cache results between runs (default).
53
-
--parallel=<processes> The number of files to be checked simultaneously. Defaults to 1 (no parallel
54
-
processing).
55
-
If enabled, this option only takes effect if the PHP PCNTL (Process Control)
56
-
extension is available.
57
-
58
-
-d <key[=value]> Set the [key] php.ini value to [value] or set to [true] if value is omitted.
59
-
Note: only php.ini settings which can be changed at runtime are supported.
60
-
61
-
Reporting Options:
62
-
--report=<report(s)> A comma-separated list of reports to print. Available reports: "full", "xml",
0 commit comments