Skip to content
Merged
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
23 changes: 12 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,23 @@ jobs:
script: |
set -euo pipefail

echo '::group::Setup environment'
CONDA_PATH=$(which conda)
eval "$(${CONDA_PATH} shell.bash hook)"
conda create --name ci --quiet --yes -c conda-forge python=3.11 ncurses=5 libgcc
conda activate ci
export LD_LIBRARY_PATH="${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH}"
echo '::endgroup::'

echo '::group::Install lint tools'
curl https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/clang-format-linux64 -o ./clang-format
chmod +x ./clang-format
# Install clang-format via package manager (more reliable than binary download)
if command -v apt-get &> /dev/null; then
apt-get update && apt-get install -y clang-format
elif command -v yum &> /dev/null; then
yum install -y clang-tools-extra
elif command -v dnf &> /dev/null; then
dnf install -y clang-tools-extra
else
echo "No supported package manager found"
exit 1
fi
echo '::endgroup::'

echo '::group::Lint C source'
set +e
./.github/unittest/linux/scripts/run-clang-format.py -r torchrl/csrc --clang-format-executable ./clang-format
python3 ./.github/unittest/linux/scripts/run-clang-format.py -r torchrl/csrc --clang-format-executable clang-format

if [ $? -ne 0 ]; then
git --no-pager diff
Expand Down
3 changes: 1 addition & 2 deletions torchrl/csrc/segment_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ class SegmentTree {
public:
SegmentTree(int64_t size, const T& identity_element)
: size_(size), identity_element_(identity_element) {
for (capacity_ = 1; capacity_ <= size; capacity_ <<= 1)
;
for (capacity_ = 1; capacity_ <= size; capacity_ <<= 1);
values_.assign(2 * capacity_, identity_element_);
}

Expand Down
Loading