Skip to content

Commit aaedbdd

Browse files
committed
Adopt clang-tidy support from @score_cpp_policies
1 parent 2833f5d commit aaedbdd

9 files changed

Lines changed: 1285 additions & 24 deletions

File tree

.bazelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ coverage --combined_report=lcov
8282
coverage --test_env=COVERAGE_GCOV_OPTIONS=-bcu
8383
coverage --features=coverage
8484
coverage --cache_test_results=no
85+
86+
# Clang-tidy: bazel test --config=clang-tidy //...
87+
test:clang-tidy --aspects=//tools/lint:linters.bzl%clang_tidy_aspect
88+
test:clang-tidy --output_groups=+rules_lint_report
89+
test:clang-tidy --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux
90+
test:clang-tidy --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu

.clang-tidy

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
# Clang-tidy configuration for score_logging.
15+
Checks: >
16+
-*, clang-analyzer-*, cert-*, cppcoreguidelines-*, bugprone-*, misc-*, performance-*, readability-*, modernize-* #magic___^_^___line
17+
WarningsAsErrors: >
18+
clang-analyzer-*, #magic___^_^___line
19+
HeaderFilterRegex: '^(?!.*/third_party/).*'
20+
21+
FormatStyle: file

.github/workflows/clang_tidy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
name: Clang-Tidy
15+
16+
on:
17+
pull_request:
18+
types: [opened, reopened, synchronize]
19+
merge_group:
20+
21+
jobs:
22+
clang-tidy:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Setup Bazel
27+
uses: bazel-contrib/setup-bazel@0.15.0
28+
with:
29+
bazelisk-version: 1.26.0
30+
- name: Run clang-tidy
31+
run: bazel test --config=clang-tidy --lockfile_mode=error //score/...

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ use_format_targets()
4242

4343
exports_files([
4444
"MODULE.bazel",
45+
".clang-tidy",
4546
])
4647

4748
# Creates all documentation targets:

MODULE.bazel

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ bazel_dep(name = "bazel_skylib", version = "1.7.1")
2222
bazel_dep(name = "rules_rust", version = "0.61.0")
2323
bazel_dep(name = "rules_cc", version = "0.1.1")
2424
bazel_dep(name = "aspect_rules_lint", version = "1.0.3")
25+
26+
bazel_dep(name = "score_cpp_policies", version = "0.0.0", dev_dependency = True)
27+
git_override(
28+
module_name = "score_cpp_policies",
29+
commit = "87b5b33dea15ff2e2dde1b0aae9cb982f49bc277",
30+
remote = "https://github.com/RSingh1511/score_cpp_policies.git",
31+
)
32+
33+
bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True)
34+
2535
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")
2636
bazel_dep(name = "platforms", version = "1.0.0")
2737

@@ -80,6 +90,16 @@ use_repo(
8090
"score_qcc_x86_64_toolchain",
8191
)
8292

93+
llvm = use_extension(
94+
"@toolchains_llvm//toolchain/extensions:llvm.bzl",
95+
"llvm",
96+
dev_dependency = True,
97+
)
98+
llvm.toolchain(
99+
llvm_version = "19.1.7",
100+
)
101+
use_repo(llvm, "llvm_toolchain")
102+
83103
PYTHON_VERSION = "3.12"
84104

85105
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)

0 commit comments

Comments
 (0)