Skip to content
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

Use clang-tidy action to push comments to the PR. #2280

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/clang-tidy-post-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Post clang-tidy review comments

on:
workflow_run:
# The name field of the lint action .github/workflows/clang-tidy-run.yml
workflows: ["clang-tidy-review"]
types:
- completed

jobs:
PostClangTidyComments:
runs-on: ubuntu-latest
steps:
- uses: ZedThree/clang-tidy-review/[email protected]
42 changes: 42 additions & 0 deletions .github/workflows/clang-tidy-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: clang-tidy-review

on:
pull_request:

jobs:
RunClangTidy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create Cache Timestamp
id: cache_timestamp
uses: nanzm/[email protected]
with:
format: 'YYYY-MM-DD-HH-mm-ss'

- name: Retrieve cached results
uses: actions/cache@v3
with:
path: |
/root/.cache/clang-tidy
/root/.cache/bazel
key: clang-tidy-${{ steps.cache_timestamp.outputs.time }}
restore-keys: clang-tidy-

- name: Make compilation DB
run: |
export USE_BAZEL_VERSION=6.5.0
.github/bin/make-compilation-db.sh

- name: Create clang-tidy review
uses: ZedThree/[email protected]
with:
split_workflow: true # Post comments separately
clang_tidy_version: 17
config_file: .clang-tidy

- uses: ZedThree/clang-tidy-review/[email protected]
3 changes: 3 additions & 0 deletions common/strings/obfuscator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ std::string Obfuscator::save() const {
absl::Status Obfuscator::load(absl::string_view mapping) {
const std::vector<absl::string_view> lines =
absl::StrSplit(mapping, '\n', absl::SkipEmpty());
// testing clang-tidy
BijectiveMap<std::string, std::string, StringViewCompare, StringViewCompare>
footesting;
for (const auto &line : lines) {
const std::vector<absl::string_view> elements =
absl::StrSplit(absl::StripAsciiWhitespace(line), kPairSeparator);
Expand Down
Loading