aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorionagamed <ionagamed@yandex-team.com>2024-03-07 13:39:40 +0300
committerionagamed <ionagamed@yandex-team.com>2024-03-07 13:52:51 +0300
commit8e1f2488ae4aa7b6986a119d5df78fb0481ff41d (patch)
treef689e35dcdb15ce354d565521b8fe62c021168cc
parenta5bc35bb658487b44e707d555998bbec6cb14eab (diff)
downloadydb-8e1f2488ae4aa7b6986a119d5df78fb0481ff41d.tar.gz
add CPP_STYLE_TEST_16 ya.make macro
a494c8b69e6dec20bf56966cca5259e337905d23
-rw-r--r--build/config/tests/cpp_style/config.clang-format-1690
-rw-r--r--build/config/tests/cpp_style/ya.make1
-rw-r--r--build/ymake.core.conf6
-rw-r--r--library/python/cpp_test/test_cpp.py11
4 files changed, 105 insertions, 3 deletions
diff --git a/build/config/tests/cpp_style/config.clang-format-16 b/build/config/tests/cpp_style/config.clang-format-16
new file mode 100644
index 0000000000..3a354b63b4
--- /dev/null
+++ b/build/config/tests/cpp_style/config.clang-format-16
@@ -0,0 +1,90 @@
+Language: Cpp
+AccessModifierOffset: -4
+ConstructorInitializerIndentWidth: 4
+AlignEscapedNewlinesLeft: false
+AlignEscapedNewlines: Left
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 0
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AlwaysBreakTemplateDeclarations: true
+AlwaysBreakBeforeMultilineStrings: false
+BreakBeforeBinaryOperators: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: true
+BinPackParameters: true
+ColumnLimit: 0
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+DerivePointerAlignment: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+IndentWrappedFunctionNames: false
+IndentFunctionDeclarationAfterType: false
+MaxEmptyLinesToKeep: 1
+KeepEmptyLinesAtTheStartOfBlocks: false
+NamespaceIndentation: All
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakString: 1000
+PenaltyBreakFirstLessLess: 120
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Left
+SpacesBeforeTrailingComments: 1
+Cpp11BracedListStyle: true
+Standard: c++20
+IndentWidth: 4
+TabWidth: 4
+UseTab: Never
+BreakBeforeBraces: Attach
+
+BraceWrapping:
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: true
+
+SpacesInParentheses: false
+SpacesInAngles: false
+SpaceInEmptyParentheses: false
+SpacesInCStyleCastParentheses: false
+SpacesInContainerLiterals: true
+SpaceBeforeAssignmentOperators: true
+ContinuationIndentWidth: 4
+CommentPragmas: '^ IWYU pragma:'
+ForEachMacros: [
+ foreach,
+ Q_FOREACH,
+ BOOST_FOREACH,
+ # Is not a foreach, but correct formatting is achieved
+ Y_DEFER
+]
+IfMacros: [
+ with_lock # Is not an if, but correct formatting is achieved
+]
+SpaceBeforeParens: ControlStatements
+DisableFormat: false
+SortIncludes: false
+IndentPPDirectives: BeforeHash
+
+NamespaceMacros: [Y_UNIT_TEST_SUITE, Y_UNIT_TEST]
+SpaceBeforeInheritanceColon: false
+AttributeMacros: [Y_PRINTF_FORMAT, Y_NO_SANITIZE, Y_FORCE_INLINE, Y_NO_INLINE, Y_WARN_UNUSED_RESULT, Y_HIDDEN, Y_PUBLIC, Y_PURE_FUNCTION]
+IndentExternBlock: Indent
+TypenameMacros: [Y_THREAD, Y_STATIC_THREAD, Y_POD_THREAD, Y_POD_STATIC_THREAD]
+SpacesInLineCommentPrefix:
+ Minimum: 0
+ Maximum: -1
diff --git a/build/config/tests/cpp_style/ya.make b/build/config/tests/cpp_style/ya.make
index bb5fccd5ea..6d2fab5a83 100644
--- a/build/config/tests/cpp_style/ya.make
+++ b/build/config/tests/cpp_style/ya.make
@@ -2,6 +2,7 @@ LIBRARY()
RESOURCE_FILES(
config.clang-format
+ config.clang-format-16
)
END()
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index 7d5382572d..9d7620b0da 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -1619,6 +1619,12 @@ module CPP_STYLE_TEST_14: PY3TEST_BIN {
PEERDIR+=library/python/cpp_test
}
+# tag:cpp-specific tag:test
+module CPP_STYLE_TEST_16: PY3TEST_BIN {
+ DEPENDS(contrib/libs/clang16/tools/clang-format)
+ PEERDIR+=library/python/cpp_test
+}
+
macro STYLE(Globs...) {
_GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
_STYLE(${STYLE_SRCS_GLOB})
diff --git a/library/python/cpp_test/test_cpp.py b/library/python/cpp_test/test_cpp.py
index b7607d66c2..efa10ea283 100644
--- a/library/python/cpp_test/test_cpp.py
+++ b/library/python/cpp_test/test_cpp.py
@@ -10,15 +10,20 @@ from library.python.testing.style import rules
import library.python.resource as lpr
-STYLE_CONFIG_JSON = json.dumps(yaml.safe_load(lpr.find('resfs/file/config.clang-format')))
+STYLE_CONFIG_JSON_14 = json.dumps(yaml.safe_load(lpr.find('resfs/file/config.clang-format')))
+STYLE_CONFIG_JSON_16 = json.dumps(yaml.safe_load(lpr.find('resfs/file/config.clang-format-16')))
RES_FILE_PREFIX = '/cpp_style/files/'
CHECKED_PATHS = list(lpr.iterkeys(RES_FILE_PREFIX, strip_prefix=True))
def check_style(filename, actual_source):
- clang_format_binary = yatest.common.binary_path('contrib/libs/clang14/tools/clang-format/clang-format')
- config = STYLE_CONFIG_JSON
+ try:
+ clang_format_binary = yatest.common.binary_path('contrib/libs/clang14/tools/clang-format/clang-format')
+ config = STYLE_CONFIG_JSON_14
+ except Exception:
+ clang_format_binary = yatest.common.binary_path('contrib/libs/clang16/tools/clang-format/clang-format')
+ config = STYLE_CONFIG_JSON_16
command = [clang_format_binary, '-assume-filename=' + filename, '-style=' + config]
styled_source = subprocess.check_output(command, input=actual_source)