cpp-linter 1.12.0__tar.gz → 1.12.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.gitattributes +1 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/labeler.yml +3 -5
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/release-drafter.yml +1 -5
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/release.yml +2 -2
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/tests.yml +10 -7
- {cpp_linter-1.12.0/cpp_linter.egg-info → cpp_linter-1.12.1}/PKG-INFO +2 -3
- cpp_linter-1.12.1/cpp_linter/_version.py +24 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/clang_tools/__init__.py +12 -12
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/clang_tools/clang_format.py +8 -7
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/clang_tools/clang_tidy.py +11 -11
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/clang_tools/patcher.py +9 -9
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/cli.py +9 -9
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/common_fs/__init__.py +19 -19
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/common_fs/file_filter.py +11 -12
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/git/__init__.py +22 -26
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/git/git_str.py +7 -7
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/rest_api/__init__.py +21 -21
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/rest_api/github_api.py +25 -25
- {cpp_linter-1.12.0 → cpp_linter-1.12.1/cpp_linter.egg-info}/PKG-INFO +2 -3
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter.egg-info/SOURCES.txt +2 -1
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/conf.py +1 -1
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/pyproject.toml +1 -2
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/test_database_path.py +1 -2
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/test_tools_output.py +16 -14
- cpp_linter-1.12.1/tests/demo/.clang-tidy +185 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/ignored_paths/test_ignored_paths.py +3 -4
- cpp_linter-1.12.1/tests/reviews/.clang-format +3 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/test_cli_args.py +2 -3
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/test_misc.py +2 -2
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/test_rate_limits.py +1 -2
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/uv.lock +46 -464
- cpp_linter-1.12.0/.github/release-drafter.yml +0 -1
- cpp_linter-1.12.0/cpp_linter/_version.py +0 -34
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/FUNDING.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/dependabot.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/analyze-workflows.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/codeql.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/docs.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/pre-commit.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/workflows/stale.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.github/zizmor.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.gitignore +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.pre-commit-config.yaml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/.readthedocs.yaml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/CONTRIBUTING.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/LICENSE +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/README.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/codecov.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/__init__.py +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter/loggers.py +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter.egg-info/dependency_links.txt +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter.egg-info/entry_points.txt +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter.egg-info/not-zip-safe +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter.egg-info/requires.txt +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cpp_linter.egg-info/top_level.txt +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/cspell.config.yml +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.clang_tools.clang_format.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.clang_tools.clang_tidy.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.clang_tools.patcher.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.clang_tools.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.cli.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.common_fs.file_filter.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.common_fs.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.git.git_str.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.git.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.loggers.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.rest_api.github_api.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.rest_api.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/API-Reference/cpp_linter.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/_static/extra_css.css +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/_static/favicon.ico +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/_static/logo.png +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/building_docs.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/contributing.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/index.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/permissions.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/docs/pr_review_caveats.rst +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/noxfile.py +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/setup.cfg +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/setup.py +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/.clang-format +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/.clang-tidy +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/opl/opl.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/opl/opl_sdl.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/pcsound/pcsound.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/pcsound/pcsound_sdl.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/src/i_musicpack.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/src/i_sdlmusic.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/src/i_sdlsound.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/src/i_sound.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/cache/src/net_sdl.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/expected-result_0.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/expected-result_1.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/expected-result_2.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/67715d6e2725322e6132e9ff99b9a2a3f3b10c83/patch.diff +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/71091562db5b0e7853d08ffa2f110af49cc3bc0d/cache/src/hexen/info.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/71091562db5b0e7853d08ffa2f110af49cc3bc0d/cache/src/hexen/p_enemy.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/71091562db5b0e7853d08ffa2f110af49cc3bc0d/cache/src/hexen/p_local.h +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/71091562db5b0e7853d08ffa2f110af49cc3bc0d/expected-result_0.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/71091562db5b0e7853d08ffa2f110af49cc3bc0d/expected-result_1.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/71091562db5b0e7853d08ffa2f110af49cc3bc0d/expected-result_2.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/chocolate-doom/chocolate-doom/71091562db5b0e7853d08ffa2f110af49cc3bc0d/patch.diff +0 -0
- {cpp_linter-1.12.0/tests/capture_tools_output/shenxianpeng/test-repo → cpp_linter-1.12.1/tests/capture_tools_output/cpp-linter/cpp-linter}/.clang-format +0 -0
- {cpp_linter-1.12.0/tests/demo → cpp_linter-1.12.1/tests/capture_tools_output/cpp-linter/cpp-linter}/.clang-tidy +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/cpp-linter/cpp-linter/950ff0b690e1903797c303c5fc8d9f3b52f1d3c5/cache/tests/demo/demo.cpp +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/cpp-linter/cpp-linter/950ff0b690e1903797c303c5fc8d9f3b52f1d3c5/cache/tests/demo/demo.hpp +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/cpp-linter/cpp-linter/950ff0b690e1903797c303c5fc8d9f3b52f1d3c5/patch.diff +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/cpp-linter/cpp-linter/test_git_lib.patch +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/libvips/libvips/.clang-format +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/libvips/libvips/.clang-tidy +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/libvips/libvips/fe82be345a5b654a76835a7aea5a804bd9ebff0a/expected-result_0.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/libvips/libvips/fe82be345a5b654a76835a7aea5a804bd9ebff0a/expected-result_1.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/libvips/libvips/fe82be345a5b654a76835a7aea5a804bd9ebff0a/expected-result_2.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/libvips/libvips/fe82be345a5b654a76835a7aea5a804bd9ebff0a/patch.diff +0 -0
- {cpp_linter-1.12.0/tests/demo → cpp_linter-1.12.1/tests/capture_tools_output/shenxianpeng/test-repo}/.clang-format +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/shenxianpeng/test-repo/.clang-tidy +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/shenxianpeng/test-repo/662ad4cf90084063ea9c089b8de4aff0b8959d0e/cache/p_enemy.c +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/shenxianpeng/test-repo/662ad4cf90084063ea9c089b8de4aff0b8959d0e/expected-result_0.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/shenxianpeng/test-repo/662ad4cf90084063ea9c089b8de4aff0b8959d0e/expected-result_1.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/shenxianpeng/test-repo/662ad4cf90084063ea9c089b8de4aff0b8959d0e/expected-result_2.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/capture_tools_output/shenxianpeng/test-repo/662ad4cf90084063ea9c089b8de4aff0b8959d0e/patch.diff +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/comments/pr_22.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/comments/pr_comments_pg1.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/comments/pr_comments_pg2.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/comments/push_8d68756375e0483c7ac2b4d6bbbece420dbbb495.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/comments/push_comments_8d68756375e0483c7ac2b4d6bbbece420dbbb495.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/comments/test_comments.py +0 -0
- {cpp_linter-1.12.0/tests/reviews → cpp_linter-1.12.1/tests/demo}/.clang-format +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/demo/compile_flags.txt +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/demo/demo.cpp +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/demo/demo.hpp +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/ignored_paths/.gitmodules +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/list_changes/patch.diff +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/list_changes/pull_request_files_pg1.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/list_changes/pull_request_files_pg2.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/list_changes/push_files_pg1.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/list_changes/push_files_pg2.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/list_changes/test_get_file_changes.py +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/reviews/.clang-tidy +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/reviews/pr_27.diff +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/reviews/pr_27.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/reviews/pr_review_comments.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/reviews/pr_reviews.json +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/reviews/test_pr_review.py +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/test_comment_length.py +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/test_git_str.py +0 -0
- {cpp_linter-1.12.0 → cpp_linter-1.12.1}/tests/test_parse_clang_tidy_stdout.py +0 -0
|
@@ -4,14 +4,12 @@ on:
|
|
|
4
4
|
pull_request:
|
|
5
5
|
types: [opened, reopened, synchronize]
|
|
6
6
|
|
|
7
|
+
permissions: {}
|
|
8
|
+
|
|
7
9
|
jobs:
|
|
8
10
|
# Auto label PRs during a PR event
|
|
9
11
|
auto-label:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
12
|
permissions:
|
|
12
13
|
contents: read
|
|
13
14
|
pull-requests: write
|
|
14
|
-
|
|
15
|
-
- uses: release-drafter/release-drafter@6db134d15f3909ccc9eefd369f02bd1e9cffdf97 # v6.2.0
|
|
16
|
-
env:
|
|
17
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
15
|
+
uses: cpp-linter/.github/.github/workflows/pr-labeler.yml@main
|
|
@@ -11,11 +11,7 @@ permissions: {}
|
|
|
11
11
|
jobs:
|
|
12
12
|
# Draft your next Release notes as Pull Requests are merged into the default branch
|
|
13
13
|
draft-release:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
14
|
permissions:
|
|
16
15
|
contents: write
|
|
17
16
|
pull-requests: read
|
|
18
|
-
|
|
19
|
-
- uses: release-drafter/release-drafter@6db134d15f3909ccc9eefd369f02bd1e9cffdf97 # v6.2.0
|
|
20
|
-
env:
|
|
21
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
+
uses: cpp-linter/.github/.github/workflows/release-drafter.yml@main
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
- name: Build distributions
|
|
33
33
|
run: pipx run build -o dist
|
|
34
34
|
- name: Upload builds as artifacts
|
|
35
|
-
uses: actions/upload-artifact@
|
|
35
|
+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
36
36
|
with:
|
|
37
37
|
path: dist
|
|
38
38
|
name: wheels
|
|
@@ -45,7 +45,7 @@ jobs:
|
|
|
45
45
|
id-token: write
|
|
46
46
|
steps:
|
|
47
47
|
- name: Download distributions
|
|
48
|
-
uses: actions/download-artifact@
|
|
48
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
49
49
|
with:
|
|
50
50
|
name: wheels
|
|
51
51
|
path: dist
|
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
fail-fast: false
|
|
29
29
|
matrix:
|
|
30
30
|
os: ['windows-latest', 'ubuntu-latest']
|
|
31
|
-
version: ['21', '20', '19', '18', '17', '16', '15', '14', '13', '12', '11'
|
|
31
|
+
version: ['22', '21', '20', '19', '18', '17', '16', '15', '14', '13', '12', '11']
|
|
32
32
|
env:
|
|
33
33
|
MAX_PYTHON_VERSION: '3.14'
|
|
34
34
|
# only used when installing for a pre-released python version
|
|
@@ -60,7 +60,7 @@ jobs:
|
|
|
60
60
|
# sudo cmake --install build
|
|
61
61
|
|
|
62
62
|
- name: Install uv
|
|
63
|
-
uses: astral-sh/setup-uv@
|
|
63
|
+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
|
|
64
64
|
with:
|
|
65
65
|
enable-cache: true
|
|
66
66
|
cache-dependency-glob: "uv.lock"
|
|
@@ -112,7 +112,7 @@ jobs:
|
|
|
112
112
|
run: uvx nox -s test-all -- -m "${PYTEST_ARGS}"
|
|
113
113
|
|
|
114
114
|
- name: Upload coverage data
|
|
115
|
-
uses: actions/upload-artifact@
|
|
115
|
+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
116
116
|
with:
|
|
117
117
|
name: coverage-data-${{ runner.os }}-${{ matrix.version }}
|
|
118
118
|
path: .coverage*
|
|
@@ -121,13 +121,16 @@ jobs:
|
|
|
121
121
|
coverage-report:
|
|
122
122
|
needs: [test]
|
|
123
123
|
runs-on: ubuntu-latest
|
|
124
|
+
environment:
|
|
125
|
+
name: test-coverage
|
|
126
|
+
url: https://app.codecov.io/gh/cpp-linter/cpp-linter
|
|
124
127
|
steps:
|
|
125
128
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
126
129
|
with:
|
|
127
130
|
persist-credentials: false
|
|
128
131
|
|
|
129
132
|
- name: Download all artifacts
|
|
130
|
-
uses: actions/download-artifact@
|
|
133
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
131
134
|
with:
|
|
132
135
|
pattern: coverage-data-*
|
|
133
136
|
merge-multiple: true
|
|
@@ -138,7 +141,7 @@ jobs:
|
|
|
138
141
|
python-version: '3.x'
|
|
139
142
|
|
|
140
143
|
- name: Install uv
|
|
141
|
-
uses: astral-sh/setup-uv@
|
|
144
|
+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
|
|
142
145
|
with:
|
|
143
146
|
enable-cache: true
|
|
144
147
|
cache-dependency-glob: "uv.lock"
|
|
@@ -147,12 +150,12 @@ jobs:
|
|
|
147
150
|
run: uvx nox -s coverage
|
|
148
151
|
|
|
149
152
|
- name: Upload comprehensive coverage HTML report
|
|
150
|
-
uses: actions/upload-artifact@
|
|
153
|
+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
151
154
|
with:
|
|
152
155
|
name: coverage-report
|
|
153
156
|
path: htmlcov/
|
|
154
157
|
|
|
155
|
-
- uses: codecov/codecov-action@
|
|
158
|
+
- uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
|
156
159
|
env:
|
|
157
160
|
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
|
|
158
161
|
with:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cpp-linter
|
|
3
|
-
Version: 1.12.
|
|
3
|
+
Version: 1.12.1
|
|
4
4
|
Summary: Run clang-format and clang-tidy on a batch of files.
|
|
5
5
|
Author-email: Brendan Doherty <2bndy5@gmail.com>, Xianpeng Shen <xianpeng.shen@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,14 +15,13 @@ Classifier: Natural Language :: English
|
|
|
15
15
|
Classifier: Operating System :: Microsoft :: Windows
|
|
16
16
|
Classifier: Operating System :: POSIX :: Linux
|
|
17
17
|
Classifier: Operating System :: MacOS
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.14
|
|
24
23
|
Classifier: Topic :: Software Development :: Build Tools
|
|
25
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
26
25
|
Description-Content-Type: text/x-rst
|
|
27
26
|
License-File: LICENSE
|
|
28
27
|
Requires-Dist: pygit2>=1.15.1
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '1.12.1'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 12, 1)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = 'g87b634e51'
|
|
@@ -3,7 +3,7 @@ import json
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
import re
|
|
5
5
|
import subprocess
|
|
6
|
-
from typing import
|
|
6
|
+
from typing import cast
|
|
7
7
|
import shutil
|
|
8
8
|
|
|
9
9
|
from ..common_fs import FileObj, FileIOTimeout
|
|
@@ -14,7 +14,7 @@ from .clang_format import run_clang_format, FormatAdvice
|
|
|
14
14
|
from ..cli import Args
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
def assemble_version_exec(tool_name: str, specified_version: str) ->
|
|
17
|
+
def assemble_version_exec(tool_name: str, specified_version: str) -> str | None:
|
|
18
18
|
"""Assembles the command to the executable of the given clang tool based on given
|
|
19
19
|
version information.
|
|
20
20
|
|
|
@@ -37,13 +37,13 @@ def assemble_version_exec(tool_name: str, specified_version: str) -> Optional[st
|
|
|
37
37
|
def _run_on_single_file(
|
|
38
38
|
file: FileObj,
|
|
39
39
|
log_lvl: int,
|
|
40
|
-
tidy_cmd:
|
|
41
|
-
db_json:
|
|
42
|
-
format_cmd:
|
|
43
|
-
format_filter:
|
|
44
|
-
tidy_filter:
|
|
40
|
+
tidy_cmd: str | None,
|
|
41
|
+
db_json: list[dict[str, str]] | None,
|
|
42
|
+
format_cmd: str | None,
|
|
43
|
+
format_filter: FormatFileFilter | None,
|
|
44
|
+
tidy_filter: TidyFileFilter | None,
|
|
45
45
|
args: Args,
|
|
46
|
-
) ->
|
|
46
|
+
) -> tuple[str, str, TidyAdvice | None, FormatAdvice | None]:
|
|
47
47
|
log_stream = worker_log_init(log_lvl)
|
|
48
48
|
filename = Path(file.name).as_posix()
|
|
49
49
|
|
|
@@ -115,11 +115,11 @@ def _capture_tool_version(cmd: str) -> str:
|
|
|
115
115
|
|
|
116
116
|
class ClangVersions:
|
|
117
117
|
def __init__(self) -> None:
|
|
118
|
-
self.tidy:
|
|
119
|
-
self.format:
|
|
118
|
+
self.tidy: str | None = None
|
|
119
|
+
self.format: str | None = None
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
def capture_clang_tools_output(files:
|
|
122
|
+
def capture_clang_tools_output(files: list[FileObj], args: Args) -> ClangVersions:
|
|
123
123
|
"""Execute and capture all output from clang-tidy and clang-format. This aggregates
|
|
124
124
|
results in the :attr:`~cpp_linter.Globals.OUTPUT`.
|
|
125
125
|
|
|
@@ -150,7 +150,7 @@ def capture_clang_tools_output(files: List[FileObj], args: Args) -> ClangVersion
|
|
|
150
150
|
ignore_value=args.ignore_tidy,
|
|
151
151
|
)
|
|
152
152
|
|
|
153
|
-
db_json:
|
|
153
|
+
db_json: list[dict[str, str]] | None = None
|
|
154
154
|
if args.database:
|
|
155
155
|
db = Path(args.database)
|
|
156
156
|
if not db.is_absolute():
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from pathlib import PurePath
|
|
4
4
|
import subprocess
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import cast
|
|
6
6
|
|
|
7
7
|
import xml.etree.ElementTree as ET
|
|
8
8
|
|
|
@@ -45,7 +45,7 @@ class FormatReplacementLine:
|
|
|
45
45
|
self.line = line_numb
|
|
46
46
|
|
|
47
47
|
#: A list of `FormatReplacement` object(s) representing suggestions.
|
|
48
|
-
self.replacements:
|
|
48
|
+
self.replacements: list[FormatReplacement] = []
|
|
49
49
|
|
|
50
50
|
def __repr__(self):
|
|
51
51
|
return (
|
|
@@ -66,7 +66,7 @@ class FormatAdvice(PatchMixin):
|
|
|
66
66
|
#: The source file that the suggestion concerns.
|
|
67
67
|
self.filename = PurePath(filename).as_posix()
|
|
68
68
|
|
|
69
|
-
self.replaced_lines:
|
|
69
|
+
self.replaced_lines: list[FormatReplacementLine] = []
|
|
70
70
|
"""A list of `FormatReplacementLine` representing replacement(s)
|
|
71
71
|
on a single line."""
|
|
72
72
|
|
|
@@ -85,7 +85,7 @@ class FormatAdvice(PatchMixin):
|
|
|
85
85
|
return "clang-format"
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
def tally_format_advice(files:
|
|
88
|
+
def tally_format_advice(files: list[FileObj]) -> int:
|
|
89
89
|
"""Returns the sum of clang-format errors"""
|
|
90
90
|
format_checks_failed = 0
|
|
91
91
|
for file_obj in files:
|
|
@@ -126,7 +126,7 @@ def parse_format_replacements_xml(
|
|
|
126
126
|
if not xml_out:
|
|
127
127
|
return format_advice
|
|
128
128
|
ranges = cast(
|
|
129
|
-
|
|
129
|
+
list[list[int]],
|
|
130
130
|
file_obj.range_of_changed_lines(lines_changed_only, get_ranges=True),
|
|
131
131
|
)
|
|
132
132
|
tree = ET.fromstring(xml_out)
|
|
@@ -139,7 +139,8 @@ def parse_format_replacements_xml(
|
|
|
139
139
|
line, cols = get_line_cnt_from_cols(content, offset)
|
|
140
140
|
is_line_in_ranges = False
|
|
141
141
|
for r in ranges:
|
|
142
|
-
|
|
142
|
+
# range() is partially inclusive: [r0, r1)
|
|
143
|
+
if line in range(r[0], r[1] + 1):
|
|
143
144
|
is_line_in_ranges = True
|
|
144
145
|
break
|
|
145
146
|
if is_line_in_ranges or lines_changed_only == 0:
|
|
@@ -183,7 +184,7 @@ def run_clang_format(
|
|
|
183
184
|
"--output-replacements-xml",
|
|
184
185
|
]
|
|
185
186
|
ranges = cast(
|
|
186
|
-
|
|
187
|
+
list[list[int]],
|
|
187
188
|
file_obj.range_of_changed_lines(lines_changed_only, get_ranges=True),
|
|
188
189
|
)
|
|
189
190
|
for span in ranges:
|
|
@@ -5,7 +5,7 @@ import os
|
|
|
5
5
|
from pathlib import Path, PurePath
|
|
6
6
|
import re
|
|
7
7
|
import subprocess
|
|
8
|
-
from typing import
|
|
8
|
+
from typing import cast
|
|
9
9
|
from ..loggers import logger
|
|
10
10
|
from ..common_fs import FileObj
|
|
11
11
|
from .patcher import PatchMixin, ReviewComments, Suggestion
|
|
@@ -30,8 +30,8 @@ class TidyNotification:
|
|
|
30
30
|
|
|
31
31
|
def __init__(
|
|
32
32
|
self,
|
|
33
|
-
notification_line:
|
|
34
|
-
database:
|
|
33
|
+
notification_line: tuple[str, int | str, int | str, str, str, str],
|
|
34
|
+
database: list[dict[str, str]] | None = None,
|
|
35
35
|
):
|
|
36
36
|
# logger.debug("Creating tidy note from line %s", notification_line)
|
|
37
37
|
(
|
|
@@ -78,9 +78,9 @@ class TidyNotification:
|
|
|
78
78
|
#: The source filename concerning the notification.
|
|
79
79
|
self.filename = rel_path
|
|
80
80
|
#: A `list` of lines for the code-block in the notification.
|
|
81
|
-
self.fixit_lines:
|
|
81
|
+
self.fixit_lines: list[str] = []
|
|
82
82
|
#: A list of line numbers where a suggested fix was applied.
|
|
83
|
-
self.applied_fixes:
|
|
83
|
+
self.applied_fixes: set[int] = set()
|
|
84
84
|
|
|
85
85
|
@property
|
|
86
86
|
def diagnostic_link(self) -> str:
|
|
@@ -105,7 +105,7 @@ class TidyNotification:
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
class TidyAdvice(PatchMixin):
|
|
108
|
-
def __init__(self, notes:
|
|
108
|
+
def __init__(self, notes: list[TidyNotification]) -> None:
|
|
109
109
|
#: A buffer of the applied fixes from clang-tidy
|
|
110
110
|
super().__init__()
|
|
111
111
|
self.notes = notes
|
|
@@ -174,7 +174,7 @@ class TidyAdvice(PatchMixin):
|
|
|
174
174
|
review_comments.suggestions.append(suggestion)
|
|
175
175
|
|
|
176
176
|
|
|
177
|
-
def tally_tidy_advice(files:
|
|
177
|
+
def tally_tidy_advice(files: list[FileObj]) -> int:
|
|
178
178
|
"""Returns the sum of clang-format errors"""
|
|
179
179
|
tidy_checks_failed = 0
|
|
180
180
|
for file_obj in files:
|
|
@@ -194,8 +194,8 @@ def run_clang_tidy(
|
|
|
194
194
|
checks: str,
|
|
195
195
|
lines_changed_only: int,
|
|
196
196
|
database: str,
|
|
197
|
-
extra_args:
|
|
198
|
-
db_json:
|
|
197
|
+
extra_args: list[str],
|
|
198
|
+
db_json: list[dict[str, str]] | None,
|
|
199
199
|
tidy_review: bool,
|
|
200
200
|
style: str,
|
|
201
201
|
) -> TidyAdvice:
|
|
@@ -277,7 +277,7 @@ def run_clang_tidy(
|
|
|
277
277
|
|
|
278
278
|
|
|
279
279
|
def parse_tidy_output(
|
|
280
|
-
tidy_out: str, database:
|
|
280
|
+
tidy_out: str, database: list[dict[str, str]] | None
|
|
281
281
|
) -> TidyAdvice:
|
|
282
282
|
"""Parse clang-tidy stdout.
|
|
283
283
|
|
|
@@ -300,7 +300,7 @@ def parse_tidy_output(
|
|
|
300
300
|
if " " not in diagnostic_name and "-" in diagnostic_name:
|
|
301
301
|
notification = TidyNotification(
|
|
302
302
|
cast(
|
|
303
|
-
|
|
303
|
+
tuple[str, int | str, int | str, str, str, str],
|
|
304
304
|
note_match.groups(),
|
|
305
305
|
),
|
|
306
306
|
database,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
by the clang tool's output."""
|
|
3
3
|
|
|
4
4
|
from abc import ABC
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Any
|
|
6
6
|
from pygit2 import Patch # type: ignore
|
|
7
7
|
from ..common_fs import FileObj
|
|
8
8
|
from pygit2.enums import DiffOption # type: ignore
|
|
@@ -27,7 +27,7 @@ class Suggestion:
|
|
|
27
27
|
#: The markdown comment about the suggestion.
|
|
28
28
|
self.comment: str = ""
|
|
29
29
|
|
|
30
|
-
def serialize_to_github_payload(self) ->
|
|
30
|
+
def serialize_to_github_payload(self) -> dict[str, Any]:
|
|
31
31
|
"""Serialize this object into a JSON compatible with Github's REST API."""
|
|
32
32
|
assert self.line_end > 0, "ending line number unknown"
|
|
33
33
|
from ..rest_api import COMMENT_MARKER # workaround circular import
|
|
@@ -47,9 +47,9 @@ class ReviewComments:
|
|
|
47
47
|
|
|
48
48
|
def __init__(self) -> None:
|
|
49
49
|
#: The list of actual comments
|
|
50
|
-
self.suggestions:
|
|
50
|
+
self.suggestions: list[Suggestion] = []
|
|
51
51
|
|
|
52
|
-
self.tool_total:
|
|
52
|
+
self.tool_total: dict[str, int | None] = {
|
|
53
53
|
"clang-tidy": None,
|
|
54
54
|
"clang-format": None,
|
|
55
55
|
}
|
|
@@ -62,7 +62,7 @@ class ReviewComments:
|
|
|
62
62
|
A `None` value means a review was not requested from the corresponding tool.
|
|
63
63
|
"""
|
|
64
64
|
|
|
65
|
-
self.full_patch:
|
|
65
|
+
self.full_patch: dict[str, str] = {"clang-tidy": "", "clang-format": ""}
|
|
66
66
|
"""The full patch of all the suggestions (including those that will not
|
|
67
67
|
fit within the diff)"""
|
|
68
68
|
|
|
@@ -84,9 +84,9 @@ class ReviewComments:
|
|
|
84
84
|
def serialize_to_github_payload(
|
|
85
85
|
# avoid circular imports by accepting primitive types (instead of ClangVersions)
|
|
86
86
|
self,
|
|
87
|
-
tidy_version:
|
|
88
|
-
format_version:
|
|
89
|
-
) ->
|
|
87
|
+
tidy_version: str | None,
|
|
88
|
+
format_version: str | None,
|
|
89
|
+
) -> tuple[str, list[dict[str, Any]]]:
|
|
90
90
|
"""Serialize this object into a summary and list of comments compatible
|
|
91
91
|
with Github's REST API.
|
|
92
92
|
|
|
@@ -143,7 +143,7 @@ class PatchMixin(ABC):
|
|
|
143
143
|
|
|
144
144
|
def __init__(self) -> None:
|
|
145
145
|
#: A unified diff of the applied fixes from the clang tool's output
|
|
146
|
-
self.patched:
|
|
146
|
+
self.patched: bytes | None = None
|
|
147
147
|
|
|
148
148
|
def get_suggestion_help(self, start, end) -> str:
|
|
149
149
|
"""Create helpful text about what the suggestion aims to fix.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import argparse
|
|
4
4
|
from collections import UserDict
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Any, Sequence
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class Args(UserDict):
|
|
@@ -14,7 +14,7 @@ class Args(UserDict):
|
|
|
14
14
|
#: See :std:option:`--database`.
|
|
15
15
|
database: str = ""
|
|
16
16
|
#: See :std:option:`--diff-base`.
|
|
17
|
-
diff_base:
|
|
17
|
+
diff_base: int | str | None = None
|
|
18
18
|
#: See :std:option:`--ignore-index`.
|
|
19
19
|
ignore_index: bool = False
|
|
20
20
|
#: See :std:option:`--style`.
|
|
@@ -27,7 +27,7 @@ class Args(UserDict):
|
|
|
27
27
|
#: See :std:option:`--version`.
|
|
28
28
|
version: str = ""
|
|
29
29
|
#: See :std:option:`--extensions`.
|
|
30
|
-
extensions:
|
|
30
|
+
extensions: list[str] = [
|
|
31
31
|
"c",
|
|
32
32
|
"h",
|
|
33
33
|
"C",
|
|
@@ -56,17 +56,17 @@ class Args(UserDict):
|
|
|
56
56
|
#: See :std:option:`--file-annotations`.
|
|
57
57
|
file_annotations: bool = True
|
|
58
58
|
#: See :std:option:`--extra-arg`.
|
|
59
|
-
extra_arg:
|
|
59
|
+
extra_arg: list[str] = []
|
|
60
60
|
#: See :std:option:`--no-lgtm`.
|
|
61
61
|
no_lgtm: bool = True
|
|
62
62
|
#: See :std:option:`files`.
|
|
63
|
-
files:
|
|
63
|
+
files: list[str] = []
|
|
64
64
|
#: See :std:option:`--tidy-review`.
|
|
65
65
|
tidy_review: bool = False
|
|
66
66
|
#: See :std:option:`--format-review`.
|
|
67
67
|
format_review: bool = False
|
|
68
68
|
#: See :std:option:`--jobs`.
|
|
69
|
-
jobs:
|
|
69
|
+
jobs: int | None = 1
|
|
70
70
|
#: See :std:option:`--ignore-tidy`.
|
|
71
71
|
ignore_tidy: str = ""
|
|
72
72
|
#: See :std:option:`--ignore-format`.
|
|
@@ -74,10 +74,10 @@ class Args(UserDict):
|
|
|
74
74
|
#: See :std:option:`--passive-reviews`.
|
|
75
75
|
passive_reviews: bool = False
|
|
76
76
|
#: A subcommand if provided
|
|
77
|
-
command:
|
|
77
|
+
command: str | None = None
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
_parser_args:
|
|
80
|
+
_parser_args: dict[Sequence[str], Any] = {}
|
|
81
81
|
_parser_args[("-v", "--verbosity")] = dict(
|
|
82
82
|
type=lambda a: a.lower() in ["debug", "10"],
|
|
83
83
|
default="info",
|
|
@@ -388,7 +388,7 @@ reviews from requesting or approving changes.""",
|
|
|
388
388
|
)
|
|
389
389
|
|
|
390
390
|
|
|
391
|
-
def _parse_jobs(val: str) ->
|
|
391
|
+
def _parse_jobs(val: str) -> int | None:
|
|
392
392
|
try:
|
|
393
393
|
jobs = int(val)
|
|
394
394
|
except ValueError as exc:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from os import environ
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
import time
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import Any, TYPE_CHECKING
|
|
5
5
|
from pygit2 import DiffHunk # type: ignore
|
|
6
6
|
from ..loggers import logger
|
|
7
7
|
|
|
@@ -28,32 +28,32 @@ class FileObj:
|
|
|
28
28
|
def __init__(
|
|
29
29
|
self,
|
|
30
30
|
name: str,
|
|
31
|
-
additions:
|
|
32
|
-
diff_chunks:
|
|
31
|
+
additions: list[int] | None = None,
|
|
32
|
+
diff_chunks: list[list[int]] | None = None,
|
|
33
33
|
):
|
|
34
34
|
self.name: str = name #: The file name
|
|
35
|
-
self.additions:
|
|
35
|
+
self.additions: list[int] = additions or []
|
|
36
36
|
"""A list of line numbers that contain added changes. This will be empty if
|
|
37
37
|
not focusing on lines changed only."""
|
|
38
|
-
self.diff_chunks:
|
|
38
|
+
self.diff_chunks: list[list[int]] = diff_chunks or []
|
|
39
39
|
"""A list of line numbers that define the beginning and ending of hunks in the
|
|
40
40
|
diff. This will be empty if not focusing on lines changed only."""
|
|
41
|
-
self.lines_added:
|
|
41
|
+
self.lines_added: list[list[int]] = FileObj._consolidate_list_to_ranges(
|
|
42
42
|
additions or []
|
|
43
43
|
)
|
|
44
44
|
"""A list of line numbers that define the beginning and ending of ranges that
|
|
45
45
|
have added changes. This will be empty if not focusing on lines changed only.
|
|
46
46
|
"""
|
|
47
47
|
#: The results from clang-tidy
|
|
48
|
-
self.tidy_advice:
|
|
48
|
+
self.tidy_advice: "TidyAdvice" | None = None
|
|
49
49
|
#: The results from clang-format
|
|
50
|
-
self.format_advice:
|
|
50
|
+
self.format_advice: "FormatAdvice" | None = None
|
|
51
51
|
|
|
52
52
|
def __repr__(self) -> str:
|
|
53
53
|
return f"<FileObj {self.name} added:{self.additions} chunks:{self.diff_chunks}>"
|
|
54
54
|
|
|
55
55
|
@staticmethod
|
|
56
|
-
def _consolidate_list_to_ranges(numbers:
|
|
56
|
+
def _consolidate_list_to_ranges(numbers: list[int]) -> list[list[int]]:
|
|
57
57
|
"""A helper function that is only used after parsing the lines from a diff that
|
|
58
58
|
contain additions.
|
|
59
59
|
|
|
@@ -62,7 +62,7 @@ class FileObj:
|
|
|
62
62
|
:returns: A consolidated sequence of lists. Each list will have 2 items
|
|
63
63
|
describing the starting and ending lines of all line ``numbers``.
|
|
64
64
|
"""
|
|
65
|
-
result:
|
|
65
|
+
result: list[list[int]] = []
|
|
66
66
|
for i, n in enumerate(numbers):
|
|
67
67
|
if not i:
|
|
68
68
|
result.append([n])
|
|
@@ -75,7 +75,7 @@ class FileObj:
|
|
|
75
75
|
|
|
76
76
|
def range_of_changed_lines(
|
|
77
77
|
self, lines_changed_only: int, get_ranges: bool = False
|
|
78
|
-
) ->
|
|
78
|
+
) -> list[int] | list[list[int]]:
|
|
79
79
|
"""Assemble a list of lines changed.
|
|
80
80
|
|
|
81
81
|
:param lines_changed_only: A flag to indicate the focus of certain lines.
|
|
@@ -100,7 +100,7 @@ class FileObj:
|
|
|
100
100
|
# we return an empty list (instead of None) here so we can still iterate it
|
|
101
101
|
return [] # type: ignore[return-value]
|
|
102
102
|
|
|
103
|
-
def serialize(self) ->
|
|
103
|
+
def serialize(self) -> dict[str, Any]:
|
|
104
104
|
"""For easy debugging, use this method to serialize the `FileObj` into a json
|
|
105
105
|
compatible `dict`."""
|
|
106
106
|
return {
|
|
@@ -111,7 +111,7 @@ class FileObj:
|
|
|
111
111
|
},
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
def is_hunk_contained(self, hunk: DiffHunk) ->
|
|
114
|
+
def is_hunk_contained(self, hunk: DiffHunk) -> tuple[int, int] | None:
|
|
115
115
|
"""Does a given ``hunk`` start and end within a single diff hunk?
|
|
116
116
|
|
|
117
117
|
This also includes some compensations for hunk headers that are oddly formed.
|
|
@@ -134,7 +134,7 @@ class FileObj:
|
|
|
134
134
|
end = start
|
|
135
135
|
return self.is_range_contained(start, end)
|
|
136
136
|
|
|
137
|
-
def is_range_contained(self, start: int, end: int) ->
|
|
137
|
+
def is_range_contained(self, start: int, end: int) -> tuple[int, int] | None:
|
|
138
138
|
"""Does the given ``start`` and ``end`` line numbers fit within a single diff
|
|
139
139
|
hunk?
|
|
140
140
|
|
|
@@ -172,7 +172,7 @@ class FileObj:
|
|
|
172
172
|
"""
|
|
173
173
|
contents = b""
|
|
174
174
|
success = False
|
|
175
|
-
exception:
|
|
175
|
+
exception: OSError | FileIOTimeout = FileIOTimeout(
|
|
176
176
|
f"Failed to read from file '{self.name}' within "
|
|
177
177
|
+ f"{round(timeout_ns / 1_000_000_000, 2)} seconds"
|
|
178
178
|
)
|
|
@@ -194,7 +194,7 @@ class FileObj:
|
|
|
194
194
|
|
|
195
195
|
def read_write_with_timeout(
|
|
196
196
|
self,
|
|
197
|
-
data:
|
|
197
|
+
data: bytes | bytearray,
|
|
198
198
|
timeout_ns: int = 1_000_000_000,
|
|
199
199
|
) -> bytes:
|
|
200
200
|
"""Read then write the entire file's contents.
|
|
@@ -210,7 +210,7 @@ class FileObj:
|
|
|
210
210
|
:raises OSError: When the file could not be opened due to an `OSError`.
|
|
211
211
|
"""
|
|
212
212
|
success = False
|
|
213
|
-
exception:
|
|
213
|
+
exception: OSError | FileIOTimeout = FileIOTimeout(
|
|
214
214
|
f"Failed to read then write file '{self.name}' within "
|
|
215
215
|
+ f"{round(timeout_ns / 1_000_000_000, 2)} seconds"
|
|
216
216
|
)
|
|
@@ -245,7 +245,7 @@ class FileIOTimeout(Exception):
|
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
def has_line_changes(
|
|
248
|
-
lines_changed_only: int, diff_chunks:
|
|
248
|
+
lines_changed_only: int, diff_chunks: list[list[int]], additions: list[int]
|
|
249
249
|
) -> bool:
|
|
250
250
|
"""Does this file actually apply to condition specified by ``lines_changed_only``?
|
|
251
251
|
|
|
@@ -265,7 +265,7 @@ def has_line_changes(
|
|
|
265
265
|
)
|
|
266
266
|
|
|
267
267
|
|
|
268
|
-
def get_line_cnt_from_cols(data: bytes, offset: int) ->
|
|
268
|
+
def get_line_cnt_from_cols(data: bytes, offset: int) -> tuple[int, int]:
|
|
269
269
|
"""Gets a line count and columns offset from a file's absolute offset.
|
|
270
270
|
|
|
271
271
|
:param data: Bytes content to analyze.
|