Сохранение батника в UTF8NoBOM#267
Conversation
Перед чтением - переключаем кодировку, после - возвращаем ту что была до запуска батника.
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughИсправление критической ошибки генерации ChangesИсправление генерации BAT-файлов с поддержкой Кириллицы
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/bat-launcher-test.os (1)
21-21: ⚡ Quick winПриведите имя теста к фактической проверке
Имя говорит «не содержит», но утверждение проверяет, что путь содержится. Лучше переименовать кейс так, чтобы он явно описывал проверку UTF-8/наличия кириллицы.
Also applies to: 36-37, 54-55
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/bat-launcher-test.os` at line 21, The test name ИменаТестов.Добавить("ТестДолжен_НеСодержатьАбсолютныйКириллицкийПутьВBatФайлеПриЛокальнойУстановке") contradicts the assertion (it actually checks that a Cyrillic/UTF-8 absolute path is present); rename this test to something like "ТестДолжен_СодержатьАбсолютныйКириллицкийПутьВBatФайлеПриЛокальнойУстановке" (and likewise update the other two test names at the similar occurrences) so the name explicitly states it verifies presence of a UTF-8/Cyrillic absolute path and matches the assertion behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/Классы/УстановкаПакета.os`:
- Around line 301-304: После вызова oscript (строка с
ФайлЗапуска.ЗаписатьСтроку("@call oscript ...")) сохраните текущий %ERRORLEVEL%
в временную переменную сразу же перед восстановлением code page, затем
выполняйте восстановление кодировки (ФайлЗапуска.ЗаписатьСтроку("@chcp %_opm_cp%
> nul")) и завершайте батник командой exit /b с использованием сохранённой
переменной вместо непосредственного %ERRORLEVEL%; другими словами, захватите код
возврата после вызова oscript и используйте эту сохранённую переменную при
ФайлЗапуска.ЗаписатьСтроку("@exit /b ...") чтобы вернуть корректный код
завершения.
---
Nitpick comments:
In `@tests/bat-launcher-test.os`:
- Line 21: The test name
ИменаТестов.Добавить("ТестДолжен_НеСодержатьАбсолютныйКириллицкийПутьВBatФайлеПриЛокальнойУстановке")
contradicts the assertion (it actually checks that a Cyrillic/UTF-8 absolute
path is present); rename this test to something like
"ТестДолжен_СодержатьАбсолютныйКириллицкийПутьВBatФайлеПриЛокальнойУстановке"
(and likewise update the other two test names at the similar occurrences) so the
name explicitly states it verifies presence of a UTF-8/Cyrillic absolute path
and matches the assertion behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c5221268-eb7e-4ba1-b96f-e2061dc3cc74
📒 Files selected for processing (3)
packagedefsrc/core/Классы/УстановкаПакета.ostests/bat-launcher-test.os
|
Выглядит интереснее чем мое решение |
Перед чтением - переключаем кодировку, после - возвращаем ту что была до запуска батника.
closes #265
Summary by CodeRabbit
Исправления ошибок
Тесты
Чистка кода