Skip to content

feat: Экспорт результатов в markdown, json, xml, html#14

Merged
Stivo182 merged 10 commits intomainfrom
feat/exports
May 25, 2025
Merged

feat: Экспорт результатов в markdown, json, xml, html#14
Stivo182 merged 10 commits intomainfrom
feat/exports

Conversation

@Stivo182
Copy link
Owner

@Stivo182 Stivo182 commented May 24, 2025

Summary by CodeRabbit

  • New Features

    • Added support for exporting benchmark results to Markdown, JSON, XML, and HTML formats.
    • Introduced annotations to specify artifact directories and enable multiple export formats.
    • Benchmark results and artifact file locations are now displayed after benchmark runs.
    • Added configuration options to manage artifact directories and exporters.
  • Bug Fixes

    • Improved test cleanup by removing generated artifact files after each test.
  • Documentation

    • Added new documentation on exporting benchmark results and configuring artifact directories.
    • Updated documentation to include new fields in benchmark result structures.
  • Tests

    • Added tests for artifact directory configuration, exporter management, and export functionality for all supported formats (Markdown, JSON, XML, HTML).

@coderabbitai
Copy link

coderabbitai bot commented May 24, 2025

Walkthrough

This update introduces a system for exporting benchmark results to multiple formats (Markdown, JSON, XML, HTML) and managing artifact directories. It adds configuration options and annotations for artifact directories and exporters, implements exporter modules for each format, and updates the benchmark runner to support result exporting. New tests and fixtures validate artifact directory and exporter management, as well as the export functionality in all supported formats.

Changes

File(s) Change Summary
packagedef Added runtime dependencies: "xml-parser" v0.1.1 and "fs" v1.2.0.
samples/benchmarks/Классы/БенчмаркЭкспортРезультатов.os Added class with export annotations: Markdown, JSON, XML, HTML; includes constructor and 100ms pause benchmark.
src/BenchmarkOneScript/annotations/Классы/АннотацияКаталогАртефактов.os Added КаталогАртефактов annotation to specify artifact directory on constructors.
src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортMarkdown.os Added ЭкспортMarkdown annotation for enabling Markdown export on constructors.
src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортJson.os Added ЭкспортJson annotation for enabling JSON export on constructors.
src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортXml.os Added ЭкспортXml annotation for enabling XML export on constructors.
src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортHtml.os Added ЭкспортHtml annotation for enabling HTML export on constructors.
src/BenchmarkOneScript/core/Классы/ЗапускательБенчмарков.os Added result exporting after benchmarks; imports "logos" and "fs"; new procedure to export results and report artifact files.
src/BenchmarkOneScript/core/Классы/КонфигурацияБенчмарков.os Added private fields and exported methods for managing artifact directory and exporters (get/set/add/clear).
src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВMarkdown.os New exporter module for writing benchmark results to Markdown files.
src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВJson.os New exporter module for writing benchmark results to JSON files.
src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВXml.os New exporter module for writing benchmark results to XML files with proper serialization.
src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВHtml.os New exporter module for writing benchmark results to HTML files with styled tables.
src/BenchmarkOneScript/core/Модули/Бенчмаркинг.os Updated documentation of Запустить function to include "ИмяКласса" field in result structure.
src/BenchmarkOneScript/core/Модули/ИзвлекательКонфигурацииБенчмарков.os Added procedures to read new annotations for artifact directory and exporters; updated main extraction flow.
src/BenchmarkOneScript/core/Модули/ЭкспортРезультатовБенчмарков.os Added function to prepare benchmark results data structure for exporting.
src/BenchmarkOneScript/core/Модули/ЭкспортерыРезультатовБенчмарков.os Added global variables initializing exporter instances for Markdown, JSON, XML, and HTML.
tests/fixtures/Классы/БенчмаркСАннотацямиКонфигурации.os Added annotations for artifact directory and all four export formats in test fixture.
tests/fixtures/verified-report.* (md, json, xml, html) Added verified benchmark report fixture files in Markdown, JSON, XML, and HTML formats.
tests/ТестыБенчмарков.os Added cleanup procedure to delete artifact files after tests; added tests for export in Markdown, JSON, XML, HTML; removed redundant config call.
tests/ТестыКонфигурации.os Added tests for artifact directory setting, exporter addition, clearing exporters; enhanced assertions with "fluent".
tests/helpers/Модули/ТестированиеБенчмарков.os Modified delay handler to default delay to 1; added procedure to set mock environment info and generate mock report.
docs/README.md Added documentation index entry for "Экспорт результатов".
docs/ОбработчикиСобытий.md Added "Аннотации" subsection header before &ПередВсеми annotation description.
docs/ЭкспортРезультатов.md Added new documentation file describing export features, annotations, configuration, and usage examples.
samples/api/ЭкспортРезультатовПример.os Added sample benchmark script demonstrating configuration and usage of HTML and JSON exporters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BenchmarkRunner
    participant Config
    participant Exporter
    participant Filesystem

    User->>BenchmarkRunner: Запустить()
    BenchmarkRunner->>Config: ПолучитьЭкспортеры(), КаталогАртефактов()
    BenchmarkRunner->>Exporter: Записать(Результаты)
    Exporter->>Filesystem: Создать/Открыть файл (Markdown/JSON/XML/HTML)
    Exporter->>Filesystem: Записать результаты в файл
    Exporter->>Filesystem: Закрыть файл
    BenchmarkRunner->>Filesystem: Получить список файлов артефактов
    BenchmarkRunner->>User: Показать пути к файлам артефактов
Loading

Poem

🐇 Hop along, the benchmarks sing,
Exported reports in files we bring!
Markdown, JSON, XML, and HTML bright,
Artifacts stored just right in sight.
Annotations guide the export way,
Tests confirm the code’s ballet.
With every hop, new features play! ✨📊


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Stivo182 Stivo182 marked this pull request as draft May 24, 2025 20:28
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
samples/benchmarks/Классы/БенчмаркЭкспортРезультатов.os (1)

6-8: Consider a more representative benchmark example.

While Приостановить(100) works for demonstrating the export functionality, consider using a more computationally representative operation for a sample benchmark. This would better demonstrate real-world benchmarking scenarios.

 &Бенчмарк
 Процедура Бенчмарк() Экспорт
-	Приостановить(100);
+	// Пример вычислительной операции
+	Сумма = 0;
+	Для Индекс = 1 По 1000 Цикл
+		Сумма = Сумма + Индекс * 2;
+	КонецЦикла;
 КонецПроцедуры
tests/ТестыБенчмарков.os (1)

10-17: Consider adding error handling to cleanup procedure.

The cleanup procedure should handle cases where the directory doesn't exist or file deletion fails.

Consider making the cleanup more robust:

 &После
 Процедура ПослеЗапускаТеста() Экспорт
 	
 	КаталогАртефактов = ".\BenchmarkArtifacts";

-	ФС.УдалитьФайлы(КаталогАртефактов);
+	Если ФС.КаталогСуществует(КаталогАртефактов) Тогда
+		Попытка
+			ФС.УдалитьФайлы(КаталогАртефактов);
+		Исключение
+			// Игнорируем ошибки очистки в тестах
+		КонецПопытки;
+	КонецЕсли;

 КонецПроцедуры
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5bffdf5 and c2c2695.

📒 Files selected for processing (12)
  • packagedef (1 hunks)
  • samples/benchmarks/Классы/БенчмаркЭкспортРезультатов.os (1 hunks)
  • src/BenchmarkOneScript/annotations/Классы/АннотацияКаталогАртефактов.os (1 hunks)
  • src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортMarkdown.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЗапускательБенчмарков.os (5 hunks)
  • src/BenchmarkOneScript/core/Классы/КонфигурацияБенчмарков.os (4 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВMarkdown.os (1 hunks)
  • src/BenchmarkOneScript/core/Модули/Бенчмаркинг.os (1 hunks)
  • src/BenchmarkOneScript/core/Модули/ИзвлекательКонфигурацииБенчмарков.os (2 hunks)
  • tests/fixtures/Классы/БенчмаркСАннотацямиКонфигурации.os (1 hunks)
  • tests/ТестыБенчмарков.os (2 hunks)
  • tests/ТестыКонфигурации.os (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: sonar / test
  • GitHub Check: build (windows-latest, stable)
  • GitHub Check: build (ubuntu-latest, dev)
  • GitHub Check: build (ubuntu-latest, stable)
  • GitHub Check: build (windows-latest, dev)
  • GitHub Check: build (macos-latest, stable)
  • GitHub Check: build (macos-latest, dev)
🔇 Additional comments (42)
packagedef (1)

29-29:

Details

❓ Verification inconclusive

Verify the "fs" package version for validity and security.

Ensure that version "1.2.0" of the "fs" package exists and is free from known security vulnerabilities.


🏁 Script executed:

#!/bin/bash
# Description: Verify "fs" package version and check for security advisories

# Check if this version exists on package registry
echo "Checking if fs version 1.2.0 exists..."
curl -s "https://hub.oscript.io/api/packages/fs/versions" | jq '.[] | select(.number == "1.2.0")'

# Check latest available version
echo "Latest version of fs package:"
curl -s "https://hub.oscript.io/api/packages/fs" | jq '.latestVersion'

Length of output: 436


Manual Verification Required: Confirm fs Package Version 1.2.0
The API endpoints returned invalid responses, so please manually verify the following before merging:

  • That version 1.2.0 of the fs package actually exists in the Oscripthub registry.
  • That there are no known security advisories or vulnerabilities affecting this specific version.
tests/fixtures/Классы/БенчмаркСАннотацямиКонфигурации.os (1)

9-10: LGTM! Test fixture annotations are correctly configured.

The new annotations properly demonstrate the artifact directory configuration and Markdown export functionality. The placeholder path is appropriate for test fixtures.

src/BenchmarkOneScript/core/Модули/Бенчмаркинг.os (1)

12-12: LGTM! Documentation correctly reflects the new return field.

The addition of the "ИмяКласса" field documentation is consistent with the implementation changes and follows the established documentation pattern.

samples/benchmarks/Классы/БенчмаркЭкспортРезультатов.os (1)

1-1: LGTM! Annotation correctly demonstrates Markdown export functionality.

The &ЭкспортMarkdown annotation properly showcases the new export feature.

src/BenchmarkOneScript/annotations/Классы/АннотацияКаталогАртефактов.os (1)

1-13: LGTM! Well-documented annotation implementation.

The annotation is properly documented with clear usage examples and constraints. The implementation follows standard annotation patterns with minimal boilerplate code.

src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортMarkdown.os (1)

1-12: LGTM! Clear and consistent annotation implementation.

The annotation follows the same documentation and implementation pattern as the artifact directory annotation, maintaining consistency across the codebase.

src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВMarkdown.os (2)

6-8: LGTM! Proper logger initialization.

The constructor correctly initializes the logger with an appropriate namespace following the module structure.


12-12:

Details

✅ Verification successful

Verify directory creation before file writing.

The code assumes the artifact directory exists. Consider ensuring the directory is created before attempting to write the file.

Please verify if the artifact directory is automatically created elsewhere in the codebase, or if directory creation should be added here:


🏁 Script executed:

#!/bin/bash
# Description: Search for artifact directory creation logic in the codebase
# Expect: Find where КаталогАртефактов directory is created

# Search for directory creation patterns
rg -A 3 -B 3 "СоздатьКаталог|CreateDirectory|МД|mkdir" --type-add 'os:*.os' -t os

# Search for artifact directory usage
rg -A 5 -B 5 "КаталогАртефактов" --type-add 'os:*.os' -t os

Length of output: 17300


No action required: Directory creation is already handled

The artifact directory is ensured in src/BenchmarkOneScript/core/Классы/ЗапускательБенчмарков.os via:

ФС.ОбеспечитьКаталог(КаталогАртефактов);

before any exporter’s Записать method is invoked. The exporter can safely assume the directory exists.

tests/ТестыБенчмарков.os (2)

7-7: LGTM! Proper dependency addition.

Adding the fs module is appropriate for file system operations needed in the cleanup procedure.


460-476: LGTM! Well-structured test for Markdown export.

The test properly:

  • Sets up the benchmark configuration
  • Adds the Markdown exporter
  • Runs the benchmark
  • Verifies the output file exists

The test coverage validates the end-to-end export functionality effectively.

src/BenchmarkOneScript/core/Модули/ИзвлекательКонфигурацииБенчмарков.os (6)

43-44: Integration with annotation extraction sequence looks good.

The new annotation reading procedures are properly integrated into the extraction sequence, following the established pattern of being called after column-related annotations.


238-251: Artifact directory annotation reading implementation is consistent.

The procedure follows the established pattern for annotation reading with proper error handling and configuration update. The implementation correctly checks for annotation presence before attempting to read and set the value.


253-259: Markdown export annotation reading is well-implemented.

The procedure correctly detects the annotation presence and adds the appropriate exporter instance to the configuration. The logic is straightforward and follows the established patterns.


43-44: LGTM! Good integration with existing annotation processing flow.

The new annotation reading procedures are properly placed after the column annotations and follow the established parameter pattern.


238-251: Well-implemented annotation reader following established patterns.

The procedure correctly:

  • Uses early return when annotation is not present
  • Leverages the existing helper function ЗначениеАннотации
  • Follows the same naming and structure as other annotation readers

253-259: Clean implementation for boolean annotation.

The procedure appropriately handles a simple boolean annotation by directly creating the exporter instance when the annotation is present.

tests/ТестыКонфигурации.os (9)

5-5: Good addition of fluent library for enhanced collection processing.

Adding the fluent library enables more sophisticated collection assertions in the tests.


14-16: Proper setup for exporter testing.

The variables are correctly initialized to support the new exporter-related assertions.


29-30: Comprehensive assertions for new functionality.

The assertions properly verify both the artifact directory path and the presence of the expected exporter type using fluent collection processing.


566-576: Well-structured test for artifact directory management.

The test follows the standard pattern of setup, action, and assertion, properly verifying the getter/setter functionality.


578-588: Good test coverage for exporter addition.

The test correctly verifies that an exporter can be added and is present in the collection.


590-600: Comprehensive test for exporter clearing functionality.

The test properly verifies the complete lifecycle: add, clear, and verify empty state.


5-5: Appropriate library addition for collection processing.

The fluent library is correctly added to support the new collection processing functionality in the tests.


14-15: Comprehensive test coverage for new annotation functionality.

The test properly verifies:

  • Artifact directory is set correctly
  • Markdown exporter is added with the correct type
  • Uses appropriate collection processing with fluent library

Also applies to: 29-30


566-601: Excellent test coverage for new configuration functionality.

The three new tests comprehensively cover:

  • Setting and retrieving artifact directory
  • Adding exporters to the configuration
  • Clearing exporters from the configuration

All tests follow established patterns and provide good coverage.

src/BenchmarkOneScript/core/Классы/ЗапускательБенчмарков.os (10)

3-4: Appropriate library additions for new functionality.

The logos and fs imports are necessary for the new export functionality - logos for colored output and fs for file system operations.


35-35: Documentation update reflects new functionality.

The addition of ИмяКласса field to the documentation properly reflects the enhanced result structure.


67-67: Well-positioned export call in the execution flow.

The export procedure is called at the appropriate time - after results are generated and displayed but before returning the result.


578-578: Good enhancement to result structure.

Adding the class name to the result structure provides valuable context for consumers of the benchmark results.


589-611: Well-implemented export functionality.

The export procedure properly:

  • Checks if artifact directory is configured before proceeding
  • Ensures the directory exists using ФС.ОбеспечитьКаталог
  • Iterates through all configured exporters
  • Provides user feedback with colored output showing generated artifacts
  • Uses appropriate error handling by early return when no directory is configured

The implementation follows good practices with proper separation of concerns and user feedback.


3-4: Appropriate library imports for new export functionality.

The logos and fs modules are correctly imported to support logging and filesystem operations in the export functionality.


35-35: Good documentation maintenance.

The documentation correctly reflects the new "ИмяКласса" field that was added to the result structure.


67-67: Well-placed export functionality call.

The export call is appropriately positioned after benchmark execution and result display, ensuring all processing is complete before exporting.


578-578: Useful addition of class name to result structure.

Adding the benchmark class name to the result provides valuable context and is implemented correctly using the type information.


589-611: Well-implemented export functionality with good user feedback.

The procedure correctly:

  • Handles the case when no artifact directory is configured
  • Ensures the artifact directory exists using ФС.ОбеспечитьКаталог
  • Iterates through all configured exporters
  • Provides colored console output showing generated artifacts
src/BenchmarkOneScript/core/Классы/КонфигурацияБенчмарков.os (7)

15-16: Appropriate field additions for new functionality.

The new private fields are properly typed and follow the established naming conventions.


29-29: Proper initialization of new fields in constructor.

The new fields are correctly initialized with sensible defaults and the artifact directory is set using the appropriate setter method.

Also applies to: 34-34, 43-43


520-538: Well-implemented artifact directory management.

The getter and setter methods follow the established patterns in the class, with the setter maintaining the fluent interface by returning ЭтотОбъект.


540-567: Comprehensive exporter management functionality.

The methods provide complete CRUD operations for exporters:

  • Экспортеры() returns a defensive copy using ФиксированныйМассив
  • ДобавитьЭкспортер() adds an exporter and maintains fluent interface
  • ОчиститьЭкспортеры() clears all exporters and maintains fluent interface

All methods follow the established patterns and maintain proper encapsulation.


15-16: Consistent field declarations following established patterns.

The new private fields are properly declared with appropriate type documentation matching the existing code style.


29-29: Good initialization with sensible defaults.

The initialization properly:

  • Sets a reasonable default artifact directory path
  • Initializes the exporters array
  • Uses the setter method to ensure proper validation

Also applies to: 34-34, 43-43


520-567: Excellent implementation following established class patterns.

The new methods correctly:

  • Follow the same documentation and naming conventions
  • Support method chaining by returning ЭтотОбъект
  • Use ФиксированныйМассив in getters to prevent external modification
  • Provide clear and consistent API for managing artifact directory and exporters

Comment on lines 10 to 24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for file operations.

The export procedure lacks error handling for file operations. File writing operations can fail due to permissions, disk space, or path issues.

Consider adding try-catch error handling:

 Процедура Записать(РезультатыБенчмарков) Экспорт

 	ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.md");

 	_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
 	
+	Попытка
 		ЗаписьТекста = Новый ЗаписьТекста(ПутьКФайлу, КодировкаТекста.UTF8);
 		ЗаписьТекста.ЗаписатьСтроку(РезультатыБенчмарков.СредаОкружения.ВСтроку());
 		ЗаписьТекста.ЗаписатьСтроку("");
 		ЗаписьТекста.ЗаписатьСтроку(РезультатыБенчмарков.Отчет.КакMarkdown());
 		ЗаписьТекста.Закрыть();
+	Исключение
+		_Лог.Ошибка("Ошибка при записи файла %1: %2", ПутьКФайлу, ОписаниеОшибки());
+		ВызватьИсключение;
+	КонецПопытки;

 	_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);

 КонецПроцедуры
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Процедура Записать(РезультатыБенчмарков) Экспорт
ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.md");
_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
ЗаписьТекста = Новый ЗаписьТекста(ПутьКФайлу, КодировкаТекста.UTF8);
ЗаписьТекста.ЗаписатьСтроку(РезультатыБенчмарков.СредаОкружения.ВСтроку());
ЗаписьТекста.ЗаписатьСтроку("");
ЗаписьТекста.ЗаписатьСтроку(РезультатыБенчмарков.Отчет.КакMarkdown());
ЗаписьТекста.Закрыть();
_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
КонецПроцедуры
Процедура Записать(РезультатыБенчмарков) Экспорт
ПутьКФайлу = ОбъединитьПути(
РезультатыБенчмарков.Конфигурация.КаталогАртефактов(),
РезультатыБенчмарков.ИмяКласса + "-report.md"
);
_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
Попытка
ЗаписьТекста = Новый ЗаписьТекста(ПутьКФайлу, КодировкаТекста.UTF8);
ЗаписьТекста.ЗаписатьСтроку(РезультатыБенчмарков.СредаОкружения.ВСтроку());
ЗаписьТекста.ЗаписатьСтроку("");
ЗаписьТекста.ЗаписатьСтроку(РезультатыБенчмарков.Отчет.КакMarkdown());
ЗаписьТекста.Закрыть();
Исключение
_Лог.Ошибка(
"Ошибка при записи файла %1: %2",
ПутьКФайлу,
ОписаниеОшибки()
);
ВызватьИсключение;
КонецПопытки;
_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
КонецПроцедуры
🤖 Prompt for AI Agents
In src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВMarkdown.os
around lines 10 to 24, the procedure Записать lacks error handling for file
operations which may fail due to permissions, disk space, or path issues. Wrap
the file writing code in a try-catch block to catch exceptions during file
creation, writing, or closing. In the catch block, log the error details using
_Лог to provide diagnostic information and ensure the procedure handles failures
gracefully without crashing.

@Stivo182
Copy link
Owner Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented May 25, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (1)
src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВMarkdown.os (1)

10-24: Add error handling for file operations.

The export procedure still lacks error handling for file operations as identified in the previous review. This issue remains unaddressed.

🧹 Nitpick comments (3)
src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВHtml.os (1)

17-25: Consider improving HTML document structure.

The HTML structure could be enhanced for better accessibility and semantic meaning.

Consider adding a document title and improving the structure:

 	Части.Добавить("<!DOCTYPE html>");
 	Части.Добавить("<html lang='ru'>");
 	Части.Добавить("<head>");
 	Части.Добавить("<meta charset='utf-8' />");
+	Части.Добавить("<title>Отчет о бенчмарках - " + РезультатыБенчмарков.ИмяКласса + "</title>");
 	Части.Добавить(Css());
 	Части.Добавить("</head>");

 	Части.Добавить("<body>");
+	Части.Добавить("<h1>Отчет о бенчмарках</h1>");
+	Части.Добавить("<h2>Среда окружения</h2>");
 	Части.Добавить(СтрШаблон("<pre><code>%1</code></pre>", РезультатыБенчмарков.СредаОкружения.ВСтроку()));
+	Части.Добавить("<h2>Результаты бенчмарков</h2>");
src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВXml.os (1)

28-36: Consider simplifying array preparation logic.

The ПодготовитьМассивы function has complex logic for wrapping arrays. Consider adding comments to explain why this transformation is necessary.

Add documentation to clarify the purpose:

 Функция ПодготовитьМассивы(Данные)
+	// Подготавливает массивы для корректной XML-сериализации
+	// XML-сериализатор требует, чтобы массивы были обернуты в структуры
 		
 	Для Каждого Бенчмарк Из Данные.Бенчмарки Цикл
+		// Оборачиваем массив значений в структуру для XML
 		Бенчмарк.Статистика.Значения = Новый Структура("Значение", Бенчмарк.Статистика.Значения);
 	КонецЦикла;

+	// Оборачиваем массив бенчмарков в структуру для XML
 	Данные.Бенчмарки = Новый Структура("Бенчмарк", Данные.Бенчмарки);
src/BenchmarkOneScript/core/Модули/ИзвлекательКонфигурацииБенчмарков.os (1)

241-254: Consider aligning with existing patterns for consistency.

The artifact directory procedure uses an early return pattern that differs from other annotation reading procedures in this file (which typically use conditional blocks). While functionally correct, it would be more consistent to follow the same pattern as other procedures.

Consider refactoring to match the existing pattern:

-Процедура ПрочитатьАннотациюКаталогАртефактов(СвойстваКонструктора, Конфигурация)
-
-	Если Не РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "КаталогАртефактов") Тогда
-		Возврат;
-	КонецЕсли;
-
-	КаталогАртефактов = РаботаСАннотациямиБенчмарков.ЗначениеАннотации(
-		СвойстваКонструктора,
-		"КаталогАртефактов"
-	);
-	
-	Конфигурация.УстановитьКаталогАртефактов(КаталогАртефактов);
-
-КонецПроцедуры
+Процедура ПрочитатьАннотациюКаталогАртефактов(СвойстваКонструктора, Конфигурация)
+
+	Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "КаталогАртефактов") Тогда
+		КаталогАртефактов = РаботаСАннотациямиБенчмарков.ЗначениеАннотации(
+			СвойстваКонструктора,
+			"КаталогАртефактов"
+		);
+		Конфигурация.УстановитьКаталогАртефактов(КаталогАртефактов);
+	КонецЕсли;
+
+КонецПроцедуры
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5bffdf5 and ba770d6.

