Skip to main content

1C HBK BSL

Инструменты для разработки на 1C Enterprise / BSL: расширение VS Code / Cursor, CLI-линтер, formatter, LSP-сервер и MCP-сервер для локальных интеграций.

CI VS Marketplace VS Marketplace installs PyPI Python License: MIT

Что Это

onec-hbk-bsl помогает держать BSL-код в порядке:

  • показывает диагностики в редакторе и CLI;
  • включает 180 публичных диагностических правил;
  • форматирует .bsl / .os;
  • дает навигацию, hover, completion, rename и inlay hints через LSP;
  • умеет отдавать SARIF/JSON для CI;
  • предоставляет MCP-инструменты для локальных AI-ассистентов.

Проект не запускает Java-анализатор в рантайме. Публичный контракт продукта: BSL### коды правил, onec-hbk-bsl.toml, CLI/LSP/MCP и VS Code extension.

Текущий релиз требует Python 3.12+ при установке из PyPI. Платформенные VSIX содержат готовый бинарник и не требуют системного Python. Датированный снимок проверок и методика замеров приведены в Production notes.

Быстрый Старт

VS Code / Cursor

  1. Установите расширение mussolene.1c-hbk-bsl.
  2. Откройте каталог с исходниками 1С.
  3. Диагностики появятся в Problems; форматирование и навигация заработают через LSP.

Поддерживаются VS Code / Cursor с API VS Code 1.85+ и платформенные сборки для macOS Apple Silicon, macOS Intel, Linux x64 и Windows x64.

Рекомендуемые настройки workspace:

{
  "[bsl]": {
    "editor.defaultFormatter": "mussolene.1c-hbk-bsl",
    "editor.formatOnSave": true,
    "editor.tabSize": 4,
    "editor.insertSpaces": false
  }
}

Подробнее: vscode-extension/README.md.

CLI

uv tool install onec-hbk-bsl

onec-hbk-bsl check .
onec-hbk-bsl format . --check
onec-hbk-bsl check . --format sarif > bsl-results.sarif

Для обычной установки через pip:

pip install onec-hbk-bsl

Конфигурация

Основной файл проекта: onec-hbk-bsl.toml.

ignore = ["BSL012"]
exclude = ["vendor", "build", "*.gen.bsl"]
format = "text"
jobs = 0
insert-spaces = false
indent-size = 4
index-mode = "full"      # off | symbols | full
index-max-bytes = 0      # 0 = unlimited

[per-file-ignores]
"legacy/*.bsl" = ["BSL002", "BSL011"]

Также поддерживается секция [tool."onec-hbk-bsl"] в pyproject.toml. CLI-флаги имеют приоритет над конфигом. jobs = 0 включает адаптивное планирование: несколько модулей размером от 2 MiB на fork-capable ОС распределяются между file-workers, а каждый worker получает ограниченную долю общего бюджета правил. jobs = 1 всегда выполняет файлы последовательно. Python API check_files(...) автоматически ищет этот конфиг от первого переданного пути; если передать config=cfg, он применяется как набор дефолтов целиком. CLI format читает exclude; workspace-индекс читает index-exclude, который по умолчанию наследует exclude, и дополнительно учитывает Git ignore. Пустой index-exclude оставляет исключённые из диагностик библиотеки доступными для hover/F12. После изменения области индекса выполните index --force. Formatter читает insert-spaces и indent-size; низкоуровневый default_formatter.format(...) остаётся чистой функцией от текста и явных параметров.

Правила

  • BSL### — стабильный код правила для вывода, --select, --ignore, onec-hbk-bsl.toml и // noqa: BSL###.
  • Compatible key — совместимый alias для существующих BSL-проектов, например LineLength или ConsecutiveEmptyLines.
  • CLI и конфиг принимают оба вида, но выводят BSL###.

Справочник правил: docs/diagnostic-rules.md.

Подавление:

Пароль = "dev_only";  // noqa: BSL012
// BSLLS:MethodSize-off

Команды

# Диагностики
onec-hbk-bsl check .
onec-hbk-bsl check . --select BSL001,BSL012
onec-hbk-bsl check . --ignore BSL014

# Отчеты и постепенное внедрение
onec-hbk-bsl check . --format json
onec-hbk-bsl check . --format sarif > bsl-results.sarif
onec-hbk-bsl check . --update-baseline bsl-baseline.json
onec-hbk-bsl check . --baseline bsl-baseline.json

# Форматирование
onec-hbk-bsl format .
onec-hbk-bsl format . --check

# Серверы
onec-hbk-bsl lsp
onec-hbk-bsl mcp --stdio --workspace /path/to/project
onec-hbk-bsl index /path/to/project
onec-hbk-bsl index /path/to/project --mode symbols
onec-hbk-bsl index /path/to/project --status
onec-hbk-bsl index /path/to/project --compact
onec-hbk-bsl index /path/to/project --clean  # сначала остановить LSP/MCP

