cvs: peardoc /en/package/php/php-codesniffer usage.xml
[email protected] ("Greg Sherwood")
| Newsgroups | php.pear.doc |
|---|---|
| Message-ID | <cvssquiz1193699452@cvsserver> |
squiz Mon Oct 29 23:10:52 2007 UTC
Modified files:
/peardoc/en/package/php/php-codesniffer usage.xml
Log:
Added CSV output format to docs
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-codesniffer/usage.xml?r1=1.7&r2=1.8&diff_format=u
Index: peardoc/en/package/php/php-codesniffer/usage.xml
diff -u peardoc/en/package/php/php-codesniffer/usage.xml:1.7 peardoc/en/package/php/php-codesniffer/usage.xml:1.8
--- peardoc/en/package/php/php-codesniffer/usage.xml:1.7 Wed Sep 19 04:40:32 2007
+++ peardoc/en/package/php/php-codesniffer/usage.xml Mon Oct 29 23:10:52 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- $Revision: 1.7 $ -->
+<!-- $Revision: 1.8 $ -->
<refentry id="package.php.php-codesniffer.usage">
<refnamediv>
<refname>Usage</refname>
@@ -32,7 +32,8 @@
<standard> The name of the coding standard to use
<generator> The name of a doc genertor to use
(forces doc generation instead of checking)
- <report> Print either the "full", "xml" or "summary" report
+ <report> Print either the "full", "xml", "csv" or "summary" report
+
]]>
</screen>
</para>
@@ -188,12 +189,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpcs>
<file name="/path/to/code/myfile.php" errors="5" warnings="1">
- <error line="2">Missing file doc comment</error>
- <error line="20">PHP keywords must be lowercase; expected "false" but found "FALSE"</error>
- <error line="47">Line not indented correctly; expected 4 spaces but found 1</error>
- <warning line="47">Equals sign not aligned with surrounding assignments</warning>
- <error line="51">Missing function doc comment</error>
- <error line="88">Line not indented correctly; expected 9 spaces but found 6</error>
+ <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>
]]>
@@ -206,16 +207,16 @@
<title>Sample PHP_CodeSniffer XML output with no warnings</title>
<screen>
<![CDATA[
-$ phpcs --report=xml /path/to/code
+$ 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">Missing file doc comment</error>
- <error line="20">PHP keywords must be lowercase; expected "false" but found "FALSE"</error>
- <error line="47">Line not indented correctly; expected 4 spaces but found 1</error>
- <error line="51">Missing function doc comment</error>
- <error line="88">Line not indented correctly; expected 9 spaces but found 6</error>
+ <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>
]]>
@@ -225,6 +226,53 @@
<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>
<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.