Skip to content

Make _channel_for_existing_addon a module function (Sonar S1845 follow-up to #534) - #557

Merged
mzeier merged 1 commit into
stage-eksfrom
419/r3-signing-s1845
Oct 10, 2026
Merged

mzeier merged 1 commit into
stage-eksfrom
419/r3-signing-s1845

Conversation

@mzeier

@mzeier mzeier commented Oct 10, 2026

Copy link
Copy Markdown

Follow-up to thunderbird/addons-server#534 for thunderbird/addons-server#419. The #534 Sonar check reported one new issue after it merged: python:S1845 (AaEjRtQRIbC7RohpvkDj) at src/olympia/signing/views.py:145, "Rename field POST to prevent any misunderstanding/clash with method post".

Cause

#534 extracted _channel_for_existing_addon(request, addon) as a @staticmethod on VersionView. Sonar read its first parameter as self, so request.POST looked like a class field clashing with VersionView.post(). It's a false positive, but the fix is cheap and keeps the PR at 0 new issues.

Change, no behavior change

The function moves, with an identical body, out of the class to module level next to _validate_url_guid. handle_upload calls _channel_for_existing_addon(request, addon) instead of self._channel_for_existing_addon(request, addon). It is called with the same arguments at the same point, and returns the same channel or raises the same ValidationError/400. Nothing patches this name in tests.

Decorators checked: handle_upload still carries @use_primary_db, get keeps @use_primary_db @with_addon(); the AST decorator comparison against stage-eks shows 0 changes. flake8 reports one E127 on a moved gettext continuation line, which was already there before the move.

Sonar issues closed

  • AaEjRtQRIbC7RohpvkDj python:S1845 src/olympia/signing/views.py:145

Local Greptile review skipped: org quota.

Sonar python:S1845 on the staticmethod: it read the first parameter
(request) as self and request.POST as a class field clashing with the
post() method. Same body, now a module-level function next to
_validate_url_guid; handle_upload calls it the same way.

Refs #419
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Python Test Results

5 763 tests  +5 763   5 709 ✅ +5 709   11m 52s ⏱️ + 11m 52s
    1 suites +    1      54 💤 +   54 
    1 files   +    1       0 ❌ ±    0 

Results for commit 0679a7b. ± Comparison against base commit fd10655.

@mzeier
mzeier merged commit b66b029 into stage-eks Oct 10, 2026
3 checks passed
@mzeier
mzeier deleted the 419/r3-signing-s1845 branch October 10, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant