diff options
author | alevitskii <alevitskii@yandex-team.com> | 2025-01-28 20:00:55 +0300 |
---|---|---|
committer | alevitskii <alevitskii@yandex-team.com> | 2025-01-28 20:51:05 +0300 |
commit | ac85ae8ff578036879ca10a1e64a47a743dbd1ae (patch) | |
tree | 7bc5ee87b45fe38a90056569c427a715dcdf9aaf | |
parent | 6ee13b3691ee2cd77086f8a8ce9d0597a23f35fb (diff) | |
download | ydb-ac85ae8ff578036879ca10a1e64a47a743dbd1ae.tar.gz |
Add STYLE_CPP_YT macro
Add STYLE_CPP_YT macro
commit_hash:c4992f91380e90a2ac148594c648b5a4cd1b3a10
-rw-r--r-- | build/plugins/_dart_fields.py | 8 | ||||
-rw-r--r-- | tools/cpp_style_checker/__main__.py | 7 | ||||
-rw-r--r-- | tools/cpp_style_checker/ya.make | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/build/plugins/_dart_fields.py b/build/plugins/_dart_fields.py index d7d0fa5737..49c49f345f 100644 --- a/build/plugins/_dart_fields.py +++ b/build/plugins/_dart_fields.py @@ -662,6 +662,8 @@ class LintConfigs: class LintExtraParams: KEY = 'LINT-EXTRA-PARAMS' + _CUSTOM_CLANG_FORMAT_BIN_ALLOWED_PATHS = ('ads', 'bigrt', 'grut') + @classmethod def from_macro_args(cls, unit, flat_args, spec_args): extra_params = spec_args.get('EXTRA_PARAMS', []) @@ -670,6 +672,12 @@ class LintExtraParams: message = 'Wrong EXTRA_PARAMS value: "{}". Values must have format "name=value".'.format(arg) ymake.report_configure_error(message) raise DartValueError() + if 'clang_format_bin' in arg: + upath = unit.path()[3:] + if not upath.startswith(cls._CUSTOM_CLANG_FORMAT_BIN_ALLOWED_PATHS): + message = f'Custom clang-format is not allowed in upath: {upath}' + ymake.report_configure_error(message) + raise DartValueError() return {cls.KEY: serialize_list(extra_params)} diff --git a/tools/cpp_style_checker/__main__.py b/tools/cpp_style_checker/__main__.py index abaa32ee19..ab8534a0ad 100644 --- a/tools/cpp_style_checker/__main__.py +++ b/tools/cpp_style_checker/__main__.py @@ -13,7 +13,12 @@ from library.python.testing.style import rules def main(): params = linter_params.get_params() - clang_format_binary = os.path.join(params.global_resources[CLANG_FORMAT_RESOURCE], 'clang-format') + if 'clang_format_bin' in params.extra_params: + # custom clang-format + clang_format_binary = params.depends[params.extra_params['clang_format_bin']] + else: + clang_format_binary = os.path.join(params.global_resources[CLANG_FORMAT_RESOURCE], 'clang-format') + style_config_path = params.configs[0] with open(style_config_path) as f: diff --git a/tools/cpp_style_checker/ya.make b/tools/cpp_style_checker/ya.make index 35b32a9eaf..e762be1a1f 100644 --- a/tools/cpp_style_checker/ya.make +++ b/tools/cpp_style_checker/ya.make @@ -11,4 +11,6 @@ PY_SRCS( __main__.py ) +STYLE_PYTHON() + END() |