[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-doc
Subject: [PEAR-DOC] cvs: peardoc /en/package/php/php-codesniffer advanced-usage.xml usage.xml
From: "Greg Sherwood" <squiz () php ! net>
Date: 2007-08-03 0:05:44
Message-ID: cvssquiz1186099544 () cvsserver
[Download RAW message or body]
squiz Fri Aug 3 00:05:44 2007 UTC
Modified files:
/peardoc/en/package/php/php-codesniffer advanced-usage.xml
usage.xml
Log:
Updated docs for latest release. Now contain info about the --ignore command line \
arg and the XML report format.
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-codesniffer/advanced-usage.xml?r1=1.2&r2=1.3&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.2 \
peardoc/en/package/php/php-codesniffer/advanced-usage.xml:1.3
--- peardoc/en/package/php/php-codesniffer/advanced-usage.xml:1.2 Tue Jan 16 05:02:24 \
2007
+++ peardoc/en/package/php/php-codesniffer/advanced-usage.xml Fri Aug 3 00:05:43 \
2007 @@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<refentry id="package.php.php-codesniffer.advanced-usage">
<refnamediv>
<refname>Advanced Usage</refname>
@@ -59,6 +59,29 @@
+ <refsect1 id="package.php.php-codesniffer.advanced-usage.ignore-files-folders">
+ <title>Ignoring Files and Folders</title>
+ <para>
+ Sometimes you want PHP_CodeSniffer to run over a very large number of files, but \
you want some files and folders to be skipped. The <literal>--ignore</literal> \
command line argument can be used to tell PHP_CodeSniffer to skip files and folders \
that match one or more patterns. + </para>
+ <para>
+ In the following example, PHP_CodeSniffer will skip all files inside the \
package's <filename>tests</filename> and <filename>data</filename> directories. This \
is useful if you are checking a PEAR package but don't want your test or data files \
to conform to your coding standard. + </para>
+ <example>
+ <title>Ignoring test and data files</title>
+ <screen>
+ <userinput>
+<![CDATA[
+$ phpcs --ignore=*/tests/*,*/data/* /path/to/code
+]]>
+ </userinput>
+ </screen>
+ </example>
+ </refsect1>
+
+
+
+
<refsect1 id="package.php.php-codesniffer.advanced-usage.verbose-tokeniser-output">
<title>Printing Verbose Tokeniser Output</title>
<note>
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-codesniffer/usage.xml?r1=1.5&r2=1.6&diff_format=u
Index: peardoc/en/package/php/php-codesniffer/usage.xml
diff -u peardoc/en/package/php/php-codesniffer/usage.xml:1.5 \
peardoc/en/package/php/php-codesniffer/usage.xml:1.6
--- peardoc/en/package/php/php-codesniffer/usage.xml:1.5 Thu May 31 06:32:07 2007
+++ peardoc/en/package/php/php-codesniffer/usage.xml Fri Aug 3 00:05:43 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<refentry id="package.php.php-codesniffer.usage">
<refnamediv>
<refname>Usage</refname>
@@ -15,7 +15,8 @@
<screen>
<![CDATA[
Usage: phpcs [-nlvi] [--report=<report>] [--standard=<standard>]
- [--generator=<generator>] [--extensions=<extensions>] <file> ...
+ [--generator=<generator>] [--extensions=<extensions>]
+ [--ignore=<patterns>] <file> ...
-n Do not print warnings
-l Local directory only, no recursion
-v[v][v] Print verbose output
@@ -25,10 +26,12 @@
<file> One or more files and/or directories to check
<extensions> A comma separated list of file extensions to check
(only valid if checking a directory)
+ <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
(forces doc generation instead of checking)
- <report> Print either the "full" or "summary" report
+ <report> Print either the "full", "xml" or "summary" report
]]>
</screen>
</para>
@@ -171,6 +174,56 @@
<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">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> + </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 --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> + </file>
+</phpcs>
+]]>
+ </screen>
+ </example>
+ </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. @@ -183,15 +236,15 @@
<screen>
<![CDATA[
$ phpcs /path/to/code/CodeSniffer -v
-Registering sniffs... DONE
-Processing AbstractDocElement.php [1093 tokens in 303 lines]... DONE in < 1 second
-Processing AbstractParser.php [2360 tokens in 558 lines]... DONE in 2 seconds
-Processing ClassCommentParser.php [923 tokens in 296 lines]... DONE in < 1 second
-Processing CommentElement.php [988 tokens in 218 lines]... DONE in < 1 second
-Processing FunctionCommentParser.php [525 tokens in 184 lines]... DONE in 1 second
-Processing File.php [10968 tokens in 1805 lines]... DONE in 5 seconds
-Processing Sniff.php [133 tokens in 94 lines]... DONE in < 1 second
-Processing SniffException.php [47 tokens in 36 lines]... DONE in < 1 second
+Registering sniffs... DONE (22 sniffs registered)
+Processing AbstractDocElement.php [1093 tokens in 303 lines]... DONE in < 1 second \
(0 errors, 1 warnings) +Processing AbstractParser.php [2360 tokens in 558 lines]... \
DONE in 2 seconds (0 errors, 1 warnings) +Processing ClassCommentParser.php [923 \
tokens in 296 lines]... DONE in < 1 second (2 errors, 0 warnings) +Processing \
CommentElement.php [988 tokens in 218 lines]... DONE in < 1 second (1 error, 5 \
warnings) +Processing FunctionCommentParser.php [525 tokens in 184 lines]... DONE in \
1 second (0 errors, 6 warnings) +Processing File.php [10968 tokens in 1805 lines]... \
DONE in 5 seconds (0 errors, 5 warnings) +Processing Sniff.php [133 tokens in 94 \
lines]... DONE in < 1 second (0 errors, 0 warnings) +Processing SniffException.php \
[47 tokens in 36 lines]... DONE in < 1 second (1 errors, 3 warnings) ]]>
</screen>
</example>
@@ -229,7 +282,7 @@
<screen>
<![CDATA[
$ phpcs -i
-The installed coding standards are PEAR and Squiz.
+The installed coding standards are MySource, PEAR, PHPCS and Squiz.
]]>
</screen>
</example>
--
PEAR Documentation List Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic