aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikhnenko <mikhnenko@yandex-team.com>2024-04-04 16:39:17 +0300
committermikhnenko <mikhnenko@yandex-team.com>2024-04-04 16:49:35 +0300
commitd3b7159d4281e3d6d92f39a0e2ff7833e68a86d4 (patch)
tree1e2067a3d91cf63fc6aeca15857bc3e9898bef3c
parentf4eb30af3b98eaf6ee9a0900b4160adb653a3eaa (diff)
downloadydb-d3b7159d4281e3d6d92f39a0e2ff7833e68a86d4.tar.gz
Use same configs in ya style and style-tests
853c2293128f6f534d97c1a5c97204e1f72868cf
-rw-r--r--build/config/tests/cpp_style/config.clang-format4
-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--library/python/cpp_test/test_cpp.py12
4 files changed, 7 insertions, 100 deletions
diff --git a/build/config/tests/cpp_style/config.clang-format b/build/config/tests/cpp_style/config.clang-format
index c4bedb3f4e..3a354b63b4 100644
--- a/build/config/tests/cpp_style/config.clang-format
+++ b/build/config/tests/cpp_style/config.clang-format
@@ -3,7 +3,9 @@ AccessModifierOffset: -4
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignEscapedNewlines: Left
-AlignTrailingComments: true
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 0
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
diff --git a/build/config/tests/cpp_style/config.clang-format-16 b/build/config/tests/cpp_style/config.clang-format-16
deleted file mode 100644
index 3a354b63b4..0000000000
--- a/build/config/tests/cpp_style/config.clang-format-16
+++ /dev/null
@@ -1,90 +0,0 @@
-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 6d2fab5a83..bb5fccd5ea 100644
--- a/build/config/tests/cpp_style/ya.make
+++ b/build/config/tests/cpp_style/ya.make
@@ -2,7 +2,6 @@ LIBRARY()
RESOURCE_FILES(
config.clang-format
- config.clang-format-16
)
END()
diff --git a/library/python/cpp_test/test_cpp.py b/library/python/cpp_test/test_cpp.py
index efa10ea283..b4c78f8271 100644
--- a/library/python/cpp_test/test_cpp.py
+++ b/library/python/cpp_test/test_cpp.py
@@ -10,20 +10,16 @@ from library.python.testing.style import rules
import library.python.resource as lpr
-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')))
+# keep in sync with the logic in https://a.yandex-team.ru/arcadia/devtools/ya/handlers/style/cpp_style.py?rev=r12543375#L21
+STYLE_CONFIG_JSON = json.dumps(yaml.safe_load(lpr.find('resfs/file/config.clang-format')))
RES_FILE_PREFIX = '/cpp_style/files/'
CHECKED_PATHS = list(lpr.iterkeys(RES_FILE_PREFIX, strip_prefix=True))
def check_style(filename, actual_source):
- 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
+ clang_format_binary = yatest.common.binary_path('contrib/libs/clang16/tools/clang-format/clang-format')
+ config = STYLE_CONFIG_JSON
command = [clang_format_binary, '-assume-filename=' + filename, '-style=' + config]
styled_source = subprocess.check_output(command, input=actual_source)