Review of "CC Usage" version 2

Details Page Preview

Shows CC session usage in the top bar. Displays 5h window consumed %, time remaining, and weekly budget tracking. Detailed breakdown available on click.

Extension Homepage
https://github.com/SirAllap/ccusage-gnome

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 6

Shexli found 6 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:159
    Gio.File.new_for_path(path).load_contents(null)

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:122
            this._detailsLabel = new St.Label({
                x_expand: true,
                style: 'font-size: 12px; font-family: monospace;',
            })
  • extension.js:136
            this._footerLabel = new St.Label({
                x_expand: true,
                style: 'font-size: 11px; font-family: monospace;',
            })
  • extension.js:56
            this._icon = new St.Icon({
                gicon,
                icon_size: 16,
                y_align: Clutter.ActorAlign.CENTER,
                style: 'margin: 0 2px 0 4px;',
            })
  • extension.js:65
            this._label = new St.Label({
                y_align: Clutter.ActorAlign.CENTER,
                style: 'font-size: 12px; margin: 0 4px 0 0;',
            })

EGO-L-005 warning

owned object references should be released in disable()

Owned references that are cleaned up in `disable()` should also be released with `null` or `undefined`.

Destroy all objects

  • extension.js:122
            this._detailsLabel = new St.Label({
                x_expand: true,
                style: 'font-size: 12px; font-family: monospace;',
            })
  • extension.js:56
            this._icon = new St.Icon({
                gicon,
                icon_size: 16,
                y_align: Clutter.ActorAlign.CENTER,
                style: 'margin: 0 2px 0 4px;',
            })
  • extension.js:53
    this._indicator = new PanelMenu.Button(0.5, 'ccusage-gnome', false)
  • extension.js:65
            this._label = new St.Label({
                y_align: Clutter.ActorAlign.CENTER,
                style: 'font-size: 12px; margin: 0 4px 0 0;',
            })

EGO-L-003 warning

signals connected by extension should be disconnected in disable()

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

Disconnect all signals

  • extension.js:80
            this._indicator.menu.connect('open-state-changed', (_menu, open) => {
                if (open) this._update();
            })

EGO-L-004 warning

main loop sources should be removed in disable()

Main loop sources assigned in `enable()` are missing matching removals in `disable()` or its helper methods.

Remove main loop sources

  • extension.js:247
            this._pollTimer = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, POLL_SECS, () => {
                const fetching = this._isFetchRunning();
                this._render(this._loadCache(), fetching);
                if (!fetching) {
                    this._pollTimer = null;
                    return GLib.SO
  • extension.js:207
                this._spinTimer = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 33, () => {
                    if (!this._icon || this._iconState !== 'loading') {
                        this._spinTimer = null;
                        return GLib.SOURCE_REMOVE;
                    }
                    this._icon.rotation_angle
  • extension.js:88
            this._timer = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, REFRESH_SECS, () => {
                this._update();
                return GLib.SOURCE_CONTINUE;
            })

EGO-M-005 warning

metadata session-modes must be omitted when only user mode is declared

Field `session-modes` should be omitted when it only contains `user`.

metadata.json must be well-formed

  • metadata.json
    session-modes=['user']

All Versions

Version Status
3 Unreviewed
2 Rejected
1 Rejected

Previous Reviews on this Version

SriramRamkrishna rejected
Please look at the output of shexli. When the extension gets de-activated you need to clean up the components, the signals, and so on. You are also using synchronized file operations instead of their async versions. Please fix and resubmit.
sirallap posted a review
Thanks for taking time on this review. The updated code its already ready to review.