Инициализировать репозиторий «Дейл»

Первый коммит: модульный монолит ядра (.NET 10) и gRPC-сервисы
ai/ml/telegram, фронтенд Vue 3/Vite/Tailwind, документация (ТЗ,
инструкция пользователя, техдокументация, код-стайл), бэклог,
скрипты развёртывания и архив прототипа LeadRadar.
This commit is contained in:
Rustam Khalimov
2026-09-11 02:50:17 +03:00
commit 9e07568ddd
1402 changed files with 177470 additions and 0 deletions
+108
View File
@@ -0,0 +1,108 @@
"""Приведение XML-док <summary> к блочному виду (действующий код-стайл «Дейл»).
Правило: открывающий <summary> и закрывающий </summary> — каждый на своей строке.
Однострочная запись `/// <summary>текст</summary>` не допускается.
Режимы:
python scripts/fix_summary_blocks.py --check # только посчитать, что изменится
python scripts/fix_summary_blocks.py --apply # применить
"""
import os
import re
import sys
ROOT = r"C:\telbase\src"
EXC = ("bin", "obj", "node_modules", ".git")
LINE_RE = re.compile(r"^(\s*)(///)([ \t]?)(.*)$")
def transform(body: str):
m = LINE_RE.match(body)
if not m:
return [body]
indent, _, _, content = m.groups()
if "<summary>" not in content and "</summary>" not in content:
return [body]
base = indent + "///"
def tag(text=""):
return base + (" " + text if text else "")
if "<summary>" in content and "</summary>" in content:
pre, rest = content.split("<summary>", 1)
between, post = rest.split("</summary>", 1)
res = []
if pre.strip():
res.append(tag(pre.strip()))
res.append(tag("<summary>"))
if between.strip():
res.append(tag(between.strip()))
res.append(tag("</summary>"))
if post.strip():
res.append(tag(post.strip()))
return res
if "<summary>" in content:
pre, after = content.split("<summary>", 1)
res = []
if pre.strip():
res.append(tag(pre.strip()))
res.append(tag("<summary>"))
if after.strip():
res.append(tag(after.strip()))
return res
if "</summary>" in content:
pre, after = content.split("</summary>", 1)
res = []
if pre.strip():
res.append(tag(pre.strip()))
res.append(tag("</summary>"))
if after.strip():
res.append(tag(after.strip()))
return res
return [body]
def iter_cs():
for dp, dn, fn in os.walk(ROOT):
dn[:] = [d for d in dn if d not in EXC]
for f in fn:
if f.endswith(".cs"):
yield os.path.join(dp, f)
def process(path, apply):
raw = open(path, "rb").read().decode("utf-8")
lines = raw.splitlines(keepends=True)
out = []
changed = False
for raw_line in lines:
if raw_line.endswith("\r\n"):
body, ending = raw_line[:-2], "\r\n"
elif raw_line.endswith("\n"):
body, ending = raw_line[:-1], "\n"
else:
body, ending = raw_line, ""
new_bodies = transform(body)
if new_bodies != [body]:
changed = True
out.extend(b + ending for b in new_bodies)
if changed and apply:
open(path, "w", encoding="utf-8", newline="").write("".join(out))
return changed
def main():
apply = "--apply" in sys.argv
total = 0
files = 0
for path in iter_cs():
if process(path, apply):
files += 1
print(("APPLIED" if apply else "DRY-RUN"), "files changed:", files)
if __name__ == "__main__":
main()