Skip to content

Commit 1048e08

Browse files
authored
Merge pull request #1221 from cyw3/main
🐛 use safe_load
2 parents 948882f + e42e408 commit 1048e08

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

client/tool/dartanalyzer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def config(self, params):
142142
os.remove(config_file)
143143
copyfile(os.path.join(envs.get("DART_HOME"), "analysis_options.yaml"), config_file)
144144
f = open(config_file)
145-
config = yaml.load(f, Loader=yaml.FullLoader)
145+
config = yaml.safe_load(f)
146146
f.close()
147147

148148
# 设置过滤

client/tool/detekt.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def config(self, params, detekt_home):
9191
if enabled_rules:
9292
copyfile(os.path.join(detekt_home, "detekt-config-example.yml"), config_file)
9393
config = open(config_file)
94-
content = yaml.load(config, Loader=yaml.FullLoader)
94+
content = yaml.safe_load(config)
9595
for item in content.values():
9696
if not isinstance(item, dict):
9797
continue
@@ -115,7 +115,7 @@ def config(self, params, detekt_home):
115115
else:
116116
# 若是配置字符串
117117
user_config = json.loads(user_plugins_config)
118-
content = yaml.load(open(config_file))
118+
content = yaml.safe_load(open(config_file))
119119
content.update(user_config)
120120
config = open(config_file, "w")
121121
# content中可能部分为unicode编码,dump时候可能会报错,这里是

client/tool/golangcilint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def config(self, params):
229229
os.remove(config_file)
230230
copyfile(os.path.join(config_home, ".golangci.example.yml"), config_file)
231231
f = open(config_file)
232-
config = yaml.load(f, Loader=yaml.FullLoader)
232+
config = yaml.safe_load(f)
233233
f.close()
234234

235235
config["linters"]["enable"] = [rule for rule in rules]

client/util/yamlib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def read_section(self, filepath, section):
7373
# print("\n[ 全量加载 ] :")
7474
# start_time = time.time()
7575
# with open(file_path, 'r', encoding='utf-8') as fp:
76-
# data = yaml.load(fp)
76+
# data = yaml.safe_load(fp)
7777
# use_time = time.time() - start_time
7878
# print("-" * 50)
7979
# print(json.dumps(data[section_name], indent=2))

0 commit comments

Comments
 (0)