В Git-репозитории индексируются tracked-файлы и untracked-файлы, не исключённые Git (.gitignore, .git/info/exclude, global excludes). Затем применяются паттерны index-exclude из onec-hbk-bsl.toml; если ключ не задан, он наследует exclude. Режим symbols не хранит граф вызовов, off отключает постоянный workspace-индекс, а full сохраняет все cross-file возможности. Повреждённый индекс является кэшем и удаляется для пересборки — копии .corrupt.* не сохраняются. Перед --clean остановите LSP/MCP: writer-lock не может обнаружить бездействующий reader или старую версию процесса с открытым файлом.

Публичная поверхность CLI/API описана в docs/public-surface.md.

Python И Пакеты

from onec_hbk_bsl import check_files

diagnostics = check_files(["src/Модуль.bsl"], jobs=1)
for diagnostic in diagnostics:
    print(diagnostic.code, diagnostic.file, diagnostic.line)

Публикуются два PyPI-дистрибутива:

Пакет Назначение
onec-hbk-bsl-core CLI, formatter, diagnostics, Python API и LSP без MCP-зависимостей
onec-hbk-bsl Полный совместимый пакет поверх onec-hbk-bsl-core[mcp] той же версии

Документация

Документ Для чего
VS Code extension guide Расширение VS Code / Cursor
Diagnostic rules Справочник правил
Public surface Публичный контракт CLI/API/extension
Architecture Архитектура сервера и анализатора
Production notes Release и эксплуатационные проверки
Third-party notices Лицензии и источники данных

Разработка

git clone https://github.com/mussolene/1c_hbk_bsl
cd 1c_hbk_bsl
make install
make lint
make test

Для локальной сборки VSIX используйте make vsix.

Лицензия

MIT © 2024 1C HBK BSL Contributors

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onec_hbk_bsl_core-0.8.42.tar.gz (362.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onec_hbk_bsl_core-0.8.42-py3-none-any.whl (380.9 kB view details)

Uploaded Python 3

File details

Details for the file onec_hbk_bsl_core-0.8.42.tar.gz.

File metadata

  • Download URL: onec_hbk_bsl_core-0.8.42.tar.gz
  • Upload date:
  • Size: 362.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for onec_hbk_bsl_core-0.8.42.tar.gz
Algorithm Hash digest
SHA256 8d227ee641fabf041900cfc171cd326012172421934e1f5967e4e1f13feed0f0
MD5 a4e0c0c808b9d69b7445c316178a699b
BLAKE2b-256 cb07aea8c84f875a7ba4d9e186bc7469755d49f6d42f5612949422972142c164

See more details on using hashes here.

Provenance

The following attestation bundles were made for onec_hbk_bsl_core-0.8.42.tar.gz:

Publisher: release.yml on mussolene/1c_hbk_bsl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onec_hbk_bsl_core-0.8.42-py3-none-any.whl.

File metadata

File hashes

Hashes for onec_hbk_bsl_core-0.8.42-py3-none-any.whl
Algorithm Hash digest
SHA256 29f7257509f98c97666f90b25f6fb6c8a71a3e9cbf99603e9ddb32de4f3769d4
MD5 6860de3a37bb5709a9d4e34526b19fc8
BLAKE2b-256 07cbc0e97b11e68e4e01c63bda8b8adeff35cd83be6c316e8fe4bb5ad94d23ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for onec_hbk_bsl_core-0.8.42-py3-none-any.whl:

Publisher: release.yml on mussolene/1c_hbk_bsl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.8.50

2 files

0.8.49

2 files

0.8.48

2 files

0.8.47

2 files

0.8.46

2 files

0.8.45

2 files

0.8.44

2 files

0.8.43

2 files

This release

0.8.42 This release

2 files

0.8.41

2 files

0.8.40

2 files

0.8.39

2 files

0.8.38

2 files

0.8.37

2 files

0.8.36

2 files

0.8.34

2 files

0.8.33

2 files

0.8.32

2 files

0.8.31

2 files

0.8.30

2 files

0.8.29

2 files

0.8.28

2 files

0.8.27

2 files

0.8.26

2 files

0.8.25

2 files

0.8.24

2 files

0.8.23

2 files

0.8.22

2 files

0.8.21

2 files

0.8.20

2 files

0.8.19

2 files

0.8.18

2 files

0.8.17

2 files

0.8.16

2 files

0.8.15

2 files

0.8.14

2 files

0.8.13

2 files

0.8.12

2 files

0.8.11

2 files

0.8.9

2 files

0.8.8

2 files

0.8.7

2 files

0.8.6

2 files

0.8.5

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page