Review of "Battery Session Timer" version 22

Details Page Preview

Battery session timer with record saving for GNOME Shell

Extension Homepage
https://github.com/Gluk41/battery-session-timer

No comments.

Diff Against

Files

Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.

Shexli (experimental) warning 1

Shexli found 1 issue that may need reviewer attention.

EGO-X-004 warning

extensions should avoid synchronous file IO in shell code

Shell code should avoid synchronous file IO APIs like `GLib.file_get_contents()` and `Gio.File.load_contents()`.

File Operations

  • extension.js:559
    file.load_contents(null)
  • extension.js:585
    file.load_contents(null)
  • extension.js:642
    file.load_contents(null)

All Versions

Previous Reviews on this Version

Gluk41 posted a review
1. Ключевое исправление: Логика сброса сессии при пробуждении Что было: Расширение не сбрасывало сессию, если ноутбук заряжался во время сна (гибернации) и затем пробуждался. Что исправлено: Добавлена функция, которая при пробуждении системы сравнивает текущий заряд батареи с зарядом, сохранённым в файл сессии перед сном. Если заряд увеличился более чем на 5% (что однозначно указывает на подключение питания во время сна), текущая сессия принудительно завершается и начинается новая. Это гарантирует, что таймер показывает только реальное время активной работы от батареи. 2. Соответствие правилам публикации EGO (Расширенное руководство) EGO-A-004 (Логирование): Было: ~8 вызовов console.error, что превышало лимит в 5. Стало: Количество критических вызовов console.error сокращено до 5. Все необязательные логи и console.log() для отладки удалены. Результат: Скрипт check.sh теперь показывает 0 ошибок по этому правилу. EGO-M-008 (unlock-dialog): В метод disable() добавлен чёткий комментарий, объясняющий, почему расширение использует режим unlock-dialog (для отображения на экране блокировки). Это требование для прохождения проверки. EGO-L-002 (Уничтожение объектов): Проверено, что все виджеты (_indicator, _icon, _label и др.) корректно уничтожаются в методе _destroyIndicator(), который вызывается из disable(). Это предотвращает утечки памяти. Прочие проверки: Подтверждено отсутствие запрещённых импортов (Gtk, Lang, Mainloop) и использования веб-API (setTimeout, fetch и т.д.), что также требуется правилами EGO. 3. Исправления в коде и инфраструктуре extension.js: Удалены все отладочные console.log. Исправлен механизм сохранения/загрузки состояния сессии — теперь в файл battery-session-timer-session.json вместе с временем записывается и процент заряда батареи. metadata.json: Версия расширения обновлена до 6. Добавлена ссылка на репозиторий GitHub в поле "url". check.sh: Скрипт локальной проверки приведён к финальному виду, который проверяет все правила EGO и не требует установки Shexli, так как все проверки интегрированы в него. Структура и README: Выполнена синхронизация с GitHub: актуальный README.md находится в корне репозитория и не содержит лишней информации для разработчиков. Все файлы проекта (extension.js, core.js, metadata.json, stylesheet.css) приведены к финальному состоянию.
JustPerfection waiting for author
Is this code generated by AI? If so, we have a rule for that: [EGO Review Guidelines: AI](https://gjs.guide/extensions/review-guidelines/review-guidelines.html#extensions-must-not-be-ai-generated)
Gluk41 posted a review
Hello. Thank you for your review and for taking the time to look into my extension. To directly answer your question: The code was not generated by AI. I wrote the entire extension myself. However, I want to be completely transparent: I did use AI tools (like ChatGPT) during the development process, but strictly as a reference and learning aid. I used it in the same way one might use a search engine or read through API documentation. Specifically, I used it to quickly look up syntax examples for GJS, understand best practices for GNOME Shell extensions, and get debugging advice. All of the architectural decisions, the core logic of the extension, the structure of the code, and the implementation of features are my own. I understand every part of the code and can explain it in detail if needed. I hope this clarifies the situation. Please let me know if you have any further questions or need more information.
JustPerfection rejected
Ok. Didn't review but just to start, please use English description in `metadata.json`. Also, skimmed over the code and you cannot have selective disable 683-684 `extension.js`. and your code doesn't follow our guideline: - [Extensions Best Practices Guidelines](https://gjs.guide/extensions/review-guidelines/best-practices.html) - [EGO Review Guidelines: AI](https://gjs.guide/extensions/review-guidelines/review-guidelines.html) You should fix the code for following those guidelines, then I'll review the next package. Thanks! BTW, if you need any help with your extension you can ask us on: - [GNOME Extensions Matrix Channel](https://matrix.to/#/#extensions:gnome.org) - IRC Bridge: irc://irc.gimpnet.org/shell-extensions
Gluk41 posted a review
Hello. Thank you for your detailed review. I have updated the extension based on your feedback: * The `description` in `metadata.json` is now in English. * I have fixed the selective disable issue in the `disable()` method (removed the early return) to ensure all resources are properly cleaned up. * I have thoroughly reviewed the code against the provided Best Practices and EGO Review Guidelines and made the necessary adjustments. I have uploaded a new version (v7) for review. Please let me know if there are any other issues. Thanks!