Skip to content

Commit

Permalink
Merge pull request #1221 from cyw3/main
Browse files Browse the repository at this point in the history
🐛 use safe_load
  • Loading branch information
yql70 authored Feb 25, 2025
2 parents 948882f + e42e408 commit 1048e08
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/tool/dartanalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def config(self, params):
os.remove(config_file)
copyfile(os.path.join(envs.get("DART_HOME"), "analysis_options.yaml"), config_file)
f = open(config_file)
config = yaml.load(f, Loader=yaml.FullLoader)
config = yaml.safe_load(f)
f.close()

# 设置过滤
Expand Down
4 changes: 2 additions & 2 deletions client/tool/detekt.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def config(self, params, detekt_home):
if enabled_rules:
copyfile(os.path.join(detekt_home, "detekt-config-example.yml"), config_file)
config = open(config_file)
content = yaml.load(config, Loader=yaml.FullLoader)
content = yaml.safe_load(config)
for item in content.values():
if not isinstance(item, dict):
continue
Expand All @@ -115,7 +115,7 @@ def config(self, params, detekt_home):
else:
# 若是配置字符串
user_config = json.loads(user_plugins_config)
content = yaml.load(open(config_file))
content = yaml.safe_load(open(config_file))
content.update(user_config)
config = open(config_file, "w")
# content中可能部分为unicode编码,dump时候可能会报错,这里是
Expand Down
2 changes: 1 addition & 1 deletion client/tool/golangcilint.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def config(self, params):
os.remove(config_file)
copyfile(os.path.join(config_home, ".golangci.example.yml"), config_file)
f = open(config_file)
config = yaml.load(f, Loader=yaml.FullLoader)
config = yaml.safe_load(f)
f.close()

config["linters"]["enable"] = [rule for rule in rules]
Expand Down
2 changes: 1 addition & 1 deletion client/util/yamlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def read_section(self, filepath, section):
# print("\n[ 全量加载 ] :")
# start_time = time.time()
# with open(file_path, 'r', encoding='utf-8') as fp:
# data = yaml.load(fp)
# data = yaml.safe_load(fp)
# use_time = time.time() - start_time
# print("-" * 50)
# print(json.dumps(data[section_name], indent=2))
Expand Down

0 comments on commit 1048e08

Please sign in to comment.