cvs: peardoc /en/package/php/php-codesniffer advanced-usage.xml config-options.xml usage.xml
[email protected] ("Greg Sherwood")
| Newsgroups | php.pear.doc |
|---|---|
| Message-ID | <cvssquiz1196120944@cvsserver> |
squiz Mon Nov 26 23:49:04 2007 UTC
Modified files:
/peardoc/en/package/php/php-codesniffer advanced-usage.xml
config-options.xml
usage.xml
Log:
Added docs about the new --tab-width command line argument and conig setting.
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-codesniffer/advanced-usage.xml?r1=1.5&r2=1.6&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.5 peardoc/en/package/php/php-codesniffer/advanced-usage.xml:1.6
--- peardoc/en/package/php/php-codesniffer/advanced-usage.xml:1.5 Wed Nov 7 05:51:20 2007
+++ peardoc/en/package/php/php-codesniffer/advanced-usage.xml Mon Nov 26 23:49:04 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.advanced-usage">
<refnamediv>
<refname>Advanced Usage</refname>
@@ -80,6 +80,27 @@
</refsect1>
+ <refsect1 id="package.php.php-codesniffer.advanced-usage.replace-tabs-spaces">
+ <title>Replacing Tabs with Spaces</title>
+ <para>
+ Most of the sniffs written for PHP_CodeSniffer do not support the usage of tabs for indentation and alignment. You can write your own sniffs that check for tabs instead of spaces, but you can also get PHP_CodeSniffer to convert your tabs into spaces before a file is checked. This allows you to use the existing space-based sniffs on your tab-based files.
+ </para>
+ <para>
+ In the following example, PHP_CodeSniffer will replace all tabs in the files being checked with between 1 and 4 spaces, depending on the column the tab indents to.
+ </para>
+ <example>
+ <title>Converting tabs to spaces</title>
+ <screen>
+ <userinput>
+<![CDATA[
+$ phpcs --tab-width=4 /path/to/code
+]]>
+ </userinput>
+ </screen>
+ </example>
+ </refsect1>
+
+
<refsect1 id="package.php.php-codesniffer.advanced-usage.xml-report">
<title>Printing an XML Report</title>
<para>
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-codesniffer/config-options.xml?r1=1.2&r2=1.3&diff_format=u
Index: peardoc/en/package/php/php-codesniffer/config-options.xml
diff -u peardoc/en/package/php/php-codesniffer/config-options.xml:1.2 peardoc/en/package/php/php-codesniffer/config-options.xml:1.3
--- peardoc/en/package/php/php-codesniffer/config-options.xml:1.2 Wed Nov 7 05:50:28 2007
+++ peardoc/en/package/php/php-codesniffer/config-options.xml Mon Nov 26 23:49:04 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.config-options">
<refnamediv>
<refname>Configuration Options</refname>
@@ -48,6 +48,38 @@
</note>
</refsect2>
+ <refsect2 id="package.php.php-codesniffer.config-options.php-codesniffer.tab-width">
+ <title>Setting the Default Tab Width</title>
+ <para>
+ By default, PHP_CodeSniffer will not convert tabs to spaces in checked files. Specifying a tab width will make PHP_CodeSniffer replace tabs with spaces. You can force PHP_CodeSniffer to replace tabs with spaces by default by setting the <literal>tab_width</literal> configuration option.
+ </para>
+ <example>
+ <title>Setting the default tab width to be 4 spaces</title>
+ <screen>
+ <userinput>
+<![CDATA[
+$ phpcs --config-set tab_width 4
+]]>
+ </userinput>
+ </screen>
+ </example>
+ <note>
+ <simpara>
+ When the tab width is set by default, the replacement of tabs with spaces can be disabled for a single script run by setting the tab width to zero.
+ </simpara>
+ <example>
+ <title>Disabling the replacement of tabs with spaces</title>
+ <screen>
+ <userinput>
+<![CDATA[
+$ phpcs --tab-width=0 /path/to/code
+]]>
+ </userinput>
+ </screen>
+ </example>
+ </note>
+ </refsect2>
+
</refsect1>
http://cvs.php.net/viewvc.cgi/peardoc/en/package/php/php-codesniffer/usage.xml?r1=1.9&r2=1.10&diff_format=u
Index: peardoc/en/package/php/php-codesniffer/usage.xml
diff -u peardoc/en/package/php/php-codesniffer/usage.xml:1.9 peardoc/en/package/php/php-codesniffer/usage.xml:1.10
--- peardoc/en/package/php/php-codesniffer/usage.xml:1.9 Wed Nov 7 05:51:20 2007
+++ peardoc/en/package/php/php-codesniffer/usage.xml Mon Nov 26 23:49:04 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!-- $Revision: 1.9 $ -->
+<!-- $Revision: 1.10 $ -->
<refentry id="package.php.php-codesniffer.usage">
<refnamediv>
<refname>Usage</refname>
@@ -17,7 +17,7 @@
Usage: phpcs [-nwlvi] [--report=<report>] [--standard=<standard>]
[--config-set key value] [--config-delete key] [--config-show]
[--generator=<generator>] [--extensions=<extensions>]
- [--ignore=<patterns>] <file> ...
+ [--ignore=<patterns>] [--tab-width=<width>] <file> ...
-n Do not print warnings
-w Print both warnings and errors (on by default)
-l Local directory only, no recursion
@@ -31,6 +31,7 @@
<patterns> A comma separated list of patterns that are used
to ignore directories and files
<standard> The name of the coding standard to use
+ <width> The number of spaces each tab represents
<generator> The name of a doc generator to use
(forces doc generation instead of checking)
<report> Print either the "full", "xml", "checkstyle",