Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-10499

Add s_clang_tidy to s_all, turn on readability-misleading-indentation

    • Type: Icon: Improvement Improvement
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Lint
    • None
    • StorEng - Refinement Pipeline

      The motivation for this ticket is the code such as the following:

      if(foo > bar)
          foo += 1;
          break;
          
      

      where we have two lines intended to be inside the if branch but due to lack of braces only the first line is.

      If we compile the above code we get a helpful -Wmisleading-indentation error, but if we first run s_all the second line will be silently re-indented hiding the error.

      This can be caught with clang-tidy for which we already have a script in dist/ which is not currently in use. As part of this ticket we should:

      • Add s_clang_tidy to s_all, making the required changes to get it to run
      • Review the list of rules currently set in s_clang_format such as -android-cloexec-fopen and make sure they are in line with our latest C++ style guide
      • Add the new rule readability-misleading-indentation the script
      • Make sure that s_clang_tidy is called before s_clang_format, and if errors such as the above are found then we don't run s_clang_format which would hide the issue

       

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            andrew.morton@mongodb.com Andrew Morton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: