← Back to issue list

lint: initialize retcode to satisfy pyright

View original Github issue

Metadata

Project
snapcraft
Number
#4080
Type
pull request
State
merged
Author
tigarmo
Labels
—
Created
Updated
Closed

Current evaluation

Merged #4080 as commit 7ca78d626, initializing the CLI return code to satisfy Pyright.

Resolution: closed resolved

Reason: PR #4080 was approved and merged into main as commit 7ca78d626, setting retcode to 1 before CLI execution paths to resolve Pyright's possible-uninitialized warning.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Latest version of pyright complains that `retcode` might not be initialized. As far as I can tell, every code path sets a value (except for `run_legacy()` which does its own exit handling), so this initial setting to 1 is spurious but should be harmless. - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `make lint`? - [ ] Have you successfully run `pytest tests/unit`? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #4080 as commit 7ca78d626, initializing the CLI return code to satisfy Pyright.
stealth/space-bunny-alpha — closed resolved Merged PR #4080 into main, initializing retcode to 1 to satisfy Pyright. The one-line change was approved and reported 100% diff coverage.
qwen/qwen3.6-35b-a3b — — Merged a minor lint fix initializing the retcode variable to 1 to satisfy pyright type checking. The harmless change was approved, passed CI with 100% diff coverage, and merged into main.
qwen3.6-35b-a3b-mtp-q6 — — Merged a fix to initialize the retcode variable, resolving a pyright static analysis warning. The change satisfies the linter without altering runtime behavior and was accepted with full diff coverage.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#4205 lint: fix for pyright 1.1.312 snapcraft merged Merged #4205 (commit 6b94548db), fixing login argument typing for Pyright 1.1.312 so lint passes.
73%
#531 lint: update and freeze pyright craft-parts merged Merged in PR #531 as commit 2a4e7f2e, updating and freezing the Pyright version for reproducible linting.
71%
#58 lint: fix typing issues with updated pyright craft-archives merged Merged PR #58 as commit 7983916, fixing typing issues across seven files after Pyright was updated.
71%