📒 Files selected for processing (25)
  • packagedef (1 hunks)
  • samples/benchmarks/Классы/БенчмаркЭкспортРезультатов.os (1 hunks)
  • src/BenchmarkOneScript/annotations/Классы/АннотацияКаталогАртефактов.os (1 hunks)
  • src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортHtml.os (1 hunks)
  • src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортJson.os (1 hunks)
  • src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортMarkdown.os (1 hunks)
  • src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортXml.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЗапускательБенчмарков.os (5 hunks)
  • src/BenchmarkOneScript/core/Классы/КонфигурацияБенчмарков.os (4 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВHtml.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВJson.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВMarkdown.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВXml.os (1 hunks)
  • src/BenchmarkOneScript/core/Модули/Бенчмаркинг.os (1 hunks)
  • src/BenchmarkOneScript/core/Модули/ИзвлекательКонфигурацииБенчмарков.os (2 hunks)
  • src/BenchmarkOneScript/core/Модули/ЭкспортРезультатовБенчмарков.os (1 hunks)
  • src/BenchmarkOneScript/core/Модули/ЭкспортерыРезультатовБенчмарков.os (1 hunks)
  • tests/fixtures/verified-report.html (1 hunks)
  • tests/fixtures/verified-report.json (1 hunks)
  • tests/fixtures/verified-report.md (1 hunks)
  • tests/fixtures/verified-report.xml (1 hunks)
  • tests/fixtures/Классы/БенчмаркСАннотацямиКонфигурации.os (1 hunks)
  • tests/helpers/Модули/ТестированиеБенчмарков.os (2 hunks)
  • tests/ТестыБенчмарков.os (2 hunks)
  • tests/ТестыКонфигурации.os (4 hunks)
🧰 Additional context used
🪛 LanguageTool
tests/fixtures/verified-report.md

[uncategorized] ~5-~5: A punctuation mark might be missing here.
Context: ...----|-------:|-------:|-------:|------:| | Бенчмарк | 1.0 ms | 0.0 ns | 0.0 ns | ...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

🪛 GitHub Actions: Контроль качества
tests/ТестыБенчмарков.os

[error] 467-467: Test 'Тест_ЭкспортВMarkdown' failed due to missing file: "/home/runner/work/BenchmarkOneScript/BenchmarkOneScript/./tests/fixtures/verified-report.md" (System.IO.FileNotFoundException).


[error] 496-496: Test 'Тест_ЭкспортВJson' failed due to missing file: "/home/runner/work/BenchmarkOneScript/BenchmarkOneScript/./tests/fixtures/verified-report.json" (System.IO.FileNotFoundException).


[error] 525-525: Test 'Тест_ЭкспортВXml' failed due to missing file: "/home/runner/work/BenchmarkOneScript/BenchmarkOneScript/./tests/fixtures/verified-report.xml" (System.IO.FileNotFoundException).


[error] 554-554: Test 'Тест_ЭкспортВHtml' failed due to missing file: "/home/runner/work/BenchmarkOneScript/BenchmarkOneScript/./tests/fixtures/verified-report.html" (System.IO.FileNotFoundException).

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build (ubuntu-latest, stable)
  • GitHub Check: build (windows-latest, dev)
  • GitHub Check: build (macos-latest, stable)
  • GitHub Check: build (macos-latest, dev)
  • GitHub Check: build (ubuntu-latest, dev)
  • GitHub Check: build (macos-latest, stable)
🔇 Additional comments (34)
packagedef (1)

28-30:

Details

❓ Verification inconclusive

Verify the new dependency versions for security and currency.

The added dependencies xml-parser (0.1.1) and fs (1.2.0) appropriately support the new XML export and filesystem functionality. However, please verify these are the latest stable versions and check for any known security vulnerabilities.


🌐 Web query:

What are the latest versions of xml-parser and fs packages for OneScript? Are there any known security vulnerabilities in xml-parser 0.1.1 and fs 1.2.0?

💡 Result:

Based on the search results, I can provide information about XML parsers and the fs package, though there are some limitations in the specific information about OneScript versions.

XML Parsers

The fast-xml-parser is a popular XML parsing library that allows you to validate XML, parse XML, and build XML rapidly without requiring C/C++ based libraries or callbacks[2]. The latest information shows that there is a vulnerability in fast-xml-parser version 4.2.5 that needs to be upgraded to version 4.4[4].

There appear to be security vulnerabilities associated with XML parsers. Specifically, XML External Entity (XXE) vulnerabilities can allow malicious hackers to perform attacks such as server-side request forgery (SSRF), local file inclusion (LFI), directory traversal, and potentially even remote code execution[7]. These vulnerabilities were first featured in the OWASP Top 10 list in 2017 and are now grouped with security misconfigurations in the 2022 list[7].

FS Package

For the fs package, the latest version appears to be 11.3.0, which was published approximately 4 months ago (as of January 15, 2025)[6]. The fs package provides cross-platform file operations and is available for different programming environments.

There's also a similarly named fs package for R which provides a cross-platform, uniform interface to file system operations based on the libuv C library[10]. This package can be installed from CRAN or GitHub, but no specific version number is mentioned in the search results.

OneScript-Specific Information

Unfortunately, the search results don't contain specific information about XML parser or fs package versions designed specifically for OneScript. There's also no direct information about security vulnerabilities in xml-parser 0.1.1 or fs 1.2.0 for OneScript.

For the most accurate and up-to-date information about OneScript packages and their vulnerabilities, I would recommend checking OneScript's official documentation or package repositories, or using a vulnerability scanning tool like Snyk, which can detect vulnerabilities in various packages[8].

Citations:


Confirm OneScript Package Versions and Security

Please verify that the newly added dependencies in your OneScript package definition are both up-to-date and free of known vulnerabilities:

• File: packagedef (lines 28–30)

    .ЗависитОт("xml-parser", "0.1.1")  
    .ЗависитОт("logos", "1.7.1")  
    .ЗависитОт("fs", "1.2.0")  

• Check in the OneScript package registry (via the OneScript CLI or official repository) that:

  • “xml-parser” 0.1.1 is the latest stable release for OneScript.
  • “fs” 1.2.0 is the latest stable release for OneScript.
    • Run a security scan (e.g. Snyk, vendor advisories or CVE listings) to ensure there are no reported vulnerabilities for these versions.
tests/fixtures/verified-report.html (1)

1-57: Well-structured HTML fixture for testing benchmark export.

The HTML fixture is properly formatted with:

  • Valid HTML5 structure with appropriate meta tags
  • Clean CSS styling for readable table presentation
  • Proper table structure for benchmark metrics
  • Mock environment and benchmark data suitable for testing

The Russian language content aligns with the OneScript framework context.

tests/fixtures/verified-report.json (1)

1-49: Comprehensive JSON fixture with consistent mock data.

The JSON fixture provides excellent test coverage with:

  • Complete environment information (versions, hardware specs)
  • Comprehensive benchmark statistics including percentiles and memory data
  • Consistent mock values appropriate for deterministic testing
  • Proper Russian field names matching the framework conventions

The structure supports thorough validation of JSON export functionality.

src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортHtml.os (1)

1-12: Well-documented annotation for HTML export functionality.

The annotation implementation is excellent with:

  • Clear documentation explaining the HTML export purpose
  • Specific usage restrictions (only for ПриСозданииОбъекта method)
  • Helpful example demonstrating proper annotation usage
  • Proper annotation declaration syntax

The empty procedure body is appropriate for an annotation definition.

tests/fixtures/Классы/БенчмаркСАннотацямиКонфигурации.os (1)

9-13: LGTM! Comprehensive export configuration demonstrated.

The new annotations correctly demonstrate the export functionality:

  • &КаталогАртефактов properly specifies an artifact directory with a string parameter
  • Export format annotations cover all supported formats (Markdown, JSON, XML, HTML)
  • Annotations follow proper OneScript syntax and placement conventions

This fixture provides excellent coverage for testing the new export capabilities.

tests/fixtures/verified-report.md (1)

1-7: LGTM! Well-structured Markdown report fixture.

This fixture provides a proper template for testing Markdown export functionality:

  • Contains all expected sections: system info, CPU details, and results table
  • Follows standard Markdown table formatting conventions
  • Uses appropriate mock data for testing

Note: The static analysis warning about missing punctuation is a false positive - Markdown table formatting is correct as written.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: A punctuation mark might be missing here.
Context: ...----|-------:|-------:|-------:|------:| | Бенчмарк | 1.0 ms | 0.0 ns | 0.0 ns | ...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

src/BenchmarkOneScript/core/Модули/Бенчмаркинг.os (1)

12-12: LGTM! Documentation accurately reflects the enhanced return structure.

The addition of the ИмяКласса field to the return structure documentation is:

  • Properly formatted following existing conventions
  • Logically positioned as the first field in the structure
  • Essential for the new export functionality that requires class identification
src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортXml.os (1)

1-12: LGTM! Well-documented and properly implemented XML export annotation.

This annotation class demonstrates excellent adherence to OneScript framework conventions:

  • Comprehensive documentation with clear usage example
  • Proper restriction to ПриСозданииОбъекта method for class-level configuration
  • Correct &Аннотация declaration syntax
  • Minimal, focused implementation appropriate for a declarative annotation

The documentation clearly explains the purpose and provides practical usage guidance.

samples/benchmarks/Классы/БенчмаркЭкспортРезультатов.os (3)

1-4: LGTM! Comprehensive export format coverage.

The annotations demonstrate the full range of export formats supported by the new feature. The syntax is clean and follows the expected pattern for OneScript annotations.


5-6: Empty constructor is appropriate for this demo class.

The empty constructor is suitable for a sample benchmark class that doesn't require initialization.


8-11: Simple but effective benchmark implementation.

The 100ms pause provides a measurable operation for testing the export functionality without being too resource-intensive. The Экспорт keyword correctly marks this as an exported procedure.

src/BenchmarkOneScript/annotations/Классы/АннотацияКаталогАртефактов.os (2)

1-10: Excellent documentation with clear usage guidance.

The documentation is comprehensive and includes:

  • Clear description of the annotation's purpose
  • Scope limitation (only applies to ПриСозданииОбъекта)
  • Support for both absolute and relative paths
  • Practical usage example

11-13: Annotation implementation follows OneScript conventions.

The annotation declaration is properly structured with the correct syntax and naming convention. The empty procedure implementation is appropriate for an annotation class.

src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортJson.os (2)

1-9: Clear and consistent documentation.

The documentation effectively explains the annotation's purpose and provides a practical usage example. The format is consistent with other annotation files in the project.


10-12: Proper annotation implementation.

The annotation declaration and procedure implementation follow the established pattern and OneScript conventions correctly.

src/BenchmarkOneScript/annotations/Классы/АннотацияЭкспортMarkdown.os (2)

1-9: Consistent documentation following established pattern.

The documentation maintains consistency with other export annotation files, providing clear guidance on usage and scope.


10-12: Implementation follows established conventions.

The annotation declaration and procedure structure are consistent with other annotation classes in the project, demonstrating good architectural coherence.

src/BenchmarkOneScript/core/Модули/ЭкспортерыРезультатовБенчмарков.os (1)

1-12: LGTM! Clean implementation of global exporter registry.

The global exporter instances are properly initialized and the disabled linting rules are appropriate for this registry pattern module.

tests/helpers/Модули/ТестированиеБенчмарков.os (2)

34-36: Good defensive programming practice.

Setting a default delay value when undefined prevents potential issues with undefined values in test scenarios.


51-69: Well-structured mock environment setup for testing.

The new procedure properly sets up consistent mock environment data and generates benchmark reports for testing the export functionality. The mock values are clearly identifiable and appropriate for testing purposes.

tests/fixtures/verified-report.xml (1)

1-50: LGTM! Well-structured test fixture.

The XML fixture file is well-formed and properly structured for testing the XML export functionality. The Russian element names are consistent, and the data structure appropriately represents a benchmark report.

tests/ТестыКонфигурации.os (3)

5-5: Good addition of fluent assertions library.

The integration of the fluent library enhances the readability and expressiveness of the test assertions.


14-42: Comprehensive testing of new exporter functionality.

The enhanced test effectively validates that all four exporter types (Markdown, JSON, XML, HTML) are properly configured and that the artifact directory is correctly set.


577-612: Well-structured unit tests for new configuration features.

The three new test procedures provide excellent coverage for:

  • Setting artifact directory paths
  • Adding exporters to configuration
  • Clearing exporter collections

Each test is focused, isolated, and follows good testing practices.

src/BenchmarkOneScript/core/Классы/КонфигурацияБенчмарков.os (2)

15-16: Well-implemented configuration enhancements.

The addition of artifact directory and exporters management follows the existing class patterns perfectly. The default artifact directory path and proper initialization in the constructor are appropriate.

Also applies to: 29-29, 34-34, 43-43


520-567: Comprehensive API for artifact and exporter management.

The new exported methods provide a complete interface for managing artifacts and exporters with proper documentation and consistent naming conventions. The implementation correctly returns ЭтотОбъект for fluent API support.

src/BenchmarkOneScript/core/Модули/ЭкспортРезультатовБенчмарков.os (1)

1-75: Comprehensive benchmark data preparation for export.

The ПодготовитьРезультаты function excellently structures benchmark results for export, including:

  • Complete environment information extraction
  • Detailed statistics with comprehensive percentile calculations (P0-P100)
  • Proper memory allocation data processing
  • Well-organized data structure for various export formats

The implementation is thorough and handles all necessary benchmark data elements.

tests/ТестыБенчмарков.os (2)

7-7: Good test cleanup implementation.

The addition of the fs module and the ПослеЗапускаТеста cleanup procedure properly removes artifact files after each test run, ensuring test isolation.

Also applies to: 10-17


460-574:

Details

❌ Incorrect review comment

Fix missing fixture files before tests can pass.

The export test procedures are well-structured and follow good testing patterns, but they reference fixture files that don't exist in the repository, causing pipeline failures.

The following fixture files are missing and must be added:

  • ./tests/fixtures/verified-report.md
  • ./tests/fixtures/verified-report.json
  • ./tests/fixtures/verified-report.xml
  • ./tests/fixtures/verified-report.html

🏁 Script executed:

#!/bin/bash
# Verify the missing fixture files and check directory structure
echo "Checking for fixture files..."
fd "verified-report\.(md|json|xml|html)" tests/
echo "Listing tests directory structure..."
fd . tests/ --type d
echo "Checking all files in tests/fixtures if it exists..."
if [ -d "tests/fixtures" ]; then
    ls -la tests/fixtures/
else
    echo "tests/fixtures directory does not exist"
fi

Length of output: 1054


Incorrect missing fixture files warning

The fixture files (verified-report.md, .json, .xml, and .html) are already present under tests/fixtures/, so there’s no need to add them. Please disregard the original comment about missing fixtures.

Likely an incorrect or invalid review comment.

🧰 Tools
🪛 GitHub Actions: Контроль качества

[error] 467-467: Test 'Тест_ЭкспортВMarkdown' failed due to missing file: "/home/runner/work/BenchmarkOneScript/BenchmarkOneScript/./tests/fixtures/verified-report.md" (System.IO.FileNotFoundException).


[error] 496-496: Test 'Тест_ЭкспортВJson' failed due to missing file: "/home/runner/work/BenchmarkOneScript/BenchmarkOneScript/./tests/fixtures/verified-report.json" (System.IO.FileNotFoundException).


[error] 525-525: Test 'Тест_ЭкспортВXml' failed due to missing file: "/home/runner/work/BenchmarkOneScript/BenchmarkOneScript/./tests/fixtures/verified-report.xml" (System.IO.FileNotFoundException).


[error] 554-554: Test 'Тест_ЭкспортВHtml' failed due to missing file: "/home/runner/work/BenchmarkOneScript/BenchmarkOneScript/./tests/fixtures/verified-report.html" (System.IO.FileNotFoundException).

src/BenchmarkOneScript/core/Классы/ЗапускательБенчмарков.os (4)

3-4: Appropriate module dependencies for new export functionality.

The addition of logos and fs modules supports the new file system operations and enhanced console output in the export functionality.


35-35: Consistent documentation and implementation update.

The addition of ИмяКласса to both the return structure documentation and implementation provides valuable class name information for exporters.

Also applies to: 578-578


67-67: Well-integrated export functionality call.

The call to ЭкспортироватьРезультаты is properly placed after result display and follows the logical benchmark execution flow.


589-611: Comprehensive export results implementation.

The ЭкспортироватьРезультаты procedure excellently handles:

  • Conditional execution based on artifact directory configuration
  • Directory cleanup using ФС.ОбеспечитьПустойКаталог
  • Iteration through configured exporters
  • User-friendly artifact file listing with colored output

The implementation is robust and provides good user feedback.

src/BenchmarkOneScript/core/Модули/ИзвлекательКонфигурацииБенчмарков.os (1)

43-47: LGTM! Good integration of new annotation support.

The new procedure calls are properly placed after column annotation reading and follow the established pattern. The order makes sense logically - artifact directory first, then export formats.

Comment on lines 10 to 27
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add error handling for file operations.

The export procedure lacks error handling for file operations. File writing operations can fail due to permissions, disk space, or path issues, similar to the issue identified in the Markdown exporter.

Consider adding try-catch error handling:

 Процедура Записать(РезультатыБенчмарков) Экспорт

 	ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.json");

 	_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);

