Skip to content

Commit 76e1c86

Browse files
authored
upgrade dependency and fix clang-tidy error (#229)
1 parent 1f1c12f commit 76e1c86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+138
-163
lines changed

.clang-tidy

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,15 @@ Checks: '
2020
performance-*,
2121
portability-*,
2222
readability-*,
23-
-clang-diagnostic-delete-non-abstract-non-virtual-dtor,
24-
-google-runtime-references,
25-
-modernize-use-trailing-return-type,
26-
-readability-magic-numbers,
27-
-readability-static-accessed-through-instance,
28-
-readability-uppercase-literal-suffix,
2923
-bugprone-easily-swappable-parameters,
3024
-bugprone-implicit-widening-of-multiplication-result,
3125
-bugprone-narrowing-conversions,
32-
-google-readability-casting,
33-
-modernize-return-braced-init-list,
34-
-modernize-use-default-member-init,
35-
-performance-no-int-to-ptr,
26+
-modernize-use-trailing-return-type,
3627
-readability-function-cognitive-complexity,
3728
-readability-identifier-length,
38-
-readability-redundant-smartptr-get,
39-
-readability-simplify-boolean-expr,
29+
-readability-magic-numbers,
30+
-readability-static-accessed-through-instance,
31+
-readability-uppercase-literal-suffix,
4032
'
4133
CheckOptions:
4234
- { key: readability-identifier-naming.ClassCase, value: CamelCase }

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
release:
1111
runs-on: ubuntu-latest
12-
container: trinkle23897/envpool-release:2022-12-28-e857ca2
12+
container: trinkle23897/envpool-release:2022-12-29-03c3d95
1313
strategy:
1414
matrix:
1515
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cpplint-install:
3232
$(call check_install, cpplint)
3333

3434
clang-format-install:
35-
command -v clang-format-11 || sudo apt-get install -y clang-format-11
35+
command -v clang-format || sudo apt-get install -y clang-format
3636

3737
clang-tidy-install:
3838
command -v clang-tidy || sudo apt-get install -y clang-tidy
@@ -77,7 +77,7 @@ cpplint: cpplint-install
7777
cpplint $(CPP_FILES)
7878

7979
clang-format: clang-format-install
80-
clang-format-11 --style=file -i $(CPP_FILES) -n --Werror
80+
clang-format --style=file -i $(CPP_FILES) -n --Werror
8181

8282
# bazel file linter
8383

@@ -87,10 +87,10 @@ buildifier: buildifier-install
8787
# bazel build/test
8888

8989
bazel-pip-requirement-dev:
90-
cp third_party/pip_requirements/requirements-dev.txt third_party/pip_requirements/requirements.txt
90+
cd third_party/pip_requirements && (cmp requirements.txt requirements-dev.txt || ln -sf requirements-dev.txt requirements.txt)
9191

9292
bazel-pip-requirement-release:
93-
cp third_party/pip_requirements/requirements-release.txt third_party/pip_requirements/requirements.txt
93+
cd third_party/pip_requirements && (cmp requirements.txt requirements-release.txt || ln -sf requirements-release.txt requirements.txt)
9494

9595
clang-tidy: clang-tidy-install bazel-pip-requirement-dev
9696
bazel build $(BAZELOPT) //... --config=clang-tidy --config=test
@@ -142,7 +142,7 @@ lint: buildifier flake8 py-format clang-format cpplint clang-tidy mypy docstyle
142142
format: py-format-install clang-format-install buildifier-install addlicense-install
143143
isort $(PYTHON_FILES)
144144
yapf -ir $(PYTHON_FILES)
145-
clang-format-11 -style=file -i $(CPP_FILES)
145+
clang-format -style=file -i $(CPP_FILES)
146146
buildifier -r -lint=fix $(BAZEL_FILES)
147147
addlicense -c $(COPYRIGHT) -l apache -y 2023 $(PROJECT_FOLDER)
148148

@@ -157,16 +157,16 @@ docker-ci-push: docker-ci
157157
docker push $(DOCKER_USER)/$(PROJECT_NAME):$(DOCKER_TAG)
158158

159159
docker-ci-launch: docker-ci
160-
docker run --network=host -v /home/ubuntu:/home/github-action -it $(PROJECT_NAME):$(DOCKER_TAG) bash
160+
docker run --network=host -v /home/ubuntu:/home/github-action --shm-size=4gb -it $(PROJECT_NAME):$(DOCKER_TAG) bash
161161

162162
docker-dev: docker-ci
163-
docker run --network=host -v /:/host -it $(PROJECT_NAME):$(DOCKER_TAG) bash
163+
docker run --network=host -v /:/host --shm-size=4gb -it $(PROJECT_NAME):$(DOCKER_TAG) bash
164164

165165
# for mainland China
166166
docker-dev-cn:
167167
docker build --network=host -t $(PROJECT_NAME):$(DOCKER_TAG) -f docker/dev-cn.dockerfile .
168168
echo successfully build docker image with tag $(PROJECT_NAME):$(DOCKER_TAG)
169-
docker run --network=host -v /:/host -it $(PROJECT_NAME):$(DOCKER_TAG) bash
169+
docker run --network=host -v /:/host --shm-size=4gb -it $(PROJECT_NAME):$(DOCKER_TAG) bash
170170

171171
docker-release:
172172
docker build --network=host -t $(PROJECT_NAME)-release:$(DOCKER_TAG) -f docker/release.dockerfile .
@@ -177,7 +177,7 @@ docker-release-push: docker-release
177177
docker push $(DOCKER_USER)/$(PROJECT_NAME)-release:$(DOCKER_TAG)
178178

179179
docker-release-launch: docker-release
180-
docker run --network=host -v /:/host -it $(PROJECT_NAME)-release:$(DOCKER_TAG) bash
180+
docker run --network=host -v /:/host --shm-size=4gb -it $(PROJECT_NAME)-release:$(DOCKER_TAG) bash
181181

182182
pypi-wheel: auditwheel-install bazel-release
183183
ls dist/*.whl -Art | tail -n 1 | xargs auditwheel repair --plat manylinux_2_17_x86_64

docker/dev-cn.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ARG HOME=/root
77
ARG PATH=$PATH:$HOME/go/bin
88

99
RUN apt-get update \
10-
&& apt-get install -y python3-pip python3-dev golang-1.18 clang-format-11 git wget swig tmux clang-tidy \
10+
&& apt-get install -y python3-pip python3-dev golang-1.18 clang-format-11 git wget swig tmux clang-tidy vim \
1111
&& rm -rf /var/lib/apt/lists/*
1212
RUN ln -s /usr/bin/python3 /usr/bin/python
1313
RUN ln -sf /usr/lib/go-1.18/bin/go /usr/bin/go

docker/dev.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ARG HOME=/root
77
ARG PATH=$PATH:$HOME/go/bin
88

99
RUN apt-get update \
10-
&& apt-get install -y python3-pip python3-dev golang-1.18 clang-format-11 git wget swig tmux clang-tidy \
10+
&& apt-get install -y python3-pip python3-dev golang-1.18 clang-format-11 git wget swig tmux clang-tidy vim \
1111
&& rm -rf /var/lib/apt/lists/*
1212
RUN ln -s /usr/bin/python3 /usr/bin/python
1313
RUN ln -sf /usr/lib/go-1.18/bin/go /usr/bin/go

envpool/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
register,
2525
)
2626

27-
__version__ = "0.6.7"
27+
__version__ = "0.7.0"
2828
__all__ = [
2929
"register",
3030
"make",

envpool/atari/atari_env.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232

3333
namespace atari {
3434

35-
bool TurnOffVerbosity() {
35+
auto TurnOffVerbosity() {
3636
ale::Logger::setMode(ale::Logger::Error);
3737
return true;
3838
}
3939

4040
static bool verbosity_off = TurnOffVerbosity();
4141

42-
std::string GetRomPath(const std::string& base_path, const std::string& task) {
42+
auto GetRomPath(const std::string& base_path, const std::string& task) {
4343
std::stringstream ss;
4444
// hardcode path here :(
4545
ss << base_path << "/atari/roms/" << task << ".bin";
@@ -88,9 +88,9 @@ class AtariEnv : public Env<AtariEnvSpec> {
8888
std::unique_ptr<ale::ALEInterface> env_;
8989
ale::ActionVect action_set_;
9090
int max_episode_steps_, elapsed_step_, stack_num_, frame_skip_;
91-
bool fire_reset_, reward_clip_, zero_discount_on_life_loss_;
91+
bool fire_reset_{false}, reward_clip_, zero_discount_on_life_loss_;
9292
bool gray_scale_, episodic_life_, use_inter_area_resize_;
93-
bool done_;
93+
bool done_{true};
9494
int lives_;
9595
FrameSpec raw_spec_, resize_spec_, transpose_spec_;
9696
std::deque<Array> stack_buf_;
@@ -107,13 +107,11 @@ class AtariEnv : public Env<AtariEnvSpec> {
107107
elapsed_step_(max_episode_steps_ + 1),
108108
stack_num_(spec.config["stack_num"_]),
109109
frame_skip_(spec.config["frame_skip"_]),
110-
fire_reset_(false),
111110
reward_clip_(spec.config["reward_clip"_]),
112111
zero_discount_on_life_loss_(spec.config["zero_discount_on_life_loss"_]),
113112
gray_scale_(spec.config["gray_scale"_]),
114113
episodic_life_(spec.config["episodic_life"_]),
115114
use_inter_area_resize_(spec.config["use_inter_area_resize"_]),
116-
done_(true),
117115
raw_spec_({kRawHeight, kRawWidth, gray_scale_ ? 1 : 3}),
118116
resize_spec_({spec.config["img_height"_], spec.config["img_width"_],
119117
gray_scale_ ? 1 : 3}),

envpool/box2d/bipedal_walker_env.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ BipedalWalkerBox2dEnv::BipedalWalkerBox2dEnv(bool hardcore,
6565
: max_episode_steps_(max_episode_steps),
6666
elapsed_step_(max_episode_steps + 1),
6767
hardcore_(hardcore),
68-
done_(true),
69-
world_(new b2World(b2Vec2(0.0, -10.0))),
70-
hull_(nullptr) {
68+
world_(new b2World(b2Vec2(0.0, -10.0))) {
7169
for (const auto* p : kHullPoly) {
7270
hull_poly_.emplace_back(Vec2(p[0] / kScaleDouble, p[1] / kScaleDouble));
7371
}

envpool/box2d/bipedal_walker_env.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ class BipedalWalkerBox2dEnv {
7575
protected:
7676
int max_episode_steps_, elapsed_step_;
7777
float reward_, prev_shaping_;
78-
bool hardcore_, done_;
78+
bool hardcore_, done_{true};
7979
std::array<float, 24> obs_;
8080
// info
8181
float scroll_;
8282
std::vector<float> path2_, path4_, path5_;
8383

8484
// box2d related
8585
std::unique_ptr<b2World> world_;
86-
b2Body* hull_;
86+
b2Body* hull_{nullptr};
8787
std::vector<b2Vec2> hull_poly_;
8888
std::vector<b2Body*> terrain_;
8989
std::array<b2Body*, 4> legs_;

envpool/box2d/car_dynamics.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ b2PolygonShape GeneratePolygon(const float (*poly)[2], int size) { // NOLINT
3636

3737
Car::Car(std::shared_ptr<b2World> world, float init_angle, float init_x,
3838
float init_y)
39-
: world_(std::move(world)), hull_(nullptr), fuel_spent_(0) {
39+
: world_(std::move(world)) {
4040
// Create hull
4141
b2BodyDef bd;
4242
bd.position.Set(init_x, init_y);
@@ -186,7 +186,7 @@ void Car::Step(float dt) {
186186
} else if (w->skid_start == nullptr) {
187187
w->skid_start = std::make_unique<b2Vec2>(w->body->GetPosition());
188188
} else {
189-
w->skid_particle = CreateParticle(*(w->skid_start.get()),
189+
w->skid_particle = CreateParticle(*(w->skid_start.get()), // NOLINT
190190
w->body->GetPosition(), grass);
191191
w->skid_start = nullptr;
192192
}
@@ -264,7 +264,7 @@ void Car::Draw(const cv::Mat& surf, float zoom,
264264
cv::fillPoly(surf, poly, color);
265265

266266
auto* user_data =
267-
reinterpret_cast<UserData*>(body->GetUserData().pointer);
267+
reinterpret_cast<UserData*>(body->GetUserData().pointer); // NOLINT
268268
if (user_data == nullptr || user_data->type != WHEEL_TYPE) {
269269
continue;
270270
}

0 commit comments

Comments
 (0)