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.38.tar.gz (352.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.38-py3-none-any.whl (372.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: onec_hbk_bsl_core-0.8.38.tar.gz
  • Upload date:
  • Size: 352.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.38.tar.gz
Algorithm Hash digest
SHA256 bab959657e95b709c35fa1d0fe8b038d1b80a12435e6efb55c14cc68bebba5be
MD5 fb85a336022d2d78967e9f3d195f3ade
BLAKE2b-256 0e1dd251493cb9bdb6e579abab253349d7267c2881b2021f5bc05408a149d8c7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for onec_hbk_bsl_core-0.8.38-py3-none-any.whl
Algorithm Hash digest
SHA256 6f2354fab41559fb7ab975b0ef8abde19a89ff3888cab082452a6f5ed35868ea
MD5 ca80892247bd0004373b0fad8ff800fe
BLAKE2b-256 75086eb3801c42e2f5513d2317cd4fbf674a8a3d21a06960d3c79dedd566b4ea

See more details on using hashes here.

Provenance

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

This release

0.8.38 This release

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