<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59606>59606</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `add_new_check.py` fails when directories have not been provided for a new module
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          beckadd
      </td>
    </tr>
</table>

<pre>
    When attempting to add a new check in a new (uninitialized) module, the script will continuously fail. Likewise, the script will fail if a `CMakeLists.txt` file is not present and properly boilerplated.

### Reproducible Example

```term
./add_new_check.py my-module no-messy-functions

Traceback (most recent call last):
  File "/home/<user>/llvm-project/clang-tools-extra/clang-tidy/./add_new_check.py", line 595, in <module>
    main()
  File "/home/<user>/llvm-project/clang-tools-extra/clang-tidy/./add_new_check.py", line 574, in main
    if not adapt_cmake(module_path, check_name_camel):
  File "/home/<user>/llvm-project/clang-tools-extra/clang-tidy/./add_new_check.py", line 29, in adapt_cmake
    with io.open(filename, 'r', encoding='utf8') as f:
FileNotFoundError: [Errno 2] No such file or directory: './my-module/CMakeLists.txt'
```
This is true until there are directories for `my-module` in `clang-tidy/tests/checkers` and `clang-tools-extra/docs/clang-tidy/checks`. The appropriate error messages are produced.

### Suggested Fix

The python script should initialize the module and notify the user that the module has been initialized in the appropriate directories. It should confirm that the user wants to initialize a new module in case they have accidentally made a typo (for example, if the user accidentally types `./add_new_check.py my-modlue no-other-functions` - a typo at my-module that should require confirmation).

I'll make a pull request with the suggested changes here soon.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVcFu2zgQ_Rr6MrAhU5FsH3xokwgo0O1ht8AeA4ocWdxQpJYc1dF-_WJoxXHa7l4LGIEizQzfm5n3qFKyJ494FNVHUT2s1ER9iMcW9bMyZtUGMx__7NGDIsJhJOtPQAGUMaDA4xl0j_oZrF_-FXI_eestWeXs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