<div dir="ltr">Could be interesting for our code style & automatic formatting. Here is there doc on how to do this: <a href="https://github.com/OpenChemistry/tomviz/blob/master/STYLE.md">https://github.com/OpenChemistry/tomviz/blob/master/STYLE.md</a><div><br></div><div>
<br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">The Kitware Blog</b> <span dir="ltr"><<a href="mailto:donotreply@wordpress.com">donotreply@wordpress.com</a>></span><br>Date: Wed, Oct 19, 2016 at 11:40 AM<br>Subject: [New post] Code Style and Automatic Formatting in Tomviz<br>To: <a href="mailto:alexis.girault@kitware.com">alexis.girault@kitware.com</a><br><br><br><u></u>


        
        
        
        


<div class="gmail-m_-4583289440199520129subscription-body-tag">

<table border="0" cellspacing="0" cellpadding="0" bgcolor="#DDDDDD" style="width:100%;background-image:initial;background-color:rgb(221,221,221);background-size:initial;background-origin:initial;background-clip:initial;background-position:initial;background-repeat:initial">
        <tbody><tr>
                <td>
                                        <span style="display:none">
                                Marcus D. Hanwell posted: "The importance of code style should not be underestimated, and we have seen a number of changes in our projects over the last few months. Until recently VTK and ParaView used a style for braces that I have only ever encountered in projects coming from our"                   </span>
                                                <table border="0" cellspacing="0" cellpadding="0" align="center" class="gmail-m_-4583289440199520129subscribe-body" style="width:100%;padding:10px">
                                <tbody><tr>
                                        <td>
                                                                                                <div style="direction:ltr;max-width:600px;margin:0px auto;overflow:hidden">
                                                        <table border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff" class="gmail-m_-4583289440199520129subscribe-wrapper" style="width:100%;text-align:left;max-width:1024px;min-width:320px;margin:0px auto;background-color:rgb(255,255,255)">
                                                                <tbody><tr>
                                                                        <td>
                                                                                <table border="0" cellspacing="0" cellpadding="0" height="8" class="gmail-m_-4583289440199520129subscribe-header-wrap" style="width:100%;height:8px;background-image:url("https://s0.wp.com/i/emails/stripes.gif");background-color:rgb(67,164,208);background-repeat:repeat-x">
                                                                                        <tbody><tr>
                                                                                                <td></td>
                                                                                        </tr>
                                                                                </tbody></table>

                                                                                <table border="0" cellspacing="0" cellpadding="0" class="gmail-m_-4583289440199520129subscribe-header" style="width:100%;color:rgb(0,136,204);font-size:1.6em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(221,221,221);margin:0px;padding:0px;background-color:rgb(239,239,239)">
                                                                                        <tbody><tr>
                                                                                                <td>
                                                                                                        <h2 class="gmail-m_-4583289440199520129subscribe-title" style="line-height:1;font-weight:400;color:rgb(70,70,70);font-family:'helvetica neue',helvetica,arial,sans-serif;padding:0px;font-size:16px;margin:5px 20px">
                                                                                                                New post on <strong>The Kitware Blog</strong>                                                                                                       </h2>
                                                                                                </td>
                                                                                                <td style="text-align:right">
                                                                                                        <img border="0" class="gmail-m_-4583289440199520129head-avatar" src="http://s0.wp.com/i/emails/blavatar.png" alt="" width="32" height="32" style="margin: 5px 20px 5px 0px; vertical-align: middle;">
                                                                                                </td>
                                                                                        </tr>
                                                                                </tbody></table>

                                                                                <table style="width:100%" border="0" cellspacing="0" cellpadding="20" bgcolor="#ffffff">
                                                                                        <tbody><tr>
                                                                                                <td>
                                                                                                        <table style="width:100%" border="0" cellspacing="0" cellpadding="0">
                                                                                                                <tbody><tr>
                                                                                                                        <td valign="top" class="gmail-m_-4583289440199520129the-post">
                                                                                                                                                                                                                                                                        <table style="width:100%" border="0" cellspacing="0" cellpadding="0">
                                                                                                                                                <tbody><tr>
                                                                                                                                                        <td style="white-space:nowrap;vertical-align:top;width:60px">
                                                                                                                                                                <a href="https://blog.kitware.com/?author=83" style="text-decoration:underline;color:rgb(37,133,178);display:block;margin-right:10px" target="_blank"><img border="0" alt="" src="http://0.gravatar.com/avatar/ca13215da9f467b3a42f91dc900b9cbc?s=50&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D50&r=G" class="gmail-m_-4583289440199520129avatar gmail-m_-4583289440199520129avatar-50" height="50" width="50"></a>
                                                                                                                                                        </td>
                                                                                                                                                        <td>
                                                                                                                                                                <h2 class="gmail-m_-4583289440199520129post-title" style="color:rgb(85,85,85);margin:0px;font-size:20px"><a href="https://blog.kitware.com/code-style-automatic-formatting-tomviz/" style="color:rgb(37,133,178);text-decoration:none" target="_blank">Code Style and Automatic Formatting in Tomviz</a></h2>
                                                                                                                                                                <span style="color:rgb(136,136,136)">by <a href="https://blog.kitware.com/?author=83" style="text-decoration:underline;color:rgb(136,136,136)" target="_blank">Marcus D. Hanwell</a> </span>
                                                                                                                                                        </td>
                                                                                                                                                </tr>
                                                                                                                                        </tbody></table>
                                                                                                                                
                                                                                                                                <div class="gmail-m_-4583289440199520129post-content" style="direction:ltr;margin-top:1em;max-width:560px">
                                                                                                                                                                                                                                                                                        <p style="direction:ltr;font-size:14px;line-height:1.4em;color:rgb(68,68,68);font-family:'helvetica neue',helvetica,arial,sans-serif;margin:0px 0px 1em">The importance of code style should not be underestimated, and we have seen a number of changes in our projects over the last few months. Until recently <a style="text-decoration:underline;color:rgb(37,133,178)" href="http://vtk.org/" target="_blank">VTK</a> and <a style="text-decoration:underline;color:rgb(37,133,178)" href="http://paraview.org/" target="_blank">ParaView</a> used a style for braces that I have only ever encountered in projects coming from our company, with minimal to no support in most editors. Having a consistent coding style is important, but it can also be a pain to describe and takes time to go over in code reviews. I had been tracking <a style="text-decoration:underline;color:rgb(37,133,178)" href="http://clang.llvm.org/docs/ClangFormat.html" target="_blank">clang-format</a> for quite some time now, along with several of its predecessors, but this project seemed different as it built upon the language parser in <a style="text-decoration:underline;color:rgb(37,133,178)" href="http://clang.llvm.org/" target="_blank">clang</a>.</p>
