<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>So the other day, I ran indent.pyt on some files and checked in
      the changes (<a class="moz-txt-link-freetext" href="https://github.com/FRRouting/frr/pull/1428">https://github.com/FRRouting/frr/pull/1428</a>) and it
      failed the CI code police test  -- what did I do wrong and how do
      I avoid it in the future.</p>
    <p>Lou<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 2/22/2018 8:57 PM, Quentin Young
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:F9353DCE-158E-4D43-B208-78F040913506@cumulusnetworks.com">Greetings
      developers, here is a reminder of the style guide and a summary of
      the tools FRR offers you to minimize the effort you spend ensuring
      your patches are compliant.
      <div class=""><br class="">
      </div>
      <div class="">FRR uses Linux kernel style. You can find that
        documented here: <a
          href="https://www.kernel.org/doc/html/v4.10/process/coding-style.html"
          class="" moz-do-not-send="true">https://www.kernel.org/doc/html/v4.10/process/coding-style.html</a></div>
      <div class=""><br class="">
      </div>
      <div class="">FRR’s style requirement is that patches submitted to
        FRR must comply with this style (with some exceptions covered in
        the docs). You are not required to run any tool, any script,
        etc, before submitting your patch. Feel free to do everything by
        hand if you want. If it complies with the style guidelines then
        from a style standpoint it is fine.</div>
      <div class=""><br class="">
      </div>
      <div class="">FRR offers you a variety of tools for your
        convenience to help comply with the style guidelines and make it
        as easy as possible. In no particular order these are:</div>
      <div class=""><br class="">
      </div>
      <div class="">* clang-format configuration file</div>
      <div class=""><br class="">
      </div>
      <div class="">In the project root there is a file named
        .clang-format. This is a configuration file for the clang-format
        source formatting tool. This tool is part of the LLVM project.
        If you wish, you can use this tool to assist in complying with
        the style guide. There are good integrations for most editors,
        as well as an integration with git that you can use to do things
        like only format lines introduced in certain commits, only
        format staged changes, etc. Please note that while clang-format
        gets you 95% of the way there it’s not perfect and you are still
        responsible for styling your code properly.</div>
      <div class=""><br class="">
      </div>
      <div class="">* indent.py</div>
      <div class=""><br class="">
      </div>
      <div class="">This is a script that takes a filename and formats
        it with clang-format, doing some additional preprocessing to
        help reduce some edge-case mangling that happens with things
        like DEFUNs and macros. It operates on whole files. Usually
        you’re better off using clang-format integrations to format your
        code as you go.</div>
      <div class=""><br class="">
      </div>
      <div class="">* tools/checkpatch.sh</div>
      <div class=""><br class="">
      </div>
      <div class="">This is a script that wraps an adapted version of
        the Linux kernel’s checkpatch.pl script. It takes a git
        formatted patch or diff file and a path to your frr tree and
        does some magic to warn you about potential style issues. It
        does modify your frr tree in the process although it makes a
        best effort to save your working tree and restore it, if you
        don’t want to use `git stash` for some reason. You can run it
        like this:</div>
      <div class=""><br class="">
      </div>
      <div class="">cd tools/</div>
      <div class="">./checkpatch.sh /path/to/patchfile
        /path/to/frr/sourcetree</div>
      <div class=""><br class="">
      </div>
      <div class="">This script is also run by the CI system on new pull
        requests and its output is displayed to assist you with catching
        style errors. It’s not perfect but should catch the majority and
        have a relatively low false positive rate. DEFUNs are ignored so
        please use common sense when formatting these to avoid spending
        others’ time reviewing style.</div>
      <div class=""><br class="">
      </div>
      <div class="">As always if you have any questions about style
        please refer to the kernel style guide, if you can’t find the
        answer to your question there ask on slack or this mailing list,
        and if you have improvements to indent.py or checkpatch.sh
        ideally submit a patch or alternatively open a Github issue.
        Again you are not required to use these tools, they are here for
        your personal convenience. We do not maintain clang-format so
        please don’t open bugs or feature requests about clang-format
        with us.</div>
      <div class=""><br class="">
      </div>
      <div class="">Quentin</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dev@lists.frrouting.org">dev@lists.frrouting.org</a>
<a class="moz-txt-link-freetext" href="https://lists.frrouting.org/listinfo/dev">https://lists.frrouting.org/listinfo/dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>