You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We reviewed changes in 9d1323c...f634b03 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
The reason will be displayed to describe this comment to others. Learn more.
Dangerous default value [] as argument
Do not use a mutable like list or dictionary as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.
The reason will be displayed to describe this comment to others. Learn more.
Dangerous default value {} as argument
Do not use a mutable like list or dictionary as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.
The reason will be displayed to describe this comment to others. Learn more.
Dangerous default value {} as argument
Do not use a mutable like list or dictionary as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.
The reason will be displayed to describe this comment to others. Learn more.
Dangerous default value [] as argument
Do not use a mutable like list or dictionary as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.
The reason will be displayed to describe this comment to others. Learn more.
Method doesn't use the class instance and could be converted into a static method
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
The reason will be displayed to describe this comment to others. Learn more.
Bare `except` masks non-recoverable runtime failures
A bare except catches KeyboardInterrupt and SystemExit alongside expected lookup errors. This hides real defects and can keep the process running in corrupted states while callers only see None.
Catch KeyError explicitly and log unexpected exceptions separately with except Exception before re-raising.
The reason will be displayed to describe this comment to others. Learn more.
Bare `except` hides export data corruption causes
Catching every exception makes export reliability opaque and can silently lose inventory records. Operators only get a generic log message, while the root error and stack context are discarded.
Use except Exception as exc with logger.exception(...), and consider re-raising or collecting failed SKUs for explicit caller handling.
get_unread constructs query with % interpolation of untrusted recipient. Attackers can alter the WHERE clause and read notifications not belonging to them.
Replace string formatting with parameterized SQL using ? placeholders and pass (recipient,) to execute
The reason will be displayed to describe this comment to others. Learn more.
`except:` hides runtime failures and returns stale behavior
get_unread swallows every exception and returns [], making real database or schema failures look like no unread notifications. This can suppress alerts and mislead downstream logic.
Replace except: with except sqlite3.Error as exc, log exc, and re-raise or return a typed error outcome
The reason will be displayed to describe this comment to others. Learn more.
Mutable `filters={}` default risks shared state bugs
filters uses a mutable default object. Even though current code does not mutate it, later edits can accidentally persist values across calls and create hard-to-debug cross-request coupling.
Replace with None and initialize inside the method using filters = {} if filters is None else filters.
The API accepts group_by but never applies grouping. Callers expecting per-group metrics silently receive global numbers, which can corrupt dashboards and downstream decisions.
Implement grouping when group_by is provided, or remove the parameter and update docstrings to match actual behavior.
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
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.
No description provided.