+	Попытка
 		Данные = ЭкспортРезультатовБенчмарков.ПодготовитьРезультаты(РезультатыБенчмарков);
 		
 		ПараметрыЗаписиJSON = Новый ПараметрыЗаписиJSON(ПереносСтрокJSON.Авто, Символы.Таб);
 		
 		ЗаписьJSON = Новый ЗаписьJSON();
 		ЗаписьJSON.ОткрытьФайл(ПутьКФайлу, "UTF-8", , ПараметрыЗаписиJSON);
 		ЗаписатьJSON(ЗаписьJSON, Данные);
 		ЗаписьJSON.Закрыть();
+	Исключение
+		_Лог.Ошибка("Ошибка при записи файла %1: %2", ПутьКФайлу, ОписаниеОшибки());
+		ВызватьИсключение;
+	КонецПопытки;

 	_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);

 КонецПроцедуры
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Процедура Записать(РезультатыБенчмарков) Экспорт
ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.json");
_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
Данные = ЭкспортРезультатовБенчмарков.ПодготовитьРезультаты(РезультатыБенчмарков);
ПараметрыЗаписиJSON = Новый ПараметрыЗаписиJSON(ПереносСтрокJSON.Авто, Символы.Таб);
ЗаписьJSON = Новый ЗаписьJSON();
ЗаписьJSON.ОткрытьФайл(ПутьКФайлу, "UTF-8", , ПараметрыЗаписиJSON);
ЗаписатьJSON(ЗаписьJSON, Данные);
ЗаписьJSON.Закрыть();
_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
КонецПроцедуры
Процедура Записать(РезультатыБенчмарков) Экспорт
ПутьКФайлу = ОбъединитьПути(
РезультатыБенчмарков.Конфигурация.КаталогАртефактов(),
РезультатыБенчмарков.ИмяКласса + "-report.json"
);
_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
Попытка
Данные = ЭкспортРезультатовБенчмарков.ПодготовитьРезультаты(РезультатыБенчмарков);
ПараметрыЗаписиJSON = Новый ПараметрыЗаписиJSON(ПереносСтрокJSON.Авто, Символы.Таб);
ЗаписьJSON = Новый ЗаписьJSON();
ЗаписьJSON.ОткрытьФайл(ПутьКФайлу, "UTF-8", , ПараметрыЗаписиJSON);
ЗаписатьJSON(ЗаписьJSON, Данные);
ЗаписьJSON.Закрыть();
Исключение
_Лог.Ошибка("Ошибка при записи файла %1: %2", ПутьКФайлу, ОписаниеОшибки());
ВызватьИсключение;
КонецПопытки;
_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
КонецПроцедуры
🤖 Prompt for AI Agents
In src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВJson.os
lines 10 to 27, the procedure Записать lacks error handling for file operations
which may fail due to permissions or disk issues. Wrap the file opening,
writing, and closing code in a try-catch block to catch exceptions. In the catch
block, log the error details using _Лог and ensure the procedure handles the
failure gracefully without crashing.

