Review of "Battery Session Timer" version 3

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 4

Shexli found 4 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:570
    file.load_contents(null)
  • extension.js:597
    file.load_contents(null)
  • extension.js:661
    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:336
    console.warn(`Battery Session Timer: logind недоступен, используется монотонный таймер: ${error}`)
  • extension.js:366
    console.warn(`Battery Session Timer: ошибка отключения сигнала logind: ${error}`)
  • extension.js:573
    console.warn(`Battery Session Timer: повреждён файл рекорда ${this._recordFile}`)
  • extension.js:651
    console.warn(`Battery Session Timer: не удалось удалить файл сессии ${this._sessionFile}: ${error}`)
  • extension.js:664
    console.warn(`Battery Session Timer: повреждён файл настроек ${this._settingsFile}`)
  • extension.js:260
    console.log(`Battery Session Timer: питание было подключено во время сна — сбрасываем сессию`)
  • extension.js:278
    console.log(`Battery Session Timer: заряд увеличился на ${chargeDiff}% (было ${this._resumedChargePercent}%, стало ${currentCharge}%) — сбрасываем сессию`)
  • extension.js:172
    console.error(`Battery Session Timer: не удалось подключиться к UPower: ${error}`)
  • extension.js:196
    console.error(`Battery Session Timer: не удалось получить DisplayDevice: ${error}`)

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:416
            this._icon = new St.Icon({
                icon_name: 'battery-good-symbolic',
                style_class: 'system-status-icon',
            })
  • extension.js:420
            this._label = new St.Label({
                text: '',
                y_align: Clutter.ActorAlign.CENTER,
            })
  • extension.js:431
            this._recordItem = new PopupMenu.PopupMenuItem('', {
                reactive: false,
            })
  • extension.js:428
            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:701
        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 4 was uploaded