Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Violation of Liskov Substitution Principle in RemoteTableModel #6604

Closed
drew2a opened this issue Dec 1, 2021 · 1 comment
Closed

Violation of Liskov Substitution Principle in RemoteTableModel #6604

drew2a opened this issue Dec 1, 2021 · 1 comment

Comments

@drew2a
Copy link
Contributor

drew2a commented Dec 1, 2021

Violation of LSP (which is considered bad practice) has been detected in

def perform_query(self, **kwargs):
"""
Fetch results for a given query.
"""
self.query_started.emit()
if 'first' not in kwargs or 'last' not in kwargs:
kwargs["first"], kwargs['last'] = self.rowCount() + 1, self.rowCount() + self.item_load_batch
if self.sort_by is not None:
kwargs.update({"sort_by": self.sort_by, "sort_desc": self.sort_desc})
txt_filter = to_fts_query(self.text_filter)
if txt_filter:
kwargs.update({"txt_filter": txt_filter})
if self.max_rowid is not None:
kwargs["max_rowid"] = self.max_rowid
if self.hide_xxx is not None:
kwargs.update({"hide_xxx": self.hide_xxx})
rest_endpoint_url = kwargs.pop("rest_endpoint_url") if "rest_endpoint_url" in kwargs else self.endpoint_url
TriblerNetworkRequest(rest_endpoint_url, self.on_query_results, url_params=kwargs)

Explanation

The function RemoteTableModel.perform_query uses attributes self.text_filter, self.hide_xxx, self.endpoint_url which are defined in ChannelContentModel class.

ChannelContentModel is a child class in relation to RemoteTableModel.

Refs:

@drew2a drew2a added this to the Backlog milestone Dec 1, 2021
@qstokkink
Copy link
Contributor

Tribler now has a web-based front end and this issue is no longer relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants