diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-24 21:08:37 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-03-24 21:08:37 +0300 |
commit | 6985cc4bc61ea68b9fcf5783486fd1d6b897a305 (patch) | |
tree | 5a3ff58ea5b6f117f841885d2f822f5c5d1ad1d9 | |
parent | 9af817fd1c586794f68b118236da5b42a74f66e4 (diff) | |
download | ydb-6985cc4bc61ea68b9fcf5783486fd1d6b897a305.tar.gz |
intermediate changes
ref:12e4bb60d22b39f59691a28f7163b60cc32d9823
-rw-r--r-- | build/plugins/ytest.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py index 00b3458a0b..b9cb87c544 100644 --- a/build/plugins/ytest.py +++ b/build/plugins/ytest.py @@ -378,20 +378,22 @@ def match_coverage_extractor_requirements(unit): ]) -def get_tidy_config_map(unit): - global tidy_config_map - if tidy_config_map is None: - config_map_path = unit.resolve(os.path.join("$S", PROJECT_TIDY_CONFIG_MAP_PATH)) +def get_tidy_config_map(unit, map_path): + config_map_path = unit.resolve(os.path.join("$S", map_path)) + config_map = {} + try: with open(config_map_path, 'r') as afile: - tidy_config_map = json.load(afile) - return tidy_config_map + config_map = json.load(afile) + except ValueError: + ymake.report_configure_error("{} is invalid json".format(map_path)) + except Exception as e: + ymake.report_configure_error(str(e)) + return config_map def get_default_tidy_config(unit): unit_path = get_norm_unit_path(unit) - default_config_map_path = unit.resolve(os.path.join("$S", DEFAULT_TIDY_CONFIG_MAP_PATH)) - with open(default_config_map_path, 'r') as afile: - tidy_default_config_map = json.load(afile) + tidy_default_config_map = get_tidy_config_map(unit, DEFAULT_TIDY_CONFIG_MAP_PATH) for project_prefix, config_path in tidy_default_config_map.items(): if unit_path.startswith(project_prefix): return config_path @@ -399,7 +401,7 @@ def get_default_tidy_config(unit): def get_project_tidy_config(unit): - tidy_map = get_tidy_config_map(unit) + tidy_map = get_tidy_config_map(unit, PROJECT_TIDY_CONFIG_MAP_PATH) unit_path = get_norm_unit_path(unit) for project_prefix, config_path in tidy_map.items(): |