openwisp-controller icon indicating copy to clipboard operation
openwisp-controller copied to clipboard

[fix] Misleading docstring in AbstractCommand._verify_connection

Open iamavichal-geek opened this issue 8 months ago • 2 comments

Description

In openwisp_controller/connection/base/models.py, the docstring for _verify_connection says:

def _verify_connection(self): """Raises validation error if device has no connection and credentials.""" if self.device and not self.device.deviceconnection_set.exists(): raise ValidationError({"device": _("Device has no credentials assigned.")})

The docstring says "no connection and credentials" which implies two separate checks. In reality, the method only checks deviceconnection_set that is whether any DeviceConnection objects are linked to the device.

The phrase "and credentials" in the docstring does not correspond to any code and will confuse contributors reading this method for the first time.

iamavichal-geek avatar Mar 08 '26 08:03 iamavichal-geek

Hi @pandafy , I noticed this while studying the command execution flow as part of exploring the codebase for GSoC 2026. This is a very slight change yet might confuse contributors exploring the codebase for the first time.

iamavichal-geek avatar Mar 08 '26 08:03 iamavichal-geek

@iamavichal-geek please refrain from openinig issues like this. Feel free to open a pull request to propose a different docstring which you perceive as less misleading but keep in mind we have hundred of PRs open and we are being flooded constantly with AI slop and AI generated PRs and I can't promise we'll look at it in a timely manner. This is not a real issue. This is a bug tracker, it's meant to track bugs, feature requests, real issues, not changes to docstrings or comments. Let's avoid flooding the bug tracker with trivialities.

nemesifier avatar Mar 08 '26 14:03 nemesifier