Skip to main content

1C HBK BSL

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

CI VS Marketplace PyPI License: MIT

Что Это

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

  • показывает диагностики в редакторе и CLI;
  • форматирует .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.

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

VS Code / Cursor

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

Рекомендуемые настройки 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

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

Также поддерживается секция [tool."onec-hbk-bsl"] в pyproject.toml. CLI-флаги имеют приоритет над конфигом. Python API check_files(...) автоматически ищет этот конфиг от первого переданного пути; если передать config=cfg, он применяется как набор дефолтов целиком. CLI format также читает конфиг для exclude, 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

Публичная поверхность 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.36.tar.gz (352.0 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.36-py3-none-any.whl (372.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: onec_hbk_bsl_core-0.8.36.tar.gz
  • Upload date:
  • Size: 352.0 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.36.tar.gz
Algorithm Hash digest
SHA256 64f20fdad5f42ecc4b032745bfca3d39b9fe47fb5280ce80a5546f90624fdce2
MD5 f5c3a89eafb6ea90a8e08f6c62da6082
BLAKE2b-256 d0f04cd11ed92aa50e67df35e0ad4a038206264e59b09d3f1404fd63762152a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for onec_hbk_bsl_core-0.8.36.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.36-py3-none-any.whl.

File metadata

File hashes

Hashes for onec_hbk_bsl_core-0.8.36-py3-none-any.whl
Algorithm Hash digest
SHA256 9bcb01d2d00f9ccae9bb6d2b209f22afc17f53968b3b8068e49bef35da650e2f
MD5 8e7cdd527af8965df7c3aa855076b187
BLAKE2b-256 00f06dc15273c003aebb4551dc0926f0a19a85cad84a6a77abf5ffdc08a205ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for onec_hbk_bsl_core-0.8.36-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

0.8.42

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

This release

0.8.36 This release

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