<pre class="gmail-m_-4583289440199520129lang:default gmail-m_-4583289440199520129decode:true">---
# This configuration requires clang-format 3.8 or higher.
BasedOnStyle: Mozilla
AlwaysBreakAfterReturnType: None
AlwaysBreakAfterDefinitionRetu<wbr>rnType: None
BreakConstructorInitializersBe<wbr>foreComma: false
...</pre>
<p style="direction:ltr;font-size:14px;line-height:1.4em;color:rgb(68,68,68);font-family:'helvetica neue',helvetica,arial,sans-serif;margin:0px 0px 1em">For <a style="text-decoration:underline;color:rgb(37,133,178)" href="http://tomviz.org/" target="_blank">Tomviz</a> I based our format file on what <a style="text-decoration:underline;color:rgb(37,133,178)" href="http://cmake.org/" target="_blank">CMake</a> used in its recent conversion, with some minor adjustments. I was then able to run it in August on all of our source files, and Chris Harris added an automated hook on our <a style="text-decoration:underline;color:rgb(37,133,178)" href="https://github.com/OpenChemistry/tomviz" target="_blank">GitHub repository</a> to validate that proposed changes comply with the style file. All pull requests are now run through the checks, with the necessary changes supplied if the test fails. This removes the need to review pull requests for coding style, and ensures our code base has a uniform style. Chris has since extended this to our Python code using flake8 too.</p>
<p style="direction:ltr;font-size:14px;line-height:1.4em;color:rgb(68,68,68);font-family:'helvetica neue',helvetica,arial,sans-serif;margin:0px 0px 1em">Developers can easily apply the style to their changes, I usually run 'clang-format -i path/to/changed.*', there are other ways to use the tool too. Now to weigh in on the great brace placement war - we have chosen our side with CMake and keep them on the same line as the statement, preserving maximum vertical space. The ParaView project just merged their clang-format changes this morning, opting to place them on a new line, with VTK using a custom script that also places them on a new line.</p>
<p style="direction:ltr;font-size:14px;line-height:1.4em;color:rgb(68,68,68);font-family:'helvetica neue',helvetica,arial,sans-serif;margin:0px 0px 1em">Upcoming posts in the series - tabs vs spaces, emacs vs vim, and finally Android vs iPhone (I heard the desktop was dead already, but my typing speed is terrible on a phone and I can't get my development environment up and running on it). Throwing down the gauntlet, but in all seriousness automating these things frees up development time while still fostering style uniformity. The clang-format tool enables us to express our code style in a very succinct fashion that can be applied very easily before committing changes - it also understands and can work with diffs/git very well.</p>
<p style="direction:ltr;font-size:14px;line-height:1.4em;color:rgb(68,68,68);font-family:'helvetica neue',helvetica,arial,sans-serif;margin:0px 0px 1em">Oh, and spoiler alert...spaces, vim, Android ;-)</p>
<div style="direction:ltr;clear:both"></div>                                                                                                                                                                                                                                                                      </div>

                                                                                                                                                                                                                                                                        <div class="gmail-m_-4583289440199520129meta" style="direction:ltr;color:rgb(153,153,153);font-size:0.9em;margin-top:4px;line-height:160%;padding:15px 0px;border-top-width:1px;border-top-style:solid;border-top-color:rgb(238,238,238);border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);overflow:hidden">
                                                                                                                                                <strong><a style="text-decoration:underline;color:rgb(37,133,178)" href="https://blog.kitware.com/?author=83" target="_blank">Marcus D. Hanwell</a></strong> | October 19, 2016 at 3:40 pm | Categories: <a style="text-decoration:underline;color:rgb(37,133,178)" href="https://blog.kitware.com/?taxonomy=category&term=all" target="_blank">All</a>
 | URL: <a style="text-decoration:underline;color:rgb(37,133,178)" href="http://wp.me/p6QpJO-4cW" target="_blank">http://wp.me/p6QpJO-4cW</a>                                                                                                                                 </div>
                                                                                                                                
                                                                                                                        
                                                                                                                                <p class="gmail-m_-4583289440199520129subscribe-action-links" style="direction:ltr;line-height:1.4em;font-family:'helvetica neue',helvetica,arial,sans-serif;margin:0px;font-size:14px;color:rgb(102,102,102);padding:1em 0px 0em;width:auto">
                                                                                                                                        </p><table class="gmail-m_-4583289440199520129auto-width" border="0" cellspacing="0" cellpadding="0" style="width:auto">
                                                                                                                                                <tbody><tr>
                                                                                                                                                        <td style="width:10px"><a href="https://blog.kitware.com/code-style-automatic-formatting-tomviz/#respond" style="border-radius:10em;border:1px solid rgb(17,114,158);text-decoration:none;color:rgb(255,255,255);padding:5px 15px;font-size:16px;line-height:1.4em;font-family:'helvetica neue',helvetica,arial,sans-serif;font-weight:normal;margin-left:0px;white-space:nowrap;background-color:rgb(37,133,178)" target="_blank">Comment</a></td>
                                                                                                                                                                                                                                                                                                        <td>   <a class="gmail-m_-4583289440199520129subscribe-action-link" href="https://blog.kitware.com/code-style-automatic-formatting-tomviz/#comments" style="color:rgb(37,133,178);text-decoration:underline" target="_blank">See all comments</a></td>
                                                                                                                                                                                                                                                                                                                                                                                                                                                </tr>
                                                                                                                                        </tbody></table>
                                                                                                                                <p></p>
                                                                                                                                                                                                                                                </td>
                                                                                                                </tr>
                                                                                                        </tbody></table>
                                                                                                </td>
                                                                                        </tr>
                                                                                </tbody></table>

                                                                                <table border="0" cellspacing="0" cellpadding="20" bgcolor="#efefef" class="gmail-m_-4583289440199520129subscribe-wrapper-sub" style="width:100%;text-align:left;border-top-width:1px;border-top-style:solid;border-top-color:rgb(221,221,221);background-color:rgb(239,239,239)">
                                                                                        <tbody><tr>
                                                                                                <td class="gmail-m_-4583289440199520129subscribe-content" style="border-top-width:1px;border-top-style:solid;border-top-color:rgb(243,243,243);color:rgb(136,136,136);font-family:'helvetica neue',helvetica,arial,sans-serif;font-size:14px;background-image:initial;background-color:rgb(239,239,239);background-size:initial;background-origin:initial;background-clip:initial;background-position:initial;background-repeat:initial">
                                                                                                        <p style="direction:ltr;color:rgb(68,68,68);font-family:'helvetica neue',helvetica,arial,sans-serif;font-size:12px;line-height:1.4em;margin:0px 0px 10px">
                                                                                                                <a style="text-decoration:underline;color:rgb(37,133,178)" href="https://subscribe.wordpress.com/?key=9ce68109f6979a89466590c0dc80e5f5&email=alexis.girault%40kitware.com&b=LsqmXnKz%2F%26%25afu6SwS%26lLW_j%3FRvaejPbFB_%5BXcRj%3Fafio%3D-%2BR5" target="_blank">Unsubscribe</a> to no longer receive posts from The Kitware Blog.<br>
                                                                                                                Change your email settings at <a style="text-decoration:underline;color:rgb(37,133,178)" href="https://subscribe.wordpress.com/?key=9ce68109f6979a89466590c0dc80e5f5&email=alexis.girault%40kitware.com" target="_blank">Manage Subscriptions</a>.                                                                                                        </p>

                                                                                                        <p style="direction:ltr;color:rgb(68,68,68);font-family:'helvetica neue',helvetica,arial,sans-serif;font-size:12px;line-height:1.4em;margin:0px">
                                                                                                                <strong>Trouble clicking?</strong> Copy and paste this URL into your browser: <br>
                                                                                                                <a style="text-decoration:underline;color:rgb(37,133,178)" href="https://blog.kitware.com/code-style-automatic-formatting-tomviz/" target="_blank">https://blog.kitware.com/code-<wbr>style-automatic-formatting-<wbr>tomviz/</a>
                                                                                                        </p>
                                                                                                </td>
                                                                                        </tr>
                                                                                </tbody></table>
                                                                        </td>
                                                                </tr>
                                                        </tbody></table>

                                                        <table border="0" cellspacing="0" cellpadding="0" height="3" class="gmail-m_-4583289440199520129subscribe-footer-wrap" style="width:100%;height:3px;background-image:url("https://s0.wp.com/i/emails/stripes.gif");background-color:rgb(67,164,208);background-repeat:repeat-x">
                                                                <tbody><tr>
                                                                        <td></td>
                                                                </tr>
                                                        </tbody></table>
                                                </div>
                                        </td>
                                </tr>
                        </tbody></table>

                        
                        <br>
                </td>
        </tr>
</tbody></table>

<img alt="" border="0" src="http://pixel.wp.com/b.gif?blog=101150012&post=16178&subd=blog.kitware.com&ref=&email=1&email_o=jetpack&host=jetpack.wordpress.com" width="1" height="1"></div>


</div><br></div></div>