Comment on lines 10 to 68
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for file operations.

The export procedure lacks error handling for file operations. If the artifact directory doesn't exist or the file cannot be written, this will cause runtime exceptions.

Consider adding error handling:

 Процедура Записать(РезультатыБенчмарков) Экспорт

 	ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.html");

 	_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
+
+	Попытка
+		СоздатьКаталог(РезультатыБенчмарков.Конфигурация.КаталогАртефактов());
+	Исключение
+		// Каталог уже существует или создание не требуется
+	КонецПопытки;
 	
 	Части = Новый Массив();
 	// ... остальной код ...
 
+	Попытка
 		ЗаписьТекста = Новый ЗаписьТекста(ПутьКФайлу, КодировкаТекста.UTF8);
 		ЗаписьТекста.Записать(СтрСоединить(Части, Символы.ПС));
 		ЗаписьТекста.Закрыть();
+	Исключение
+		_Лог.Ошибка("Ошибка записи файла %1: %2", ПутьКФайлу, ОписаниеОшибки());
+		ВызватьИсключение;
+	КонецПопытки;

 	_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Процедура Записать(РезультатыБенчмарков) Экспорт
ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.html");
_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
Части = Новый Массив();
Части.Добавить("<!DOCTYPE html>");
Части.Добавить("<html lang='ru'>");
Части.Добавить("<head>");
Части.Добавить("<meta charset='utf-8' />");
Части.Добавить(Css());
Части.Добавить("</head>");
Части.Добавить("<body>");
Части.Добавить(СтрШаблон("<pre><code>%1</code></pre>", РезультатыБенчмарков.СредаОкружения.ВСтроку()));
Части.Добавить("<table>");
Части.Добавить("<thead>");
Части.Добавить("<tr>");
Для Каждого Колонка Из РезультатыБенчмарков.Отчет.Колонки Цикл
Части.Добавить("<th>");
Части.Добавить(Колонка.Заголовок);
Части.Добавить("</th>");
КонецЦикла;
Части.Добавить("</tr>");
Части.Добавить("</thead>");
Части.Добавить("<tbody>");
Для Каждого СтрокаОтчета Из РезультатыБенчмарков.Отчет.Таблица Цикл
Части.Добавить("<tr>");
Для Каждого Колонка Из РезультатыБенчмарков.Отчет.Колонки Цикл
Части.Добавить("<td>");
Части.Добавить(Колонка.ПредставлениеЗначения(СтрокаОтчета[Колонка.Имя], СтрокаОтчета));
Части.Добавить("</td>");
КонецЦикла;
Части.Добавить("</tr>");
КонецЦикла;
Части.Добавить("</tbody>");
Части.Добавить("</table>");
Части.Добавить("</body>");
Части.Добавить("</html>");
ЗаписьТекста = Новый ЗаписьТекста(ПутьКФайлу, КодировкаТекста.UTF8);
ЗаписьТекста.Записать(СтрСоединить(Части, Символы.ПС));
ЗаписьТекста.Закрыть();
_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
КонецПроцедуры
Процедура Записать(РезультатыБенчмарков) Экспорт
ПутьКФайлу = ОбъединитьПути(
РезультатыБенчмарков.Конфигурация.КаталогАртефактов(),
РезультатыБенчмарков.ИмяКласса + "-report.html"
);
_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
// Попытка создать каталог артефактов, если его нет
Попытка
СоздатьКаталог(РезультатыБенчмарков.Конфигурация.КаталогАртефактов());
Исключение
// Каталог уже существует или создание не требуется
КонецПопытки;
Части = Новый Массив();
Части.Добавить("<!DOCTYPE html>");
Части.Добавить("<html lang='ru'>");
Части.Добавить("<head>");
Части.Добавить("<meta charset='utf-8' />");
Части.Добавить(Css());
Части.Добавить("</head>");
Части.Добавить("<body>");
Части.Добавить(
СтрШаблон("<pre><code>%1</code></pre>",
РезультатыБенчмарков.СредаОкружения.ВСтроку())
);
Части.Добавить("<table>");
Части.Добавить("<thead>");
Части.Добавить("<tr>");
Для Каждого Колонка Из РезультатыБенчмарков.Отчет.Колонки Цикл
Части.Добавить("<th>");
Части.Добавить(Колонка.Заголовок);
Части.Добавить("</th>");
КонецЦикла;
Части.Добавить("</tr>");
Части.Добавить("</thead>");
Части.Добавить("<tbody>");
Для Каждого СтрокаОтчета Из РезультатыБенчмарков.Отчет.Таблица Цикл
Части.Добавить("<tr>");
Для Каждого Колонка Из РезультатыБенчмарков.Отчет.Колонки Цикл
Части.Добавить("<td>");
Части.Добавить(
Колонка.ПредставлениеЗначения(
СтрокаОтчета[Колонка.Имя],
СтрокаОтчета
)
);
Части.Добавить("</td>");
КонецЦикла;
Части.Добавить("</tr>");
КонецЦикла;
Части.Добавить("</tbody>");
Части.Добавить("</table>");
Части.Добавить("</body>");
Части.Добавить("</html>");
// Попытка записать файл с логированием ошибок
Попытка
ЗаписьТекста = Новый ЗаписьТекста(ПутьКФайлу, КодировкаТекста.UTF8);
ЗаписьТекста.Записать(СтрСоединить(Части, Символы.ПС));
ЗаписьТекста.Закрыть();
Исключение
_Лог.Ошибка("Ошибка записи файла %1: %2", ПутьКФайлу, ОписаниеОшибки());
ВызватьИсключение;
КонецПопытки;
_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
КонецПроцедуры
🤖 Prompt for AI Agents
In src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВHtml.os
between lines 10 and 68, the procedure Записать lacks error handling for file
operations, which can cause runtime exceptions if the artifact directory is
missing or the file cannot be written. Add try-catch or equivalent error
handling around the file writing code to catch exceptions, ensure the artifact
directory exists before writing, and log or handle errors gracefully to prevent
crashes.

