/usr/share/doc/ganeti/html/dev-codestyle.html is in ganeti-doc 2.16.0~rc2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Code style guide — Ganeti 2.16.0~rc2 documentation</title>
<link rel="stylesheet" href="_static/style.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '2.16.0~rc2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Glossary" href="glossary.html" />
<link rel="prev" title="Developer notes" href="devnotes.html" />
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="glossary.html" title="Glossary"
accesskey="N">next</a></li>
<li class="right" >
<a href="devnotes.html" title="Developer notes"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Ganeti 2.16.0~rc2 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="code-style-guide">
<h1>Code style guide<a class="headerlink" href="#code-style-guide" title="Permalink to this headline">¶</a></h1>
<div class="section" id="python">
<h2>Python<a class="headerlink" href="#python" title="Permalink to this headline">¶</a></h2>
<p>These are a few guidelines for Ganeti code and documentation.</p>
<p>In simple terms: try to stay consistent with the existing code. <a class="reference external" href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a> says:</p>
<blockquote>
<div>A style guide is about consistency. Consistency with this style guide is
important. Consistency within a project is more important. Consistency
within one module or function is most important.</div></blockquote>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You might also want to take a look at the <a class="reference external" href="http://google-styleguide.googlecode.com/svn/trunk/pyguide.html">Google style guide</a>, since we
have some things in common with it.</p>
</div>
<div class="section" id="indentation">
<h3>Indentation<a class="headerlink" href="#indentation" title="Permalink to this headline">¶</a></h3>
<p>In general, always indent using two (2) spaces and don’t use tabs.</p>
<p>The two spaces should always be relative to the previous level of indentation,
even if this means that the final number of spaces is not a multiple of 2.</p>
<p>When going on a new line inside an open parenthesis, align with the content of
the parenthesis on the previous line.</p>
<p>Valid example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">v</span> <span class="o">=</span> <span class="p">(</span><span class="n">somevalue</span><span class="p">,</span>
<span class="n">a_function</span><span class="p">([</span>
<span class="n">list_elem</span><span class="p">,</span> <span class="c1"># 7 spaces, but 2 from the previous indentation level</span>
<span class="n">another_elem</span><span class="p">,</span>
<span class="p">]))</span>
</pre></div>
</div>
</div>
<div class="section" id="formatting-strings">
<h3>Formatting strings<a class="headerlink" href="#formatting-strings" title="Permalink to this headline">¶</a></h3>
<p>Always use double quotes (<code class="docutils literal"><span class="pre">""</span></code>), never single quotes (<code class="docutils literal"><span class="pre">''</span></code>), except for
existing code. Examples for formatting strings:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">var</span> <span class="o">=</span> <span class="s2">"value"</span>
<span class="c1"># Note: The space character is always on the second line</span>
<span class="n">var</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"The quick brown fox jumps over the lazy dog. The quick brown fox"</span>
<span class="s2">" jumps over the lazy dog. The quick brown fox jumps over the lazy"</span>
<span class="s2">" dog."</span><span class="p">)</span>
<span class="n">fn</span><span class="p">(</span><span class="s2">"The quick brown fox jumps over the lazy dog. The quick brown fox jumps"</span>
<span class="s2">" over the lazy dog."</span><span class="p">)</span>
<span class="n">fn</span><span class="p">(</span><span class="n">constants</span><span class="o">.</span><span class="n">CONFIG_VERSION</span><span class="p">,</span>
<span class="p">(</span><span class="s2">"The quick brown fox jumps over the lazy dog. The quick brown fox"</span>
<span class="s2">" jumps over the lazy dog. The quick brown fox jumps over the lazy"</span>
<span class="s2">" dog."</span><span class="p">))</span>
</pre></div>
</div>
<p>Don’t format strings like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Don't use single quotes</span>
<span class="n">var</span> <span class="o">=</span> <span class="s1">'value'</span>
<span class="c1"># Don't use backslash for line continuation</span>
<span class="n">var</span> <span class="o">=</span> <span class="s2">"The quick brown fox jumps over the lazy dog. The quick brown fox"</span>\
<span class="s2">" jumps over the lazy dog."</span>
<span class="c1"># Space character goes to the beginning of a new line</span>
<span class="n">var</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"The quick brown fox jumps over the lazy dog. The quick brown fox "</span>
<span class="s2">"jumps over the lazy dog. The quick brown fox jumps over the lazy "</span>
<span class="s2">"dog."</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="formatting-sequences">
<h3>Formatting sequences<a class="headerlink" href="#formatting-sequences" title="Permalink to this headline">¶</a></h3>
<p>Built-in sequence types are list (<code class="docutils literal"><span class="pre">[]</span></code>), tuple (<code class="docutils literal"><span class="pre">()</span></code>) and dict (<code class="docutils literal"><span class="pre">{}</span></code>).
When splitting to multiple lines, each item should be on its own line and a
comma must be added on the last line. Don’t write multiline dictionaries in
function calls, except when it’s the only parameter. Always indent items by
two spaces.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Short lists</span>
<span class="n">var</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"foo"</span><span class="p">,</span> <span class="s2">"bar"</span><span class="p">]</span>
<span class="n">var</span> <span class="o">=</span> <span class="p">(</span><span class="s2">"foo"</span><span class="p">,</span> <span class="s2">"bar"</span><span class="p">)</span>
<span class="c1"># Longer sequences and dictionary</span>
<span class="n">var</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">constants</span><span class="o">.</span><span class="n">XYZ_FILENAME_EXTENSION</span><span class="p">,</span>
<span class="n">constants</span><span class="o">.</span><span class="n">FOO_BAR_BAZ</span><span class="p">,</span>
<span class="p">]</span>
<span class="n">var</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">"key"</span><span class="p">:</span> <span class="n">func</span><span class="p">(),</span>
<span class="s2">"otherkey"</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
<span class="p">}</span>
<span class="c1"># Multiline tuples as dictionary values</span>
<span class="n">var</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">"key"</span><span class="p">:</span>
<span class="p">(</span><span class="s2">"long value taking the whole line, requiring you to go to a new one"</span><span class="p">,</span>
<span class="n">other_value</span><span class="p">),</span>
<span class="p">}</span>
<span class="c1"># Function calls</span>
<span class="n">var</span> <span class="o">=</span> <span class="nb">frozenset</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="n">var</span> <span class="o">=</span> <span class="n">F</span><span class="p">({</span>
<span class="s2">"xyz"</span><span class="p">:</span> <span class="n">constants</span><span class="o">.</span><span class="n">XYZ</span><span class="p">,</span>
<span class="s2">"abc"</span><span class="p">:</span> <span class="n">constants</span><span class="o">.</span><span class="n">ABC</span><span class="p">,</span>
<span class="p">})</span>
<span class="c1"># Wrong</span>
<span class="n">F</span><span class="p">(</span><span class="mi">123</span><span class="p">,</span> <span class="s2">"Hello World"</span><span class="p">,</span>
<span class="p">{</span> <span class="s2">"xyz"</span><span class="p">:</span> <span class="n">constants</span><span class="o">.</span><span class="n">XYZ</span> <span class="p">})</span>
</pre></div>
</div>
<p>We consider tuples as data structures, not containers. So in general please
use lists when dealing with a sequence of homogeneous items, and tuples when
dealing with heterogeneous items.</p>
</div>
<div class="section" id="passing-arguments">
<h3>Passing arguments<a class="headerlink" href="#passing-arguments" title="Permalink to this headline">¶</a></h3>
<p>Positional arguments must be passed as positional arguments, keyword arguments
must be passed as keyword arguments. Everything else will be difficult to
maintain.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="c1"># Function signature</span>
<span class="k">def</span> <span class="nf">F</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">salt</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">key_selector</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
<span class="k">pass</span>
<span class="c1"># Yes</span>
<span class="n">F</span><span class="p">(</span><span class="s2">"The quick brown fox"</span><span class="p">,</span> <span class="s2">"123456"</span><span class="p">)</span>
<span class="n">F</span><span class="p">(</span><span class="s2">"The quick brown fox"</span><span class="p">,</span> <span class="s2">"123456"</span><span class="p">,</span> <span class="n">salt</span><span class="o">=</span><span class="s2">"abc"</span><span class="p">)</span>
<span class="n">F</span><span class="p">(</span><span class="s2">"The quick brown fox"</span><span class="p">,</span> <span class="s2">"123456"</span><span class="p">,</span> <span class="n">key_selector</span><span class="o">=</span><span class="s2">"xyz"</span><span class="p">)</span>
<span class="n">F</span><span class="p">(</span><span class="s2">"The quick brown fox"</span><span class="p">,</span> <span class="s2">"123456"</span><span class="p">,</span> <span class="n">salt</span><span class="o">=</span><span class="s2">"foo"</span><span class="p">,</span> <span class="n">key_selector</span><span class="o">=</span><span class="s2">"xyz"</span><span class="p">)</span>
<span class="c1"># No: Passing keyword arguments as positional argument</span>
<span class="n">F</span><span class="p">(</span><span class="s2">"The quick brown fox"</span><span class="p">,</span> <span class="s2">"123456"</span><span class="p">,</span> <span class="s2">"xyz"</span><span class="p">,</span> <span class="s2">"bar"</span><span class="p">)</span>
<span class="c1"># No: Passing positional arguments as keyword argument</span>
<span class="n">F</span><span class="p">(</span><span class="n">salt</span><span class="o">=</span><span class="s2">"xyz"</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="s2">"The quick brown fox"</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"123456"</span><span class="p">,</span> <span class="n">key_selector</span><span class="o">=</span><span class="s2">"xyz"</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="docstrings">
<h3>Docstrings<a class="headerlink" href="#docstrings" title="Permalink to this headline">¶</a></h3>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><a class="reference external" href="http://www.python.org/dev/peps/pep-0257/">PEP 257</a> is the canonical document, unless epydoc overrules it (e.g. in how
to document the type of an argument).</p>
</div>
<p>For docstrings, the recommended format is <a class="reference external" href="http://epydoc.sourceforge.net/manual-epytext.html">epytext</a>, to be processed via
<a class="reference external" href="http://epydoc.sourceforge.net/">epydoc</a>. There is an <code class="docutils literal"><span class="pre">apidoc</span></code> target that builds the documentation and puts it
into the doc/api subdir. Note that we currently use epydoc version 3.0.</p>
<p>Note that one-line docstrings are only accepted in the unittests.</p>
<p>Rules for writing the docstrings (mostly standard Python rules):</p>
<ul class="simple">
<li>the docstring should start with a sentence, with punctuation at the end,
summarizing the the aim of what is being described. This sentence cannot be
longer than one line</li>
<li>the second line should be blank</li>
<li>afterwards the rest of the docstring</li>
<li>special epytext tags should come at the end</li>
<li>multi-line docstrings must finish with an empty line</li>
<li>do not try to make a table using lots of whitespace</li>
<li>use <code class="docutils literal"><span class="pre">L{}</span></code> and <code class="docutils literal"><span class="pre">C{}</span></code> where appropriate</li>
</ul>
<p>Here’s an example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">fn</span><span class="p">(</span><span class="n">foo</span><span class="p">,</span> <span class="n">bar</span><span class="p">):</span>
<span class="sd">"""Compute the sum of foo and bar.</span>
<span class="sd"> This functions builds the sum of foo and bar. It's a simple function.</span>
<span class="sd"> @type foo: int</span>
<span class="sd"> @param foo: First parameter.</span>
<span class="sd"> @type bar: float</span>
<span class="sd"> @param bar: The second parameter. This line is longer</span>
<span class="sd"> to show wrapping.</span>
<span class="sd"> @rtype: float</span>
<span class="sd"> @return: the sum of the two numbers</span>
<span class="sd"> """</span>
<span class="k">return</span> <span class="n">foo</span> <span class="o">+</span> <span class="n">bar</span>
</pre></div>
</div>
<p>Some rules of thumb which should be applied with good judgement on a case-to-
case basis:</p>
<ul class="simple">
<li>If the meaning of parameters is already obvious given its name and the
methods description, don’t document it again. Just add a <code class="docutils literal"><span class="pre">@type</span></code> tag.</li>
<li>Refer to the base methods documentation when overwriting methods. Only
document more if it applies to the current subclass only, or if you want to
clarify on the meaning of parameters for the special subclass.</li>
</ul>
</div>
<div class="section" id="rules-for-classes-and-modules">
<h3>Rules for classes and modules<a class="headerlink" href="#rules-for-classes-and-modules" title="Permalink to this headline">¶</a></h3>
<p>As <a class="reference external" href="http://www.python.org/dev/peps/pep-0257/">PEP 257</a> says, the docstrings of classes should document their attributes
and the docstrings of modules should shortly document the exported
functions/variables/etc.</p>
<p>See for example the pydoc output for the <code class="docutils literal"><span class="pre">os</span></code> or <code class="docutils literal"><span class="pre">ConfigParser</span></code> standard
modules.</p>
</div>
</div>
<div class="section" id="haskell">
<h2>Haskell<a class="headerlink" href="#haskell" title="Permalink to this headline">¶</a></h2>
<p>The most important consideration is, as usual, to stay consistent with the
existing code.</p>
<p>As there’s no “canonical” style guide for Haskell, this code style has been
inspired from a few online resources, including the style guide for the
<a class="reference external" href="http://snapframework.com/docs/style-guide">Snap framework</a>, <a class="reference external" href="https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md">this style guide</a> and <a class="reference external" href="http://www.cs.caltech.edu/courses/cs11/material/haskell/misc/haskell_style_guide.html">this other style guide</a>.</p>
<div class="section" id="files">
<h3>Files<a class="headerlink" href="#files" title="Permalink to this headline">¶</a></h3>
<p>Use ordinary, non-<a class="reference external" href="http://www.haskell.org/haskellwiki/Literate_programming">literate</a> Haskell <code class="docutils literal"><span class="pre">.hs</span></code> files.</p>
<p>Use proper copyright headers, and proper Haddock style documentation headers:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="cm">{-| Short module summary.</span>
<span class="cm">Longer module description.</span>
<span class="cm">-}</span>
<span class="cm">{-</span>
<span class="cm">Copyright (C) ...</span>
<span class="cm">This program is free software ...</span>
<span class="cm">-}</span>
</pre></div>
</div>
<p>If there are module-level pragmas add them right at the top, before the short
summary.</p>
</div>
<div class="section" id="imports">
<h3>Imports<a class="headerlink" href="#imports" title="Permalink to this headline">¶</a></h3>
<p>Imports should be grouped into the following groups and inside each group they
should be sorted alphabetically:</p>
<ol class="arabic simple">
<li>import of non-Ganeti libaries</li>
<li>import of Ganeti libraries</li>
</ol>
<p>It is allowed to use qualified imports with short names for:</p>
<ul class="simple">
<li>standard library (e.g. <code class="docutils literal"><span class="pre">import</span> <span class="pre">qualified</span> <span class="pre">Data.Map</span> <span class="pre">as</span> <span class="pre">M</span></code>)</li>
<li>local imports (e.g. <code class="docutils literal"><span class="pre">import</span> <span class="pre">qualified</span> <span class="pre">Ganeti.Constants</span> <span class="pre">as</span> <span class="pre">C</span></code>)</li>
</ul>
<p>Whenever possible, prefer explicit imports, either in form of
qualified imports, or by naming the imported functions
(e.g., <code class="docutils literal"><span class="pre">import</span> <span class="pre">Control.Arrow</span> <span class="pre">((&&&))</span></code>, <code class="docutils literal"><span class="pre">import</span> <span class="pre">Data.Foldable(fold,</span> <span class="pre">toList)</span></code>)</p>
</div>
<div class="section" id="id1">
<h3>Indentation<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<p>Use only spaces, never tabs. Indentation level is 2 characters. For Emacs,
this means setting the variable <code class="docutils literal"><span class="pre">haskell-indent-offset</span></code> to 2.</p>
<p>Line length should be at most 78 chars, and 72 chars inside comments.</p>
<p>Use indentation-based structure, and not braces/semicolons.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>Special indendation of if/then/else construct</p>
<p>For the <code class="docutils literal"><span class="pre">do</span></code> notation, the <code class="docutils literal"><span class="pre">if-then-else</span></code> construct has a non-intuitive
behaviour. As such, the indentation of <code class="docutils literal"><span class="pre">if-then-else</span></code> (both in <code class="docutils literal"><span class="pre">do</span></code>
blocks and in normal blocks) should be as follows:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="kr">if</span> <span class="n">condition</span>
<span class="kr">then</span> <span class="n">expr1</span>
<span class="kr">else</span> <span class="n">expr2</span>
</pre></div>
</div>
<p class="last">i.e. indent the then/else lines with another level. This can be accomplished
in Emacs by setting the variable <code class="docutils literal"><span class="pre">haskell-indent-thenelse</span></code> to 2 (from the
default of zero).</p>
</div>
<p>If you have more than one line of code please newline/indent after the “=”. Do
<cite>not</cite> do:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">f</span> <span class="n">x</span> <span class="ow">=</span> <span class="kr">let</span> <span class="n">y</span> <span class="ow">=</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
<span class="kr">in</span> <span class="n">y</span>
</pre></div>
</div>
<p>Instead do:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">f</span> <span class="n">x</span> <span class="ow">=</span>
<span class="kr">let</span> <span class="n">y</span> <span class="ow">=</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
<span class="kr">in</span> <span class="n">y</span>
</pre></div>
</div>
<p>or if it is just one line:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">f</span> <span class="n">x</span> <span class="ow">=</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">1</span>
</pre></div>
</div>
</div>
<div class="section" id="multiline-strings">
<h3>Multiline strings<a class="headerlink" href="#multiline-strings" title="Permalink to this headline">¶</a></h3>
<p>Multiline strings are created by closing a line with a backslash and starting
the following line with a backslash, keeping the indentation level constant.
Whitespaces go on the new line, right after the backslash.</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">longString</span> <span class="ow">::</span> <span class="kt">String</span>
<span class="nf">longString</span> <span class="ow">=</span> <span class="s">"This is a very very very long string that</span><span class="se">\</span>
<span class="se"> \</span><span class="s"> needs to be split in two lines"</span>
</pre></div>
</div>
</div>
<div class="section" id="data-declarations">
<h3>Data declarations<a class="headerlink" href="#data-declarations" title="Permalink to this headline">¶</a></h3>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Note that this is different from the Python style!</p>
</div>
<p>When declaring either data types, or using list literals, etc., the columns
should be aligned, and for lists use a comma at the start of the line, not at
the end. Examples:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="kr">data</span> <span class="kt">OpCode</span> <span class="ow">=</span> <span class="kt">OpStartupInstance</span> <span class="o">...</span>
<span class="o">|</span> <span class="kt">OpShutdownInstance</span> <span class="o">...</span>
<span class="o">|</span> <span class="o">...</span>
<span class="kr">data</span> <span class="kt">Node</span> <span class="ow">=</span> <span class="kt">Node</span> <span class="p">{</span> <span class="n">name</span> <span class="ow">::</span> <span class="kt">String</span>
<span class="p">,</span> <span class="n">ip</span> <span class="ow">::</span> <span class="kt">String</span>
<span class="p">,</span> <span class="o">...</span>
<span class="p">}</span>
<span class="nf">myList</span> <span class="ow">=</span> <span class="p">[</span> <span class="n">value1</span>
<span class="p">,</span> <span class="n">value2</span>
<span class="p">,</span> <span class="n">value3</span>
<span class="p">]</span>
</pre></div>
</div>
<p>The choice of whether to wrap the first element or not is up to you; the
following is also allowed:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">myList</span> <span class="ow">=</span>
<span class="p">[</span> <span class="n">value1</span>
<span class="p">,</span> <span class="n">value2</span>
<span class="p">]</span>
</pre></div>
</div>
<p>For records, always add spaces around the braces and the equality sign.</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">foo</span> <span class="ow">=</span> <span class="kt">Foo</span> <span class="p">{</span> <span class="n">fBar</span> <span class="ow">=</span> <span class="s">"bar"</span><span class="p">,</span> <span class="n">fBaz</span> <span class="ow">=</span> <span class="mi">4711</span> <span class="p">}</span>
<span class="nf">foo'</span> <span class="ow">=</span> <span class="kt">Foo</span> <span class="p">{</span> <span class="n">fBar</span> <span class="ow">=</span> <span class="s">"bar 2"</span>
<span class="p">,</span> <span class="n">fBaz</span> <span class="ow">=</span> <span class="mi">4712</span>
<span class="p">}</span>
<span class="nf">node'</span> <span class="ow">=</span> <span class="n">node</span> <span class="p">{</span> <span class="n">ip</span> <span class="ow">=</span> <span class="s">"127.0.0.1"</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="white-space">
<h3>White space<a class="headerlink" href="#white-space" title="Permalink to this headline">¶</a></h3>
<p>Like in Python, surround binary operators with one space on either side. Do no
insert a space after a lamda:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="c1">-- bad</span>
<span class="nf">map</span> <span class="p">(</span><span class="nf">\</span> <span class="n">n</span> <span class="ow">-></span> <span class="o">...</span><span class="p">)</span> <span class="n">lst</span>
<span class="c1">-- good</span>
<span class="nf">foldl</span> <span class="p">(</span><span class="nf">\</span><span class="n">x</span> <span class="n">y</span> <span class="ow">-></span> <span class="o">...</span><span class="p">)</span> <span class="o">...</span>
</pre></div>
</div>
<p>Use a blank line between top-level definitions, but no blank lines between
either the comment and the type signature or between the type signature and
the actual function definition.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Ideally it would be two blank lines between top-level definitions, but the
code only has one now.</p>
</div>
<p>As always, no trailing spaces. Ever.</p>
<div class="section" id="spaces-after-comma">
<h4>Spaces after comma<a class="headerlink" href="#spaces-after-comma" title="Permalink to this headline">¶</a></h4>
<p>Instead of:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="p">(</span><span class="s">"a"</span><span class="p">,</span><span class="s">"b"</span><span class="p">)</span>
</pre></div>
</div>
<p>write:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="p">(</span><span class="s">"a"</span><span class="p">,</span> <span class="s">"b"</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="naming">
<h3>Naming<a class="headerlink" href="#naming" title="Permalink to this headline">¶</a></h3>
<p>Functions should be named in mixedCase style, and types in CamelCase. Function
arguments and local variables should be mixedCase.</p>
<p>When using acronyms, ones longer than 2 characters should be typed capitalised,
not fully upper-cased (e.g. <code class="docutils literal"><span class="pre">Http</span></code>, not <code class="docutils literal"><span class="pre">HTTP</span></code>).</p>
<p>For variable names, use descriptive names; it is only allowed to use very
short names (e.g. <code class="docutils literal"><span class="pre">a</span></code>, <code class="docutils literal"><span class="pre">b</span></code>, <code class="docutils literal"><span class="pre">i</span></code>, <code class="docutils literal"><span class="pre">j</span></code>, etc.) when:</p>
<ul>
<li><p class="first">the function is trivial, e.g.:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">sum</span> <span class="n">x</span> <span class="n">y</span> <span class="ow">=</span> <span class="n">x</span> <span class="o">+</span> <span class="n">y</span>
</pre></div>
</div>
</li>
<li><p class="first">we talk about some very specific cases, e.g.
iterators or accumulators in folds:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">map</span> <span class="p">(</span><span class="nf">\</span><span class="n">v</span> <span class="ow">-></span> <span class="n">v</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="n">lst</span>
</pre></div>
</div>
</li>
<li><p class="first">using <code class="docutils literal"><span class="pre">x:xs</span></code> for list elements and lists, etc.</p>
</li>
</ul>
<p>In general, short/one-letter names are allowed when we deal with polymorphic
values; for example the standard map definition from Prelude:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">map</span> <span class="ow">::</span> <span class="p">(</span><span class="n">a</span> <span class="ow">-></span> <span class="n">b</span><span class="p">)</span> <span class="ow">-></span> <span class="p">[</span><span class="n">a</span><span class="p">]</span> <span class="ow">-></span> <span class="p">[</span><span class="n">b</span><span class="p">]</span>
<span class="nf">map</span> <span class="kr">_</span> <span class="kt">[]</span> <span class="ow">=</span> <span class="kt">[]</span>
<span class="nf">map</span> <span class="n">f</span> <span class="p">(</span><span class="n">x</span><span class="kt">:</span><span class="n">xs</span><span class="p">)</span> <span class="ow">=</span> <span class="n">f</span> <span class="n">x</span> <span class="kt">:</span> <span class="n">map</span> <span class="n">f</span> <span class="n">xs</span>
</pre></div>
</div>
<p>In this example, neither the <code class="docutils literal"><span class="pre">a</span></code> nor <code class="docutils literal"><span class="pre">b</span></code> types are known to the map
function, so we cannot give them more explicit names. Since the body of the
function is trivial, the variables used are longer.</p>
<p>However, if we deal with explicit types or values, their names should be
descriptive.</p>
<p>Finally, the naming should look familiar to people who just read the
Prelude/standard libraries.</p>
<div class="section" id="naming-for-updated-values">
<h4>Naming for updated values<a class="headerlink" href="#naming-for-updated-values" title="Permalink to this headline">¶</a></h4>
<p>Since one cannot update a value in Haskell, this presents a particular problem
on the naming of new versions of the same value. For example, the following
code in Python:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">failover</span><span class="p">(</span><span class="n">pri</span><span class="p">,</span> <span class="n">sec</span><span class="p">,</span> <span class="n">inst</span><span class="p">):</span>
<span class="n">pri</span><span class="o">.</span><span class="n">removePrimary</span><span class="p">(</span><span class="n">inst</span><span class="p">)</span>
<span class="n">pri</span><span class="o">.</span><span class="n">addSecondary</span><span class="p">(</span><span class="n">inst</span><span class="p">)</span>
<span class="n">sec</span><span class="o">.</span><span class="n">removeSecondary</span><span class="p">(</span><span class="n">inst</span><span class="p">)</span>
<span class="n">sec</span><span class="o">.</span><span class="n">addPrimary</span><span class="p">(</span><span class="n">inst</span><span class="p">)</span>
</pre></div>
</div>
<p>becomes in Haskell something like the following:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">failover</span> <span class="n">pri</span> <span class="n">sec</span> <span class="n">inst</span> <span class="ow">=</span>
<span class="kr">let</span> <span class="n">pri'</span> <span class="ow">=</span> <span class="n">removePrimary</span> <span class="n">pri</span> <span class="n">inst</span>
<span class="n">pri''</span> <span class="ow">=</span> <span class="n">addSecondary</span> <span class="n">pri'</span> <span class="n">inst</span>
<span class="n">sec'</span> <span class="ow">=</span> <span class="n">removeSecondary</span> <span class="n">sec</span> <span class="n">inst</span>
<span class="n">sec''</span> <span class="ow">=</span> <span class="n">addPrimary</span> <span class="n">sec'</span> <span class="n">inst</span>
<span class="kr">in</span> <span class="p">(</span><span class="n">pri''</span><span class="p">,</span> <span class="n">sec''</span><span class="p">)</span>
</pre></div>
</div>
<p>When updating values, one should add single quotes to the name for up to three
new names (e.g. <code class="docutils literal"><span class="pre">inst</span></code>, <code class="docutils literal"><span class="pre">inst'</span></code>, <code class="docutils literal"><span class="pre">inst''</span></code>, <code class="docutils literal"><span class="pre">inst'''</span></code>) and otherwise
use numeric suffixes (<code class="docutils literal"><span class="pre">inst1</span></code>, <code class="docutils literal"><span class="pre">inst2</span></code>, <code class="docutils literal"><span class="pre">inst3</span></code>, …, <code class="docutils literal"><span class="pre">inst8</span></code>), but
that many updates is already bad style and thus should be avoided.</p>
</div>
</div>
<div class="section" id="type-signatures">
<h3>Type signatures<a class="headerlink" href="#type-signatures" title="Permalink to this headline">¶</a></h3>
<p>Always declare types for functions (and any other top-level bindings).</p>
<p>If in doubt, feel free to declare the type of the variables/bindings in a
complex expression; this usually means the expression is too complex, however.</p>
<p>Similarly, provide Haddock-style comments for top-level definitions.</p>
</div>
<div class="section" id="use-sum-types-instead-of-exceptions">
<h3>Use sum types instead of exceptions<a class="headerlink" href="#use-sum-types-instead-of-exceptions" title="Permalink to this headline">¶</a></h3>
<p>Exceptions make it hard to write functional code, as alternative
control flows need to be considered and compiler support is limited.
Therefore, Ganeti functions should never allow exceptions to escape.
Function that can fail should report failure by returning an appropriate
sum type (<code class="docutils literal"><span class="pre">Either</span></code> or one of its glorified variants like <code class="docutils literal"><span class="pre">Maybe</span></code> or
<code class="docutils literal"><span class="pre">Result</span></code>); the preferred sum type for reporting errors is <code class="docutils literal"><span class="pre">Result</span></code>.</p>
<p>As other Ganeti functions also follow these guide lines, they can safely
be composed. However, be careful when using functions from other libraries;
if they can raise exceptions, catch them, preferably as close to their
origin as reasonably possible.</p>
</div>
<div class="section" id="parentheses-point-free-style">
<h3>Parentheses, point free style<a class="headerlink" href="#parentheses-point-free-style" title="Permalink to this headline">¶</a></h3>
<p>Prefer the so-called <a class="reference external" href="http://www.haskell.org/haskellwiki/Pointfree">point-free</a> style style when declaring functions, if
applicable:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="c1">-- bad</span>
<span class="kr">let</span> <span class="n">a</span> <span class="n">x</span> <span class="ow">=</span> <span class="n">f</span> <span class="p">(</span><span class="n">g</span> <span class="p">(</span><span class="n">h</span> <span class="n">x</span><span class="p">))</span>
<span class="c1">-- good</span>
<span class="kr">let</span> <span class="n">a</span> <span class="ow">=</span> <span class="n">f</span> <span class="o">.</span> <span class="n">g</span> <span class="o">.</span> <span class="n">h</span>
</pre></div>
</div>
<p>Also use function composition in a similar manner in expressions to avoid extra
parentheses:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="c1">-- bad</span>
<span class="nf">f</span> <span class="p">(</span><span class="n">g</span> <span class="p">(</span><span class="n">h</span> <span class="n">x</span><span class="p">))</span>
<span class="c1">-- better</span>
<span class="nf">f</span> <span class="o">$</span> <span class="n">g</span> <span class="o">$</span> <span class="n">h</span> <span class="n">x</span>
<span class="c1">-- best</span>
<span class="nf">f</span> <span class="o">.</span> <span class="n">g</span> <span class="o">.</span> <span class="n">h</span> <span class="o">$</span> <span class="n">x</span>
</pre></div>
</div>
</div>
<div class="section" id="language-features">
<h3>Language features<a class="headerlink" href="#language-features" title="Permalink to this headline">¶</a></h3>
<div class="section" id="extensions">
<h4>Extensions<a class="headerlink" href="#extensions" title="Permalink to this headline">¶</a></h4>
<p>It is recommended to keep the use of extensions to a minimum, so that the code
can be understood even if one is familiar with just Haskel98/Haskell2010. That
said, some extensions are very common and useful, so they are recommended:</p>
<ul class="simple">
<li><a class="reference external" href="http://www.haskell.org/ghc/docs/latest/html/users_guide/bang-patterns.html">Bang patterns</a>: useful when you want to enforce strict evaluation (and better
than repeated use of <code class="docutils literal"><span class="pre">seq</span></code>)</li>
<li>CPP: a few modules need this in order to account for configure-time options;
don’t overuse it, since it breaks multi-line strings</li>
<li><a class="reference external" href="http://www.haskell.org/ghc/docs/latest/html/users_guide/template-haskell.html">Template Haskell</a>: we use this for automatically deriving JSON instances and
other similar boiler-plate</li>
</ul>
<p>Such extensions should be declared using the <code class="docutils literal"><span class="pre">Language</span></code> pragma:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="cm">{-# Language BangPatterns #-}</span>
<span class="cm">{-| This is a small module... -}</span>
</pre></div>
</div>
</div>
<div class="section" id="comments">
<h4>Comments<a class="headerlink" href="#comments" title="Permalink to this headline">¶</a></h4>
<p>Always use proper sentences; start with a capital letter and use punctuation
in top level comments:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="c1">-- | A function that does something.</span>
<span class="nf">f</span> <span class="ow">::</span> <span class="o">...</span>
</pre></div>
</div>
<p>For inline comments, start with a capital letter but no ending punctuation.
Furthermore, align the comments together with a 2-space width from the end of
the item being commented:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="kr">data</span> <span class="kt">Maybe</span> <span class="n">a</span> <span class="ow">=</span> <span class="kt">Nothing</span> <span class="c1">-- ^ Represents empty container</span>
<span class="o">|</span> <span class="kt">Just</span> <span class="n">a</span> <span class="c1">-- ^ Represents a single value</span>
</pre></div>
</div>
<p>The comments should be clear enough so that one doesn’t need to look at the
code to understand what the item does/is.</p>
<p>Use <code class="docutils literal"><span class="pre">--</span> <span class="pre">|</span></code> to write doc strings rather than bare comment with <code class="docutils literal"><span class="pre">--</span></code>.</p>
</div>
<div class="section" id="tools">
<h4>Tools<a class="headerlink" href="#tools" title="Permalink to this headline">¶</a></h4>
<p>We generate the API documentation via Haddock, and as such the comments should
be correct (syntax-wise) for it. Use markup, but sparingly.</p>
<p>We use <a class="reference external" href="http://community.haskell.org/~ndm/darcs/hlint/hlint.htm">hlint</a> as a lint checker; the code is currently lint-clean, so you must
not add any warnings/errors.</p>
<p>Use these two commands during development:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">make</span> <span class="n">hs</span><span class="o">-</span><span class="n">apidoc</span>
<span class="nf">make</span> <span class="n">hlint</span>
</pre></div>
</div>
</div>
<div class="section" id="quickcheck-best-practices">
<h4>QuickCheck best practices<a class="headerlink" href="#quickcheck-best-practices" title="Permalink to this headline">¶</a></h4>
<p>If you have big type that takes time to generate and several properties to
test on that, by default 500 of those big instances are generated for each
property. In many cases, it would be sufficient to only generate those 500
instances once and test all properties on those. To do this, create a property
that uses <code class="docutils literal"><span class="pre">conjoin</span></code> to combine several properties into one. Use
<code class="docutils literal"><span class="pre">counterexample</span></code> to add expressive error messages. For example:</p>
<div class="highlight-haskell"><div class="highlight"><pre><span></span><span class="nf">prop_myMegaProp</span> <span class="ow">::</span> <span class="n">myBigType</span> <span class="ow">-></span> <span class="kt">Property</span>
<span class="nf">prop_myMegaProp</span> <span class="n">b</span> <span class="ow">=</span>
<span class="n">conjoin</span>
<span class="p">[</span> <span class="n">counterexample</span>
<span class="p">(</span><span class="s">"Something failed horribly here: "</span> <span class="o">++</span> <span class="n">show</span> <span class="n">b</span><span class="p">)</span> <span class="p">(</span><span class="n">subProperty1</span> <span class="n">b</span><span class="p">)</span>
<span class="p">,</span> <span class="n">counterexample</span>
<span class="p">(</span><span class="s">"Something else failed horribly here: "</span> <span class="o">++</span> <span class="n">show</span> <span class="n">b</span><span class="p">)</span>
<span class="p">(</span><span class="n">subProperty2</span> <span class="n">b</span><span class="p">)</span>
<span class="p">,</span> <span class="c1">-- more properties here ...</span>
<span class="p">]</span>
<span class="nf">subProperty1</span> <span class="ow">::</span> <span class="n">myBigType</span> <span class="ow">-></span> <span class="kt">Bool</span>
<span class="nf">subProperty1</span> <span class="n">b</span> <span class="ow">=</span> <span class="o">...</span>
<span class="nf">subProperty2</span> <span class="ow">::</span> <span class="n">myBigType</span> <span class="ow">-></span> <span class="kt">Property</span>
<span class="nf">subProperty2</span> <span class="n">b</span> <span class="ow">=</span> <span class="o">...</span>
<span class="o">...</span>
</pre></div>
</div>
<div class="section" id="maybe-generation">
<h5>Maybe Generation<a class="headerlink" href="#maybe-generation" title="Permalink to this headline">¶</a></h5>
<p>Use <code class="docutils literal"><span class="pre">genMaybe</span> <span class="pre">genSomething</span></code> to create <code class="docutils literal"><span class="pre">Maybe</span></code> instances of something
including some <code class="docutils literal"><span class="pre">Nothing</span></code> instances.</p>
<p>Use <code class="docutils literal"><span class="pre">Just</span> <span class="pre"><$></span> <span class="pre">genSomething</span></code> to generate only <code class="docutils literal"><span class="pre">Just</span></code> instances of
something.</p>
</div>
<div class="section" id="string-generation">
<h5>String Generation<a class="headerlink" href="#string-generation" title="Permalink to this headline">¶</a></h5>
<p>To generate strings, consider using <code class="docutils literal"><span class="pre">genName</span></code> instead of <code class="docutils literal"><span class="pre">arbitrary</span></code>.
<code class="docutils literal"><span class="pre">arbitrary</span></code> has the tendency to generate strings that are too long.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Code style guide</a><ul>
<li><a class="reference internal" href="#python">Python</a><ul>
<li><a class="reference internal" href="#indentation">Indentation</a></li>
<li><a class="reference internal" href="#formatting-strings">Formatting strings</a></li>
<li><a class="reference internal" href="#formatting-sequences">Formatting sequences</a></li>
<li><a class="reference internal" href="#passing-arguments">Passing arguments</a></li>
<li><a class="reference internal" href="#docstrings">Docstrings</a></li>
<li><a class="reference internal" href="#rules-for-classes-and-modules">Rules for classes and modules</a></li>
</ul>
</li>
<li><a class="reference internal" href="#haskell">Haskell</a><ul>
<li><a class="reference internal" href="#files">Files</a></li>
<li><a class="reference internal" href="#imports">Imports</a></li>
<li><a class="reference internal" href="#id1">Indentation</a></li>
<li><a class="reference internal" href="#multiline-strings">Multiline strings</a></li>
<li><a class="reference internal" href="#data-declarations">Data declarations</a></li>
<li><a class="reference internal" href="#white-space">White space</a><ul>
<li><a class="reference internal" href="#spaces-after-comma">Spaces after comma</a></li>
</ul>
</li>
<li><a class="reference internal" href="#naming">Naming</a><ul>
<li><a class="reference internal" href="#naming-for-updated-values">Naming for updated values</a></li>
</ul>
</li>
<li><a class="reference internal" href="#type-signatures">Type signatures</a></li>
<li><a class="reference internal" href="#use-sum-types-instead-of-exceptions">Use sum types instead of exceptions</a></li>
<li><a class="reference internal" href="#parentheses-point-free-style">Parentheses, point free style</a></li>
<li><a class="reference internal" href="#language-features">Language features</a><ul>
<li><a class="reference internal" href="#extensions">Extensions</a></li>
<li><a class="reference internal" href="#comments">Comments</a></li>
<li><a class="reference internal" href="#tools">Tools</a></li>
<li><a class="reference internal" href="#quickcheck-best-practices">QuickCheck best practices</a><ul>
<li><a class="reference internal" href="#maybe-generation">Maybe Generation</a></li>
<li><a class="reference internal" href="#string-generation">String Generation</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="devnotes.html"
title="previous chapter">Developer notes</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="glossary.html"
title="next chapter">Glossary</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/dev-codestyle.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="glossary.html" title="Glossary"
>next</a></li>
<li class="right" >
<a href="devnotes.html" title="Developer notes"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Ganeti 2.16.0~rc2 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2018, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Google Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.7.
</div>
</body>
</html>
|