<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Code Style</title><link>https://sourceforge.net/p/enigmail/wiki/Code%2520Style/</link><description>Recent changes to Code Style</description><atom:link href="https://sourceforge.net/p/enigmail/wiki/Code%20Style/feed" rel="self"/><language>en</language><lastBuildDate>Tue, 15 Sep 2015 16:34:03 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/enigmail/wiki/Code%20Style/feed" rel="self" type="application/rss+xml"/><item><title>Code Style modified by Nicolai Josuttis</title><link>https://sourceforge.net/p/enigmail/wiki/Code%2520Style/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -1,4 +1,4 @@
-[&amp;lt;=](Development Environment)  [=&amp;gt;](Todo List)
+[&amp;lt;=](Development Environment)  [=&amp;gt;]([Planning for version 1.9])

 Code Style Used in Enigmail
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nicolai Josuttis</dc:creator><pubDate>Tue, 15 Sep 2015 16:34:03 -0000</pubDate><guid>https://sourceforge.netd687bfdef175ec0e5baafc1c3fca2dd72176168e</guid></item><item><title>Code Style modified by Nicolai Josuttis</title><link>https://sourceforge.net/p/enigmail/wiki/Code%2520Style/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -1,4 +1,4 @@
-[&amp;lt;=](Building Enigmail)  [=&amp;gt;](Development Environment)
+[&amp;lt;=](Development Environment)  [=&amp;gt;](Todo List)

 Code Style Used in Enigmail
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nicolai Josuttis</dc:creator><pubDate>Tue, 15 Sep 2015 16:33:20 -0000</pubDate><guid>https://sourceforge.neta227e1a0dc6409cf5b559bf5bcd43b604e663c54</guid></item><item><title>Code Style modified by Nicolai Josuttis</title><link>https://sourceforge.net/p/enigmail/wiki/Code%2520Style/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -1,4 +1,4 @@
-[&amp;lt;=](https://sourceforge.net/p/enigmail/wiki/Building%20Enigmail/)  [=&amp;gt;](https://sourceforge.net/p/enigmail/wiki/Development%20Environment/)
+[&amp;lt;=](Building Enigmail)  [=&amp;gt;](Development Environment)

 Code Style Used in Enigmail
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nicolai Josuttis</dc:creator><pubDate>Sun, 13 Sep 2015 09:54:41 -0000</pubDate><guid>https://sourceforge.net34ed23e8cb5f8884bde598e592721bff9a4cb726</guid></item><item><title>Code Style modified by Nicolai Josuttis</title><link>https://sourceforge.net/p/enigmail/wiki/Code%2520Style/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -1,3 +1,6 @@
+[&amp;lt;=](https://sourceforge.net/p/enigmail/wiki/Building%20Enigmail/)  [=&amp;gt;](https://sourceforge.net/p/enigmail/wiki/Development%20Environment/)
+
+
 Code Style Used in Enigmail
 ===

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nicolai Josuttis</dc:creator><pubDate>Sun, 13 Sep 2015 09:50:59 -0000</pubDate><guid>https://sourceforge.net21b8d8b64d6f727d7ecfe9bb1773ec720bf3529f</guid></item><item><title>Code Style modified by Patrick Brunschwig</title><link>https://sourceforge.net/p/enigmail/wiki/Code%2520Style/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -50,7 +50,8 @@
     let isError = getStatusFunc()
     (isError ? handleError : handleFailure)(a, b c);

-We prefer easier readable code like this, even if it requires more typing:
+
+We prefer code that is readable code, even if it requires more typing. E.g.:

     let isError = getStatusFunc()
     if (isError) {
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Patrick Brunschwig</dc:creator><pubDate>Sun, 26 Jul 2015 15:45:12 -0000</pubDate><guid>https://sourceforge.net532778a1df54daa8b7ffe13b459befd2446c64f5</guid></item><item><title>Code Style modified by Patrick Brunschwig</title><link>https://sourceforge.net/p/enigmail/wiki/Code%2520Style/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -2,6 +2,7 @@
 ===

 The code style used in Enigmail is derived from the standard code style of [js-beautify](https://github.com/beautify-web/js-beautify). We use js-beautify with the following non-default options:
+
 * indent-size: 2
 * end-with-newline: true
 * brace-style: end-expand
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Patrick Brunschwig</dc:creator><pubDate>Sun, 26 Jul 2015 15:44:22 -0000</pubDate><guid>https://sourceforge.netaa435871c252416206a4818973dbb1cc2995482a</guid></item><item><title>Code Style modified by Patrick Brunschwig</title><link>https://sourceforge.net/p/enigmail/wiki/Code%2520Style/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="code-style-used-in-enigmail"&gt;Code Style Used in Enigmail&lt;/h1&gt;
&lt;p&gt;The code style used in Enigmail is derived from the standard code style of &lt;a class="" href="https://github.com/beautify-web/js-beautify" rel="nofollow"&gt;js-beautify&lt;/a&gt;. We use js-beautify with the following non-default options:&lt;br /&gt;
&lt;em&gt; indent-size: 2&lt;br /&gt;
&lt;/em&gt; end-with-newline: true&lt;br /&gt;
* brace-style: end-expand&lt;/p&gt;
&lt;p&gt;These defaults are committed to the top level source tree and will be automatically used by js-beautify.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="cm"&gt;/**&lt;/span&gt;
&lt;span class="cm"&gt; * This is just a sample script.&lt;/span&gt;
&lt;span class="cm"&gt; */&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;tmp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/an_example/&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;of_beautifer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="cp"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="cp"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="nx"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="nx"&gt;doDefault&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// some comment&lt;/span&gt;
    &lt;span class="nx"&gt;handleEx&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="writing-code"&gt;Writing Code&lt;/h2&gt;
&lt;p&gt;Please try to avoid statements that are hard to read such as:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;let isError = getStatusFunc()
(isError ? handleError : handleFailure)(a, b c);
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We prefer easier readable code like this, even if it requires more typing:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;let isError = getStatusFunc()
if (isError) {
  handleError(a,b c);
}
else {
  handleFailure(a, b c);
}
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Patrick Brunschwig</dc:creator><pubDate>Sun, 26 Jul 2015 15:44:05 -0000</pubDate><guid>https://sourceforge.net4202a84e1a6ad6447681c04a5820c7a54fa38165</guid></item></channel></rss>