-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-tidy] Implement alphabetical order test #166072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
7b4e417
c08b734
20b6611
d179b70
c7dc5e9
555beb0
66c831b
968d7f0
39c4b32
3883f14
081131f
5fcca02
af4daa2
d14d899
7a4fc37
47ae95d
d306fd4
e16048d
70b2e16
1ff2e21
327d241
d2fc4e9
3c4a08c
f11cdf8
9fdc59d
e7a1eeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,298 @@ | ||||||
| #!/usr/bin/env python3 | ||||||
| # | ||||||
| # ===-----------------------------------------------------------------------===# | ||||||
| # | ||||||
| # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||||
| # See https://llvm.org/LICENSE.txt for license information. | ||||||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||
| # | ||||||
| # ===-----------------------------------------------------------------------===# | ||||||
|
|
||||||
| """ | ||||||
|
|
||||||
| ClangTidy Alphabetical Order Checker | ||||||
| ==================================== | ||||||
|
|
||||||
| Normalize clang-tidy docs with deterministic sorting for linting/tests. | ||||||
|
||||||
| Normalize clang-tidy docs with deterministic sorting for linting/tests. | |
| Normalize Clang-Tidy documentation with deterministic sorting for linting/tests. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need any flags and subcommands expect -o flag (for testing reasons).
Let it always try to fix by default.
Since we know that we are in LLVM repo, just locate the needed files.
See how https://github.com/llvm/llvm-project/blob/main/clang/docs/tools/dump_format_style.py is implemented, our script structure should be similar to it.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comment what input/output the function has
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still support Python versions that does not support list in type annotation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK we require python 3.8 for llvm and list is for 3.9+
There was rfc on discourse to bump the minimum python version but it got pushed back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like support for 3.8 should be dropped, even 3.9 had reached end of life: https://www.python.org/downloads/. Sure, this is LLVM-wide topic and should be decided by wider audience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is topic about it: https://discourse.llvm.org/t/rfc-upgrading-llvm-s-minimum-required-python-version/88605.
And it seems that we would still keep 3.8 as minimal version for some time in the future despite it being EOL..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comment what heading styly do we look for
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // RUN: %python %S/../../../clang-tidy/tool/clang-tidy-alphabetical-order-check.py checks-list -i %S/../../../docs/clang-tidy/checks/list.rst | diff --strip-trailing-cr - %S/../../../docs/clang-tidy/checks/list.rst | ||
|
|
||
| // RUN: %python %S/../../../clang-tidy/tool/clang-tidy-alphabetical-order-check.py release-notes -i %S/../../../docs/ReleaseNotes.rst | diff --strip-trailing-cr - %S/../../../docs/ReleaseNotes.rst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.