Comment on lines 11 to 26
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for file operations.

Similar to the HTML exporter, this procedure lacks error handling for file operations and directory creation.

Consider adding error handling:

 Процедура Записать(РезультатыБенчмарков) Экспорт

 	ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.xml");

 	_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);

+	Попытка
+		СоздатьКаталог(РезультатыБенчмарков.Конфигурация.КаталогАртефактов());
+	Исключение
+		// Каталог уже существует или создание не требуется
+	КонецПопытки;

 	Данные = ЭкспортРезультатовБенчмарков.ПодготовитьРезультаты(РезультатыБенчмарков);
 	ПодготовитьМассивы(Данные);
 	Данные = Новый Структура("Отчет", Данные);

+	Попытка
 		ПроцессорXML = Новый СериализацияДанныхXML(Ложь);
 		ПроцессорXML.ЗаписатьВФайл(Данные, ПутьКФайлу, Истина);
+	Исключение
+		_Лог.Ошибка("Ошибка записи XML файла %1: %2", ПутьКФайлу, ОписаниеОшибки());
+		ВызватьИсключение;
+	КонецПопытки;

 	_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Процедура Записать(РезультатыБенчмарков) Экспорт
ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.xml");
_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
Данные = ЭкспортРезультатовБенчмарков.ПодготовитьРезультаты(РезультатыБенчмарков);
ПодготовитьМассивы(Данные);
Данные = Новый Структура("Отчет", Данные);
ПроцессорXML = Новый СериализацияДанныхXML(Ложь);
ПроцессорXML.ЗаписатьВФайл(Данные, ПутьКФайлу, Истина);
_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
КонецПроцедуры
Процедура Записать(РезультатыБенчмарков) Экспорт
ПутьКФайлу = ОбъединитьПути(РезультатыБенчмарков.Конфигурация.КаталогАртефактов(), РезультатыБенчмарков.ИмяКласса + "-report.xml");
_Лог.Отладка("Начало формирования файла: %1", ПутьКФайлу);
Попытка
СоздатьКаталог(РезультатыБенчмарков.Конфигурация.КаталогАртефактов());
Исключение
// Каталог уже существует или создание не требуется
КонецПопытки;
Данные = ЭкспортРезультатовБенчмарков.ПодготовитьРезультаты(РезультатыБенчмарков);
ПодготовитьМассивы(Данные);
Данные = Новый Структура("Отчет", Данные);
Попытка
ПроцессорXML = Новый СериализацияДанныхXML(Ложь);
ПроцессорXML.ЗаписатьВФайл(Данные, ПутьКФайлу, Истина);
Исключение
_Лог.Ошибка("Ошибка записи XML файла %1: %2", ПутьКФайлу, ОписаниеОшибки());
ВызватьИсключение;
КонецПопытки;
_Лог.Отладка("Завершение формирования файла: %1", ПутьКФайлу);
КонецПроцедуры
🤖 Prompt for AI Agents
In src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВXml.os
lines 11 to 26, the procedure Записать lacks error handling for file operations
such as writing the XML file and ensuring the directory exists. Add try-catch
blocks around the file writing code to catch exceptions, and before writing,
check if the target directory exists and create it if necessary. Log any errors
encountered during these operations to improve robustness and debugging.

Comment on lines +256 to +286
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Significant code duplication detected - consider refactoring.

The four export format procedures follow an identical pattern with only the annotation name and exporter type varying. This creates maintenance overhead and violates the DRY principle.

Consider refactoring to a generic procedure:

+Процедура ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, ИмяАннотации, Экспортер)
+
+	Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, ИмяАннотации) Тогда
+		Конфигурация.ДобавитьЭкспортер(Экспортер);
+	КонецЕсли;
+
+КонецПроцедуры
+
 Процедура ПрочитатьАннотациюЭкспортMarkdown(СвойстваКонструктора, Конфигурация)
-
-	Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "ЭкспортMarkdown") Тогда
-		Конфигурация.ДобавитьЭкспортер(ЭкспортерыРезультатовБенчмарков.Markdown);
-	КонецЕсли;
-
+	ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, "ЭкспортMarkdown", ЭкспортерыРезультатовБенчмарков.Markdown);
 КонецПроцедуры

 Процедура ПрочитатьАннотациюЭкспортJson(СвойстваКонструктора, Конфигурация)
-
-	Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "ЭкспортJson") Тогда
-		Конфигурация.ДобавитьЭкспортер(ЭкспортерыРезультатовБенчмарков.Json);
-	КонецЕсли;
-
+	ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, "ЭкспортJson", ЭкспортерыРезультатовБенчмарков.Json);
 КонецПроцедуры

 Процедура ПрочитатьАннотациюЭкспортXml(СвойстваКонструктора, Конфигурация)
-
-	Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "ЭкспортXml") Тогда
-		Конфигурация.ДобавитьЭкспортер(ЭкспортерыРезультатовБенчмарков.Xml);
-	КонецЕсли;
-
+	ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, "ЭкспортXml", ЭкспортерыРезультатовБенчмарков.Xml);
 КонецПроцедуры

 Процедура ПрочитатьАннотациюЭкспортHtml(СвойстваКонструктора, Конфигурация)
-
-	Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "ЭкспортHtml") Тогда
-		Конфигурация.ДобавитьЭкспортер(ЭкспортерыРезультатовБенчмарков.Html);
-	КонецЕсли;
-
+	ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, "ЭкспортHtml", ЭкспортерыРезультатовБенчмарков.Html);
 КонецПроцедуры

Alternatively, consider a map-based approach to eliminate the individual procedures entirely and handle all export formats in a single procedure.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Процедура ПрочитатьАннотациюЭкспортMarkdown(СвойстваКонструктора, Конфигурация)
Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "ЭкспортMarkdown") Тогда
Конфигурация.ДобавитьЭкспортер(ЭкспортерыРезультатовБенчмарков.Markdown);
КонецЕсли;
КонецПроцедуры
Процедура ПрочитатьАннотациюЭкспортJson(СвойстваКонструктора, Конфигурация)
Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "ЭкспортJson") Тогда
Конфигурация.ДобавитьЭкспортер(ЭкспортерыРезультатовБенчмарков.Json);
КонецЕсли;
КонецПроцедуры
Процедура ПрочитатьАннотациюЭкспортXml(СвойстваКонструктора, Конфигурация)
Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "ЭкспортXml") Тогда
Конфигурация.ДобавитьЭкспортер(ЭкспортерыРезультатовБенчмарков.Xml);
КонецЕсли;
КонецПроцедуры
Процедура ПрочитатьАннотациюЭкспортHtml(СвойстваКонструктора, Конфигурация)
Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, "ЭкспортHtml") Тогда
Конфигурация.ДобавитьЭкспортер(ЭкспортерыРезультатовБенчмарков.Html);
КонецЕсли;
КонецПроцедуры
Процедура ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, ИмяАннотации, Экспортер)
Если РаботаСАннотациямиБенчмарков.ЕстьАннотация(СвойстваКонструктора, ИмяАннотации) Тогда
Конфигурация.ДобавитьЭкспортер(Экспортер);
КонецЕсли;
КонецПроцедуры
Процедура ПрочитатьАннотациюЭкспортMarkdown(СвойстваКонструктора, Конфигурация)
ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, "ЭкспортMarkdown", ЭкспортерыРезультатовБенчмарков.Markdown);
КонецПроцедуры
Процедура ПрочитатьАннотациюЭкспортJson(СвойстваКонструктора, Конфигурация)
ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, "ЭкспортJson", ЭкспортерыРезультатовБенчмарков.Json);
КонецПроцедуры
Процедура ПрочитатьАннотациюЭкспортXml(СвойстваКонструктора, Конфигурация)
ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, "ЭкспортXml", ЭкспортерыРезультатовБенчмарков.Xml);
КонецПроцедуры
Процедура ПрочитатьАннотациюЭкспортHtml(СвойстваКонструктора, Конфигурация)
ПрочитатьАннотациюЭкспорта(СвойстваКонструктора, Конфигурация, "ЭкспортHtml", ЭкспортерыРезультатовБенчмарков.Html);
КонецПроцедуры
🤖 Prompt for AI Agents
In src/BenchmarkOneScript/core/Модули/ИзвлекательКонфигурацииБенчмарков.os
between lines 256 and 286, there is repetitive code across four procedures that
differ only by annotation name and exporter type. Refactor by creating a single
generic procedure that accepts the annotation name and corresponding exporter as
parameters, then checks for the annotation and adds the exporter accordingly.
Alternatively, implement a map or dictionary linking annotation names to
exporter types and use one procedure to iterate over this map, eliminating the
need for separate procedures.

@Stivo182 Stivo182 marked this pull request as ready for review May 25, 2025 14:18
@Stivo182 Stivo182 changed the title feat: Экспорт результатов feat: Экспорт результатов в markdown, json, xml, html May 25, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (8)
tests/fixtures/verified-report.md (2)

