diff options
author | alevitskii <alevitskii@yandex-team.com> | 2024-11-20 09:22:19 +0300 |
---|---|---|
committer | alevitskii <alevitskii@yandex-team.com> | 2024-11-20 09:33:33 +0300 |
commit | 2d3e35f925595c445a0ff7405eda6c5ed162ab98 (patch) | |
tree | ba0e3192f22e2633345b2a3df4105282215ef435 | |
parent | 1f50694cfb5c440be984de5cae781b8d5948fea6 (diff) | |
download | ydb-2d3e35f925595c445a0ff7405eda6c5ed162ab98.tar.gz |
Use clang-format resource in style cpp linter
Use clang-format resouce in style cpp linter
commit_hash:440dce939163f75f5652a9d119a2d5f064e47e6e
-rw-r--r-- | build/platform/clang/clang-format/clang-format16.json | 19 | ||||
-rw-r--r-- | build/platform/clang/clang-format/ya.make | 7 | ||||
-rw-r--r-- | build/plugins/lib/test_const/__init__.py | 1 | ||||
-rw-r--r-- | build/ymake.core.conf | 4 | ||||
-rw-r--r-- | tools/cpp_style_checker/__main__.py | 4 | ||||
-rw-r--r-- | tools/cpp_style_checker/ya.make | 1 |
6 files changed, 33 insertions, 3 deletions
diff --git a/build/platform/clang/clang-format/clang-format16.json b/build/platform/clang/clang-format/clang-format16.json new file mode 100644 index 0000000000..0f98362164 --- /dev/null +++ b/build/platform/clang/clang-format/clang-format16.json @@ -0,0 +1,19 @@ +{ + "by_platform": { + "darwin": { + "uri": "sbr:7402815718" + }, + "darwin-arm64": { + "uri": "sbr:7402814010" + }, + "linux": { + "uri": "sbr:7402818343" + }, + "linux-aarch64": { + "uri": "sbr:7402817039" + }, + "win32-clang-cl": { + "uri": "sbr:7402812744" + } + } +} diff --git a/build/platform/clang/clang-format/ya.make b/build/platform/clang/clang-format/ya.make new file mode 100644 index 0000000000..22a8e6e5c3 --- /dev/null +++ b/build/platform/clang/clang-format/ya.make @@ -0,0 +1,7 @@ +RESOURCES_LIBRARY() + +# Note: the json below is also referred from build/ya.conf.json, +# please change these references consistently +DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(CLANG_FORMAT clang-format16.json) + +END() diff --git a/build/plugins/lib/test_const/__init__.py b/build/plugins/lib/test_const/__init__.py index 175900994f..9e4648d9b1 100644 --- a/build/plugins/lib/test_const/__init__.py +++ b/build/plugins/lib/test_const/__init__.py @@ -184,6 +184,7 @@ JSTYLE_RUNNER_LIB = 'JSTYLE_LIB_RESOURCE_GLOBAL' NODEJS_RESOURCE = 'NODEJS_RESOURCE_GLOBAL' NYC_RESOURCE = 'NYC_RESOURCE_GLOBAL' RUFF_RESOURCE = 'RUFF_RESOURCE_GLOBAL' +CLANG_FORMAT_RESOURCE = 'CLANG_FORMAT_RESOURCE_GLOBAL' # test_tool resource for host platform. # source - build/platform/test_tool/host.ya.make.inc. diff --git a/build/ymake.core.conf b/build/ymake.core.conf index a6e0b718b5..ac9fcd1593 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -5839,7 +5839,7 @@ macro YA_CONF_JSON(File) { ### ### Proxy. Don't use. Call _ADD_CPP_LINTER_CHECK directly if you need a new macro, see STYLE_CPP macro _STYLE_CPP(CONFIG...) { - _ADD_CPP_LINTER_CHECK(NAME clang_format LINTER tools/cpp_style_checker/cpp_style_checker DEPENDS contrib/libs/clang16/tools/clang-format CONFIGS $CPP_LINTERS_DEFAULT_CONFIGS CUSTOM_CONFIG $CONFIG) + _ADD_CPP_LINTER_CHECK(NAME clang_format LINTER tools/cpp_style_checker/cpp_style_checker GLOBAL_RESOURCES build/platform/clang/clang-format CONFIGS $CPP_LINTERS_DEFAULT_CONFIGS CUSTOM_CONFIG $CONFIG) } # tag:internal @@ -5858,7 +5858,7 @@ macro _ADD_CPP_LINTER_CHECK(Args...) { ### Run 'ya tool clang-format' test on all cpp sources and headers of the current module macro STYLE_CPP() { .ALLOWED_IN_COMMON=yes - _ADD_CPP_LINTER_CHECK(NAME clang_format LINTER tools/cpp_style_checker/cpp_style_checker DEPENDS contrib/libs/clang16/tools/clang-format CONFIGS $CPP_LINTERS_DEFAULT_CONFIGS) + _ADD_CPP_LINTER_CHECK(NAME clang_format LINTER tools/cpp_style_checker/cpp_style_checker GLOBAL_RESOURCES build/platform/clang/clang-format CONFIGS $CPP_LINTERS_DEFAULT_CONFIGS) } ### @usage: HEADERS(<Dirs...> [EXCLUDE patterns...]) diff --git a/tools/cpp_style_checker/__main__.py b/tools/cpp_style_checker/__main__.py index f318bb4417..abaa32ee19 100644 --- a/tools/cpp_style_checker/__main__.py +++ b/tools/cpp_style_checker/__main__.py @@ -1,9 +1,11 @@ import difflib import json +import os import subprocess import time import yaml +from build.plugins.lib.test_const import CLANG_FORMAT_RESOURCE from library.python.testing.custom_linter_util import linter_params, reporter from library.python.testing.style import rules @@ -11,7 +13,7 @@ from library.python.testing.style import rules def main(): params = linter_params.get_params() - clang_format_binary = params.depends["contrib/libs/clang16/tools/clang-format/clang-format"] + 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 b25a270045..35b32a9eaf 100644 --- a/tools/cpp_style_checker/ya.make +++ b/tools/cpp_style_checker/ya.make @@ -1,6 +1,7 @@ PY3_PROGRAM() PEERDIR( + build/plugins/lib/test_const contrib/python/PyYAML library/python/testing/custom_linter_util library/python/testing/style |