Repository navigation
Make _channel_for_existing_addon a module function (Sonar S1845 follow-up to #534) - #557
Merged
Merged
Conversation
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
2 tasks
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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) atsrc/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@staticmethodonVersionView. Sonar read its first parameter asself, sorequest.POSTlooked like a class field clashing withVersionView.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_uploadcalls_channel_for_existing_addon(request, addon)instead ofself._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 sameValidationError/400. Nothing patches this name in tests.Decorators checked:
handle_uploadstill carries@use_primary_db,getkeeps@use_primary_db @with_addon(); the AST decorator comparison against stage-eks shows 0 changes. flake8 reports one E127 on a movedgettextcontinuation line, which was already there before the move.Sonar issues closed
AaEjRtQRIbC7RohpvkDjpython:S1845src/olympia/signing/views.py:145Local Greptile review skipped: org quota.