1-2: Remove Byte Order Mark
The first line appears to include an invisible BOM character (U+FEFF) before “BenchmarkOneScript…”. This can lead to parsing issues in some environments. Please remove any leading hidden characters so the file starts exactly with BenchmarkOneScript….


7-7: Ensure trailing newline at EOF
Add a newline character at the end of the file to comply with POSIX conventions and prevent potential diff mismatches in fixture comparisons.

docs/ОбработчикиСобытий.md (1)

6-7: Fix heading level for proper document structure.

The heading should be h2 (##) instead of h3 (###) to follow proper markdown hierarchy, as it's directly under the main h1 heading.

-### Аннотации
+## Аннотации
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

6-6: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

docs/ЭкспортРезультатов.md (5)

5-5: Fix heading level for proper document structure.

The heading should be h2 (##) instead of h3 (###) to follow proper markdown hierarchy.

-### Настройка каталога артефактов
+## Настройка каталога артефактов
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)


54-54: Fix potential typo in directory name.

There appears to be a missing "а" in "Артефакты". The directory name should be "АртефактыЗапускаБенчмарков" instead of "АртефкатыЗапускаБенчмарков".

-&КаталогАртефактов("./АртефкатыЗапускаБенчмарков")
+&КаталогАртефактов("./АртефактыЗапускаБенчмарков")

60-60: Replace hard tab with spaces.

Use spaces instead of hard tabs for consistent formatting.

-	Приостановить(100);
+    Приостановить(100);
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

60-60: Hard tabs
Column: 1

(MD010, no-hard-tabs)


66-87: Add language specification to code block.

Specify the language for the code block to improve syntax highlighting and readability.

-```
+```text
BenchmarkOneScript v0.3.1, OneScript v2.0.0.567-rc7-29039316, Microsoft Windows NT 10.0.20348.0 \
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

66-66: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


83-86: Fix directory name consistency.

The directory name in the output should match the corrected name "Артефакты" instead of "Артефкаты".

-C:\myapp\АртефкатыЗапускаБенчмарков\ИмяКласса-report.html
-C:\myapp\АртефкатыЗапускаБенчмарков\ИмяКласса-report.json
-C:\myapp\АртефкатыЗапускаБенчмарков\ИмяКласса-report.md
-C:\myapp\АртефкатыЗапускаБенчмарков\ИмяКласса-report.xml
+C:\myapp\АртефактыЗапускаБенчмарков\ИмяКласса-report.html
+C:\myapp\АртефактыЗапускаБенчмарков\ИмяКласса-report.json
+C:\myapp\АртефактыЗапускаБенчмарков\ИмяКласса-report.md
+C:\myapp\АртефактыЗапускаБенчмарков\ИмяКласса-report.xml
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba770d6 and 2a53451.

📒 Files selected for processing (18)
  • docs/README.md (1 hunks)
  • docs/ОбработчикиСобытий.md (1 hunks)
  • docs/ЭкспортРезультатов.md (1 hunks)
  • samples/api/ЭкспортРезультатовПример.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЗапускательБенчмарков.os (5 hunks)
  • src/BenchmarkOneScript/core/Классы/КонфигурацияБенчмарков.os (4 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВHtml.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВJson.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВMarkdown.os (1 hunks)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВXml.os (1 hunks)
  • src/BenchmarkOneScript/core/Модули/ЭкспортРезультатовБенчмарков.os (1 hunks)
  • tests/fixtures/verified-report.html (1 hunks)
  • tests/fixtures/verified-report.json (1 hunks)
  • tests/fixtures/verified-report.md (1 hunks)
  • tests/fixtures/verified-report.xml (1 hunks)
  • tests/helpers/Модули/ТестированиеБенчмарков.os (2 hunks)
  • tests/ТестыБенчмарков.os (2 hunks)
  • tests/ТестыКонфигурации.os (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/README.md
🚧 Files skipped from review as they are similar to previous changes (13)
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВMarkdown.os
  • tests/fixtures/verified-report.xml
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВJson.os
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВXml.os
  • tests/helpers/Модули/ТестированиеБенчмарков.os
  • src/BenchmarkOneScript/core/Модули/ЭкспортРезультатовБенчмарков.os
  • src/BenchmarkOneScript/core/Классы/КонфигурацияБенчмарков.os
  • tests/ТестыБенчмарков.os
  • tests/fixtures/verified-report.html
  • tests/fixtures/verified-report.json
  • src/BenchmarkOneScript/core/Классы/ЭкспортерРезультатовБенчмарковВHtml.os
  • src/BenchmarkOneScript/core/Классы/ЗапускательБенчмарков.os
  • tests/ТестыКонфигурации.os
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
docs/ОбработчикиСобытий.md

6-6: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

docs/ЭкспортРезультатов.md

5-5: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)


60-60: Hard tabs
Column: 1

(MD010, no-hard-tabs)


66-66: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🪛 LanguageTool
tests/fixtures/verified-report.md

[uncategorized] ~5-~5: A punctuation mark might be missing here.
Context: ...----|-------:|-------:|-------:|------:| | Бенчмарк | 1.0 ms | 0.0 ns | 0.0 ns | ...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: sonar / test
  • GitHub Check: build (windows-latest, stable)
  • GitHub Check: build (ubuntu-latest, dev)
  • GitHub Check: build (windows-latest, dev)
  • GitHub Check: build (ubuntu-latest, stable)
  • GitHub Check: build (macos-latest, stable)
  • GitHub Check: build (macos-latest, dev)
  • GitHub Check: sonar / test
  • GitHub Check: build (windows-latest, stable)
  • GitHub Check: build (ubuntu-latest, dev)
  • GitHub Check: build (windows-latest, dev)
  • GitHub Check: build (ubuntu-latest, stable)
  • GitHub Check: build (macos-latest, stable)
  • GitHub Check: build (macos-latest, dev)
🔇 Additional comments (3)
tests/fixtures/verified-report.md (1)

4-6: Table formatting looks correct
The Markdown table header and separator align properly, and each row uses a trailing pipe. No changes needed here.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~5-~5: A punctuation mark might be missing here.
Context: ...----|-------:|-------:|-------:|------:| | Бенчмарк | 1.0 ms | 0.0 ns | 0.0 ns | ...

(AI_EN_LECTOR_MISSING_PUNCTUATION)

samples/api/ЭкспортРезультатовПример.os (1)

1-15:

Details

❓ Verification inconclusive

LGTM! Clear and comprehensive example.

This sample effectively demonstrates the new export functionality with:

  • Proper library imports and type creation
  • Configuration of custom artifact directory
  • Adding multiple exporters
  • Running the benchmark with the configured settings

The code structure follows OneScript conventions and provides a practical example for users.


🏁 Script executed:

#!/bin/bash
# Description: Verify that the referenced benchmark components exist in the codebase
# Expected: Find definitions for БенчмаркБазовый class and exporter constants

# Search for БенчмаркБазовый class definition
echo "Searching for БенчмаркБазовый class:"
fd -e os | xargs rg -l "БенчмаркБазовый"

# Search for ЭкспортерыРезультатовБенчмарков module
echo -e "\nSearching for ЭкспортерыРезультатовБенчмарков:"
fd -e os | xargs rg -l "ЭкспортерыРезультатовБенчмарков"

# Search for Html and Json exporter constants
echo -e "\nSearching for Html and Json exporters:"
rg -A 2 -B 2 "\.Html|\.Json" --type os

Length of output: 1314


Approved: Sample Export Functionality Example

This OneScript sample cleanly demonstrates the new export feature:

  • Imports the benchmark library and base type
  • Instantiates КонфигурацияБенчмарков and overrides the artifacts directory
  • Adds both HTML and JSON exporters
  • Executes the benchmark with the configured settings

I’ve verified the references to these identifiers in the sample and tests. Since these symbols belong to the external benchmarks library (imported via #Использовать "../benchmarks"), please ensure that:

  • Class БенчмаркБазовый is defined in the benchmarks module
  • Constants ЭкспортерыРезультатовБенчмарков.Html and .Json exist and are exported

No code changes needed here—just confirm their presence in the external library.

docs/ЭкспортРезультатов.md (1)

1-87: Excellent comprehensive documentation for the export feature.

This documentation effectively covers:

  • Clear explanation of default behavior and configuration options
  • Both annotation-based and programmatic API approaches
  • Practical examples with expected output
  • Complete API reference for exporters

The content is well-structured and provides users with all necessary information to use the export functionality effectively.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)


60-60: Hard tabs
Column: 1

(MD010, no-hard-tabs)


66-66: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

@sonar-openbsl-ru-qa-bot
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant