Review of "Battery Session Timer" version 2

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 5

Shexli found 5 issues 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:569
    file.load_contents(null)
  • extension.js:596
    file.load_contents(null)
  • extension.js:660
    file.load_contents(null)

EGO-A-004 warning

extension files should not contain excessive ungated console logging

File contains 14 ungated console.log/warn/error calls (threshold: 5).

No excessive logging

  • extension.js:226
    console.warn(`Battery Session Timer: ошибка отключения сигнала UPower: ${error}`)
  • extension.js:335
    console.warn(`Battery Session Timer: logind недоступен, используется монотонный таймер: ${error}`)
  • extension.js:365
    console.warn(`Battery Session Timer: ошибка отключения сигнала logind: ${error}`)
  • extension.js:572
    console.warn(`Battery Session Timer: повреждён файл рекорда ${this._recordFile}`)
  • extension.js:650
    console.warn(`Battery Session Timer: не удалось удалить файл сессии ${this._sessionFile}: ${error}`)
  • extension.js:663
    console.warn(`Battery Session Timer: повреждён файл настроек ${this._settingsFile}`)
  • extension.js:254
    console.log(`Battery Session Timer: питание было подключено во время сна — сбрасываем сессию`)
  • extension.js:275
    console.log(`Battery Session Timer: заряд увеличился на ${diff}% (было ${this._resumedChargePercent}%, стало ${currentCharge}%) — сбрасываем сессию`)
  • extension.js:172
    console.error(`Battery Session Timer: не удалось подключиться к UPower: ${error}`)
  • extension.js:196
    console.error(`Battery Session Timer: не удалось получить DisplayDevice: ${error}`)

EGO-P-006 warning

unnecessary build and translation artifacts should not be shipped

Package contains files that often should not be shipped for review.

Don't include unnecessary files

  • .git/index
    .git/index
  • .git/description
    .git/description
  • .git/HEAD
    .git/HEAD
  • .git/config
    .git/config
  • .git/COMMIT_EDITMSG
    .git/COMMIT_EDITMSG
  • .git/hooks/pre-push.sample
    .git/hooks/pre-push.sample
  • .git/hooks/pre-merge-commit.sample
    .git/hooks/pre-merge-commit.sample
  • .git/hooks/pre-applypatch.sample
    .git/hooks/pre-applypatch.sample
  • .git/hooks/applypatch-msg.sample
    .git/hooks/applypatch-msg.sample
  • .git/hooks/post-update.sample
    .git/hooks/post-update.sample

EGO-L-002 warning

objects created by extension should be destroyed in disable()

Objects assigned in `enable()` are missing matching `.destroy()` calls in `disable()` or its helper methods.

Destroy all objects

  • extension.js:415
            this._icon = new St.Icon({
                icon_name: 'battery-good-symbolic',
                style_class: 'system-status-icon',
            })
  • extension.js:419
            this._label = new St.Label({
                text: '',
                y_align: Clutter.ActorAlign.CENTER,
            })
  • extension.js:430
            this._recordItem = new PopupMenu.PopupMenuItem('', {
                reactive: false,
            })
  • extension.js:427
            this._sessionItem = new PopupMenu.PopupMenuItem('', {
                reactive: false,
            })

EGO-M-008 warning

extensions using unlock-dialog must document it in disable() comments

Extensions using `unlock-dialog` should document the reason in `disable()` comments.

Session Modes

  • extension.js:700
        disable() {
            if (!this._enabled)
                return;
    
            this._tracker.tick(this._nowUs());
            const state = this._tracker.snapshot();
            this._saveRecordIfDirty();
            this._saveSessionState(state);
            this._enabled = false;
    
            if (this._timeoutId)
             

All Versions

Previous Reviews on this Version

Gluk41 auto- rejected
Auto-rejected because of new version 3 was uploaded