Skip to content

[v9.0] fix: annotate DIRAC.exit as NoReturn (pylint E0606) - #8822

Merged
chrisburr merged 1 commit into
DIRACGrid:rel-v9r0from
aldbr:fix/dirac-exit-noreturn-v9r0
Oct 14, 2026
Merged

chrisburr merged 1 commit into
DIRACGrid:rel-v9r0from
aldbr:fix/dirac-exit-noreturn-v9r0

Conversation

@aldbr

@aldbr aldbr commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

pylint fails on every PR since astroid 4.3.4 reached conda-forge (8 Oct):

src/DIRAC/ConfigurationSystem/scripts/dirac_admin_add_site.py:58:11: E0606: Possibly using variable 'diracCSSite' before assignment

DIRAC.exit() (imported as DIRACExit) wraps sys.exit but is not annotated, so pylint cannot tell that a branch ending in DIRACExit(-1) stops there. astroid 4.3.3 happened to hide this. Annotating exit with NoReturn fixes this call site and every other DIRACExit call.

Checked in a conda env built from environment.yml (pylint 4.1.2): the error appears with astroid 4.3.4 and not with 4.3.3 (diracx 0.5.0 vs 0.6.0 makes no difference), and pylint -j 0 -E src/ is clean with this change.

Same change for each branch: rel-v8r0, rel-v9r0, integration (hence sweep:ignore).

BEGINRELEASENOTES
*Core
FIX: annotate DIRAC.exit as NoReturn so pylint knows DIRACExit ends a branch
ENDRELEASENOTES

🤖 Generated with Claude Code

astroid 4.3.4 makes pylint report possibly-used-before-assignment in
dirac_admin_add_site.py, because a branch that ends in DIRACExit(-1) is
not known to terminate. Annotating DIRAC.exit with NoReturn lets pylint
treat every DIRACExit call as the end of its branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aldbr
aldbr requested review from atsareg and fstagni as code owners October 9, 2026 07:06
@aldbr aldbr added the sweep:ignore Prevent sweeping from being ran for this PR label Oct 9, 2026
@chrisburr
chrisburr merged commit 1253dfc into DIRACGrid:rel-v9r0 Oct 14, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sweep:ignore Prevent sweeping from being ran for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants