Skip to content

Commit 7b74a9b

Browse files
authored
[CI] fix C lint (#3129)
1 parent 0e53506 commit 7b74a9b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

.github/workflows/lint.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,23 @@ jobs:
5555
script: |
5656
set -euo pipefail
5757
58-
echo '::group::Setup environment'
59-
CONDA_PATH=$(which conda)
60-
eval "$(${CONDA_PATH} shell.bash hook)"
61-
conda create --name ci --quiet --yes -c conda-forge python=3.11 ncurses=5 libgcc
62-
conda activate ci
63-
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
64-
echo '::endgroup::'
65-
6658
echo '::group::Install lint tools'
67-
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o ./clang-format
68-
chmod +x ./clang-format
59+
# Install clang-format via package manager (more reliable than binary download)
60+
if command -v apt-get &> /dev/null; then
61+
apt-get update && apt-get install -y clang-format
62+
elif command -v yum &> /dev/null; then
63+
yum install -y clang-tools-extra
64+
elif command -v dnf &> /dev/null; then
65+
dnf install -y clang-tools-extra
66+
else
67+
echo "No supported package manager found"
68+
exit 1
69+
fi
6970
echo '::endgroup::'
7071
7172
echo '::group::Lint C source'
7273
set +e
73-
./.github/unittest/linux/scripts/run-clang-format.py -r torchrl/csrc --clang-format-executable ./clang-format
74+
python3 ./.github/unittest/linux/scripts/run-clang-format.py -r torchrl/csrc --clang-format-executable clang-format
7475
7576
if [ $? -ne 0 ]; then
7677
git --no-pager diff

torchrl/csrc/segment_tree.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class SegmentTree {
4343
public:
4444
SegmentTree(int64_t size, const T& identity_element)
4545
: size_(size), identity_element_(identity_element) {
46-
for (capacity_ = 1; capacity_ <= size; capacity_ <<= 1)
47-
;
46+
for (capacity_ = 1; capacity_ <= size; capacity_ <<= 1);
4847
values_.assign(2 * capacity_, identity_element_);
4948
}
5049

0 commit comments

Comments
 (0)