Commits

Shlomi Fish  committed 277f43a

Add the trailing space bad-elements item

  • Participants
  • Parent commits 836dbcb

Comments (0)

Files changed (3)

         - will be interpreted as a shell command.
         - no way to avoid it for one argument.
         - use IPC::Run or IPC::System::Simple
+    - trailing whitespace.
         - assignment to a different value in the middle of the subroutine.
     - grep !/\A\./ for getting rid of "." and ".." in readdir().
     - long lines in source code.
-    - trailing whitespace.
     - "-param" (parameters starting with a dash) for subroutines or methods.
         - should be plain names instead.
 

File src/tutorials/bad-elements/index.html.wml

 
 </item>
 
+<item id="trailing-whitespace" h="Trailing Whitespace">
+
+<p>
+With many editors, it can be common to write new code or modify existing
+one, so that some lines will contain trailing whitespace, such as
+spaces (ASCII 32 or 0x20) or tabs characters. These trailing spaces normally
+do not cause much harm, but they are not needed and can be distracted. 
+</p>
+
+<p>
+While you should not feel bad about having trailing space, it is a good idea
+to sometimes search for them using a command such as <tt>ack '[ \t]+$'</tt>
+(or <tt>ack -a '[ \t]+$'</tt> for completeness - see 
+<a href="http://betterthangrep.com/">ack</a>, and get rid of them.
+</p>
+
+<p>
+Some editors also allow you to highlight trailing whitespace when present. See
+for example:
+</p>
+
+<ul>
+
+<li>
+<p>
+<a href="http://vim.wikia.com/wiki/Highlight_unwanted_spaces">Highlight
+unwanted spaces in Vim</a>. Also see <a href="http://vim.wikia.com/wiki/Highlight_unwanted_spaces">this post</a>.
+</p>
+</li>
+
+<li>
+<p>
+<a href="http://emacswiki.org/emacs/ShowWhiteSpace">EmacsWiki:
+Show White Space</a>.
+</p>
+</li>
+
+</ul>
+
+</item>
 </main_list>
 
 #include "bad-elements-sources.wml"