diff options
author | zhukoff-pavel <zhukoff-pavel@yandex-team.com> | 2024-08-07 17:24:18 +0300 |
---|---|---|
committer | zhukoff-pavel <zhukoff-pavel@yandex-team.com> | 2024-08-07 17:41:38 +0300 |
commit | 7029947a65652cc397d735ff47e7780f4e4d1fbd (patch) | |
tree | ccf730e9701fbee4a5e85960cd57a9adebf9dc3e | |
parent | b0f6cd904ffb99526b40483bd2738c6c78fa0e88 (diff) | |
download | ydb-7029947a65652cc397d735ff47e7780f4e4d1fbd.tar.gz |
enable addition of ALL_SRCDIR to ktlint sources
Привет!
Этот PR исправляет ошибку в поведении ktlint, из-за которой в последний могли не приезжать некоторые исходники, и линтер на этих файлах не показывал никаких ошибок (в плашке тест зеленый, и только в его stderr ошибка FileNotFound).
Для ~90 проектов был сделан временный макрос, который вернет старое поведение, но будет бросаться варнингами.
Подробнее в посте https://clubs.at.yandex-team.ru/arcadia/30406
1b0dd52d91b4e904b41351a72fffd23ec65c1e85
-rw-r--r-- | build/conf/java.conf | 11 | ||||
-rw-r--r-- | build/plugins/_dart_fields.py | 15 |
2 files changed, 22 insertions, 4 deletions
diff --git a/build/conf/java.conf b/build/conf/java.conf index ad4f5f1a29..be9c608757 100644 --- a/build/conf/java.conf +++ b/build/conf/java.conf @@ -2066,3 +2066,14 @@ _KTLINT_BASELINE_FILE= macro KTLINT_BASELINE_FILE(File, Ticket) { SET(_KTLINT_BASELINE_FILE $File) } + +# tag:kotlin-specific +_WITH_YA_1931=no + +# tag:kotlin-specific +### @usage: WITH_YA_1931() +### Interim macro to temporarily remove ALL_SRCDIRS from being added to ktlint test sources. +macro WITH_YA_1931() { + MESSAGE(WARNING Some files in this project have style errors that were not caught by prior ktlint runs. Remove WITH_YA_1931 macro to see them.) + ENABLE(_WITH_YA_1931) +} diff --git a/build/plugins/_dart_fields.py b/build/plugins/_dart_fields.py index 866821585c..4676499399 100644 --- a/build/plugins/_dart_fields.py +++ b/build/plugins/_dart_fields.py @@ -179,7 +179,7 @@ def get_canonical_test_resources(unit): return [], [] -def java_srcdirs_to_data(unit, var): +def java_srcdirs_to_data(unit, var, serialize_result=True): extra_data = [] for srcdir in (unit.get(var) or '').replace('$' + var, '').split(): if srcdir == '.': @@ -195,7 +195,7 @@ def java_srcdirs_to_data(unit, var): srcdir = os.path.join('$S', unit.get('MODDIR'), srcdir) if srcdir.startswith('$S'): extra_data.append(srcdir.replace('$S', 'arcadia')) - return serialize_list(extra_data) + return serialize_list(extra_data) if serialize_result else extra_data def extract_java_system_properties(unit, args): @@ -799,14 +799,21 @@ class TestData: @classmethod def ktlint(cls, unit, flat_args, spec_args): if unit.get('_USE_KTLINT_OLD') == 'yes': - extra_test_data = serialize_list([KTLINT_OLD_EDITOR_CONFIG]) + extra_test_data = [KTLINT_OLD_EDITOR_CONFIG] else: data_list = [KTLINT_CURRENT_EDITOR_CONFIG] baseline_path_relative = unit.get('_KTLINT_BASELINE_FILE') if baseline_path_relative: baseline_path = unit.resolve_arc_path(baseline_path_relative).replace('$S', 'arcadia') data_list += [baseline_path] - extra_test_data = serialize_list(data_list) + extra_test_data = data_list + + # XXX + if unit.get('_WITH_YA_1931') != 'yes': + extra_test_data += java_srcdirs_to_data(unit, 'ALL_SRCDIRS', serialize_result=False) + + extra_test_data = serialize_list(extra_test_data) + return {cls.KEY: extra_test_data} @classmethod |