cvs: peardoc /en/package/php/php-codesniffer advanced-usage.xml usage.xml
[email protected] ("Greg Sherwood")
| Newsgroups | php.pear.doc |
|---|---|
| Message-ID | <cvssquiz1194414680@cvsserver> |
squiz Wed Nov 7 05:51:20 2007 UTC
Modified files:
/peardoc/en/package/php/php-codesniffer advanced-usage.xml
usage.xml
Log:
Updated CLI help output. Documented checkstyle report format. Updated XML report format. Moved XML, CSV, Checkstyle report formats to advanced usage. Documented new config-delete command line arg.
squiz-20071107055120.txt
(text/plain, 17.2 KB)
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-codesniffer/advanced-usage.xml?r1=1.4&r2=1.5&diff_format=u
Index: peardoc/en/package/php/php-codesniffer/advanced-usage.xml
diff -u peardoc/en/package/php/php-codesniffer/advanced-usage.xml:1.4 peardoc/en/package/php/php-codesniffer/advanced-usage.xml:1.5
--- peardoc/en/package/php/php-codesniffer/advanced-usage.xml:1.4 Wed Sep 19 04:40:32 2007
+++ peardoc/en/package/php/php-codesniffer/advanced-usage.xml Wed Nov 7 05:51:20 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<refentry id="package.php.php-codesniffer.advanced-usage">
<refnamediv>
<refname>Advanced Usage</refname>
@@ -80,6 +80,151 @@
</refsect1>
+ <refsect1 id="package.php.php-codesniffer.advanced-usage.xml-report">
+ <title>Printing an XML Report</title>
+ <para>
+ PHP_CodeSniffer can output an XML report to allow you to parse the output easily and use the results in your own scripts. To print an XML report, use the <literal>--report=xml</literal> command line argument. The output will look like this:
+ </para>
+ <example>
+ <title>Sample PHP_CodeSniffer XML output</title>
+ <screen>
+<![CDATA[
+$ phpcs --report=xml /path/to/code
+
+<?xml version="1.0" encoding="UTF-8"?>
+<phpcs version="1.0.0">
+ <file name="/path/to/code/myfile.php" errors="5" warnings="1">
+ <error line="2" column="1">Missing file doc comment</error>
+ <error line="20" column="43">PHP keywords must be lowercase; expected "false" but found "FALSE"</error>
+ <error line="47" column="1">Line not indented correctly; expected 4 spaces but found 1</error>
+ <warning line="47" column="20">Equals sign not aligned with surrounding assignments</warning>
+ <error line="51" column="4">Missing function doc comment</error>
+ <error line="88" column="1">Line not indented correctly; expected 9 spaces but found 6</error>
+ </file>
+</phpcs>
+]]>
+ </screen>
+ </example>
+ <para>
+ As with the full report, you can suppress the printing of warnings with the <literal>-n</literal> command line argument.
+ </para>
+ <example>
+ <title>Sample PHP_CodeSniffer XML output with no warnings</title>
+ <screen>
+<![CDATA[
+$ phpcs -n --report=xml /path/to/code
+
+<?xml version="1.0" encoding="UTF-8"?>
+<phpcs version="1.0.0">
+ <file name="/path/to/code/myfile.php" errors="5" warnings="0">
+ <error line="2" column="1">Missing file doc comment</error>
+ <error line="20" column="43">PHP keywords must be lowercase; expected "false" but found "FALSE"</error>
+ <error line="47" column="1">Line not indented correctly; expected 4 spaces but found 1</error>
+ <error line="51" column="4">Missing function doc comment</error>
+ <error line="88" column="1">Line not indented correctly; expected 9 spaces but found 6</error>
+ </file>
+</phpcs>
+]]>
+ </screen>
+ </example>
+ </refsect1>
+
+
+ <refsect1 id="package.php.php-codesniffer.advanced-usage.checkstyle-report">
+ <title>Printing a Checkstyle Report</title>
+ <para>
+ PHP_CodeSniffer can output an XML report similar to the one produced by <ulink url="http://checkstyle.sourceforge.net/">Checkstyle</ulink>, allowing you to use the output in scripts and applications that already support Checkstyle. To print a Checkstyle report, use the <literal>--report=checkstyle</literal> command line argument. The output will look like this:
+ </para>
+ <example>
+ <title>Sample PHP_CodeSniffer Checkstyle output</title>
+ <screen>
+<![CDATA[
+$ phpcs --report=checkstyle /path/to/code
+
+<?xml version="1.0" encoding="UTF-8"?>
+<checkstyle version="1.0.0">
+ <file name="/path/to/code/myfile.php">
+ <error line="2" column="1" severity="error" message="Missing file doc comment"/>
+ <error line="20" column="43" severity="error" message="PHP keywords must be lowercase; expected "false" but found "FALSE""/>
+ <error line="47" column="1" severity="error" message="Line not indented correctly; expected 4 spaces but found 1"/>
+ <error line="47" column="20" severity="warning" message="Equals sign not aligned with surrounding assignments"/>
+ <error line="51" column="4" severity="error" message="Missing function doc comment"/>
+ <error line="88" column="1" severity="error" message="Line not indented correctly; expected 9 spaces but found 6"/>
+ </file>
+</checkstyle>
+]]>
+ </screen>
+ </example>
+ <para>
+ As with the full report, you can suppress the printing of warnings with the <literal>-n</literal> command line argument.
+ </para>
+ <example>
+ <title>Sample PHP_CodeSniffer Checkstyle output with no warnings</title>
+ <screen>
+<![CDATA[
+$ phpcs -n --report=checkstyle /path/to/code
+
+<?xml version="1.0" encoding="UTF-8"?>
+<checkstyle version="1.0.0">
+ <file name="/path/to/code/myfile.php">
+ <error line="2" column="1" severity="error" message="Missing file doc comment"/>
+ <error line="20" column="43" severity="error" message="PHP keywords must be lowercase; expected "false" but found "FALSE""/>
+ <error line="47" column="1" severity="error" message="Line not indented correctly; expected 4 spaces but found 1"/>
+ <error line="51" column="4" severity="error" message="Missing function doc comment"/>
+ <error line="88" column="1" severity="error" message="Line not indented correctly; expected 9 spaces but found 6"/>
+ </file>
+</checkstyle>
+]]>
+ </screen>
+ </example>
+ </refsect1>
+
+
+ <refsect1 id="package.php.php-codesniffer.advanced-usage.csv-report">
+ <title>Printing a CSV Report</title>
+ <para>
+ PHP_CodeSniffer can output a CSV report to allow you to parse the output easily and use the results in your own scripts. To print a CSV report, use the <literal>--report=csv</literal> command line argument. The output will look like this:
+ </para>
+ <example>
+ <title>Sample PHP_CodeSniffer CSV output</title>
+ <screen>
+<![CDATA[
+$ phpcs --report=csv /path/to/code
+
+File,Line,Column,Severity,Message
+"/path/to/code/myfile.php",2,1,error,"Missing file doc comment"
+"/path/to/code/myfile.php",20,43,error,"PHP keywords must be lowercase; expected \"false\" but found \"FALSE\""
+"/path/to/code/myfile.php",47,1,error,"Line not indented correctly; expected 4 spaces but found 1"
+"/path/to/code/myfile.php",47,20,warning,"Equals sign not aligned with surrounding assignments"
+"/path/to/code/myfile.php",51,4,error,"Missing function doc comment"
+"/path/to/code/myfile.php",88,1,error,"Line not indented correctly; expected 9 spaces but found 6"
+]]>
+ </screen>
+ </example>
+ <para>
+ As with the full report, you can suppress the printing of warnings with the <literal>-n</literal> command line argument.
+ </para>
+ <example>
+ <title>Sample PHP_CodeSniffer CSV output with no warnings</title>
+ <screen>
+<![CDATA[
+$ phpcs -n --report=csv /path/to/code
+
+File,Line,Column,Severity,Message
+"/path/to/code/myfile.php",2,1,error,"Missing file doc comment"
+"/path/to/code/myfile.php",20,43,error,"PHP keywords must be lowercase; expected \"false\" but found \"FALSE\""
+"/path/to/code/myfile.php",47,1,error,"Line not indented correctly; expected 4 spaces but found 1"
+"/path/to/code/myfile.php",51,4,error,"Missing function doc comment"
+"/path/to/code/myfile.php",88,1,error,"Line not indented correctly; expected 9 spaces but found 6"
+]]>
+ </screen>
+ </example>
+ <note>
+ <simpara>
+ The first row of the CSV output defines the order of information. When using the CSV output, please parse this header row to determine the order correctly as the format may change over time or new information may be added.
+ </simpara>
+ </note>
+ </refsect1>
<refsect1 id="package.php.php-codesniffer.advanced-usage.config-set">
@@ -103,7 +248,25 @@
</refsect1>
-
+ <refsect1 id="package.php.php-codesniffer.advanced-usage.config-delete">
+ <title>Deleting Configuration Options</title>
+ <para>
+ PHP_CodeSniffer allows you to delete any configuration option, reverting it to its default value. <link linkend="package.php.php-codesniffer.config-options">View a full list of configuration options.</link>
+ </para>
+ <para>
+ To delete a configuration option, use the <literal>--config-delete</literal> command line argument.
+ </para>
+ <example>
+ <title>Deleting a configuration option</title>
+ <screen>
+ <userinput>
+<![CDATA[
+$ phpcs --config-delete <option>
+]]>
+ </userinput>
+ </screen>
+ </example>
+ </refsect1>
<refsect1 id="package.php.php-codesniffer.advanced-usage.config-show">
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-codesniffer/usage.xml?r1=1.8&r2=1.9&diff_format=u
Index: peardoc/en/package/php/php-codesniffer/usage.xml
diff -u peardoc/en/package/php/php-codesniffer/usage.xml:1.8 peardoc/en/package/php/php-codesniffer/usage.xml:1.9
--- peardoc/en/package/php/php-codesniffer/usage.xml:1.8 Mon Oct 29 23:10:52 2007
+++ peardoc/en/package/php/php-codesniffer/usage.xml Wed Nov 7 05:51:20 2007
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
<refentry id="package.php.php-codesniffer.usage">
<refnamediv>
<refname>Usage</refname>
<refpurpose>Standard usage information</refpurpose>
</refnamediv>
- <refsect1>
+ <refsect1 id="package.php.php-codesniffer.usage.getting-help">
<title>Getting Help from the Command Line</title>
<para>
Running PHP_CodeSniffer with the <literal>-h</literal> or <literal>--help</literal> command line arguments will print a list of commands that PHP_CodeSniffer will respond to. The output of <literal>phpcs -h</literal> is shown below.
@@ -14,11 +14,12 @@
<para>
<screen>
<![CDATA[
-Usage: phpcs [-nlvi] [--report=<report>] [--standard=<standard>]
- [--config-set key value] [--config-show]
+Usage: phpcs [-nwlvi] [--report=<report>] [--standard=<standard>]
+ [--config-set key value] [--config-delete key] [--config-show]
[--generator=<generator>] [--extensions=<extensions>]
[--ignore=<patterns>] <file> ...
-n Do not print warnings
+ -w Print both warnings and errors (on by default)
-l Local directory only, no recursion
-v[v][v] Print verbose output
-i Show a list of installed coding standards
@@ -30,9 +31,11 @@
<patterns> A comma separated list of patterns that are used
to ignore directories and files
<standard> The name of the coding standard to use
- <generator> The name of a doc genertor to use
+ <generator> The name of a doc generator to use
(forces doc generation instead of checking)
- <report> Print either the "full", "xml", "csv" or "summary" report
+ <report> Print either the "full", "xml", "checkstyle",
+ "csv" or "summary" report
+ (the "full" report is printed by default)
]]>
</screen>
@@ -45,7 +48,7 @@
</refsect1>
- <refsect1>
+ <refsect1 id="package.php.php-codesniffer.usage.checking-files-folders">
<title>Checking Files and Folders</title>
<para>
The simplest way of using PHP_CodeSniffer is to provide the location of a file or folder for PHP_CodeSniffer to check. If a folder is provided, PHP_CodeSniffer will check all files it finds in that folder and all its sub-folders.
@@ -127,7 +130,7 @@
</refsect1>
- <refsect1>
+ <refsect1 id="package.php.php-codesniffer.usage.summary-report">
<title>Printing a Summary Report</title>
<para>
By default, PHP_CodeSniffer will print a complete list of all errors and warnings it finds. This list can become quite long, especially when checking a large number of files at once. To print a summary report that only shows the number of errors and warnings for each file, use the <literal>--report=summary</literal> command line argument. The output will look like this:
@@ -175,104 +178,7 @@
</refsect1>
- <refsect1>
- <title>Printing an XML Report</title>
- <para>
- PHP_CodeSniffer can also output a report in XML to allow you to parse the output easily and use the results in your own scripts. To print an XML report, use the <literal>--report=xml</literal> command line argument. The output will look like this:
- </para>
- <example>
- <title>Sample PHP_CodeSniffer XML output</title>
- <screen>
-<![CDATA[
-$ phpcs --report=xml /path/to/code
-
-<?xml version="1.0" encoding="UTF-8"?>
-<phpcs>
- <file name="/path/to/code/myfile.php" errors="5" warnings="1">
- <error line="2" column="1">Missing file doc comment</error>
- <error line="20" column="43">PHP keywords must be lowercase; expected "false" but found "FALSE"</error>
- <error line="47" column="1">Line not indented correctly; expected 4 spaces but found 1</error>
- <warning line="47" column="20">Equals sign not aligned with surrounding assignments</warning>
- <error line="51" column="4">Missing function doc comment</error>
- <error line="88" column="1">Line not indented correctly; expected 9 spaces but found 6</error>
- </file>
-</phpcs>
-]]>
- </screen>
- </example>
- <para>
- As with the full report, you can suppress the printing of warnings with the <literal>-n</literal> command line argument.
- </para>
- <example>
- <title>Sample PHP_CodeSniffer XML output with no warnings</title>
- <screen>
-<![CDATA[
-$ phpcs -n --report=xml /path/to/code
-
-<?xml version="1.0" encoding="UTF-8"?>
-<phpcs>
- <file name="/path/to/code/myfile.php" errors="5" warnings="0">
- <error line="2" column="1">Missing file doc comment</error>
- <error line="20" column="43">PHP keywords must be lowercase; expected "false" but found "FALSE"</error>
- <error line="47" column="1">Line not indented correctly; expected 4 spaces but found 1</error>
- <error line="51" column="4">Missing function doc comment</error>
- <error line="88" column="1">Line not indented correctly; expected 9 spaces but found 6</error>
- </file>
-</phpcs>
-]]>
- </screen>
- </example>
- </refsect1>
-
-
- <refsect1>
- <title>Printing a CSV Report</title>
- <para>
- PHP_CodeSniffer can also output a CSV report to allow you to parse the output easily and use the results in your own scripts. To print a CSV report, use the <literal>--report=csv</literal> command line argument. The output will look like this:
- </para>
- <example>
- <title>Sample PHP_CodeSniffer CSV output</title>
- <screen>
-<![CDATA[
-$ phpcs --report=csv /path/to/code
-
-File,Line,Column,Severity,Message
-"/path/to/code/myfile.php",2,1,error,"Missing file doc comment"
-"/path/to/code/myfile.php",20,43,error,"PHP keywords must be lowercase; expected \"false\" but found \"FALSE\""
-"/path/to/code/myfile.php",47,1,error,"Line not indented correctly; expected 4 spaces but found 1"
-"/path/to/code/myfile.php",47,20,warning,"Equals sign not aligned with surrounding assignments"
-"/path/to/code/myfile.php",51,4,error,"Missing function doc comment"
-"/path/to/code/myfile.php",88,1,error,"Line not indented correctly; expected 9 spaces but found 6"
-]]>
- </screen>
- </example>
- <para>
- As with the full report, you can suppress the printing of warnings with the <literal>-n</literal> command line argument.
- </para>
- <example>
- <title>Sample PHP_CodeSniffer CSV output with no warnings</title>
- <screen>
-<![CDATA[
-$ phpcs -n --report=csv /path/to/code
-
-File,Line,Column,Severity,Message
-"/path/to/code/myfile.php",2,1,error,"Missing file doc comment"
-"/path/to/code/myfile.php",20,43,error,"PHP keywords must be lowercase; expected \"false\" but found \"FALSE\""
-"/path/to/code/myfile.php",47,1,error,"Line not indented correctly; expected 4 spaces but found 1"
-"/path/to/code/myfile.php",51,4,error,"Missing function doc comment"
-"/path/to/code/myfile.php",88,1,error,"Line not indented correctly; expected 9 spaces but found 6"
-]]>
- </screen>
- </example>
- <note>
- <simpara>
- The first row of the CSV output defines the order of information. When using the CSV output, please parse this header row to determine the order correctly as the format may change over time or new information may be added.
- </simpara>
- </note>
- </refsect1>
-
-
- <refsect1>
+ <refsect1 id="package.php.php-codesniffer.usage.verbose-output">
<title>Printing Verbose Output</title>
<para>
By default, PHP_CodeSniffer will run quietly, only printing the report of errors and warnings at the end. If you are checking a large number of files, you may have to wait a while to see the report. If you want to know what is happening, you can turn on verbose output.
@@ -300,7 +206,7 @@
</refsect1>
- <refsect1>
+ <refsect1 id="package.php.php-codesniffer.usage.coding-standard">
<title>Specifying a Coding Standard</title>
<para>
PHP_CodeSniffer can have multiple coding standards installed to allow a single installation to be used with multiple projects. When checking PHP code, PHP_CodeSniffer can be told which coding standard to use. This is done using the <literal>--standard</literal> command line argument.
@@ -321,7 +227,7 @@
</refsect1>
- <refsect1>
+ <refsect1 id="package.php.php-codesniffer.usage.installed-standards">
<title>Printing a List of Installed Coding Standards</title>
<para>
PHP_CodeSniffer can print you a list of the coding standards that are installed so that you can correctly specify a coding standard to use for testing. You can print this list by specifying the <literal>-i</literal> command line argument.