Skip to content

codeql PEP8 first argument should be self#16518

Draft
jsoref wants to merge 27 commits intoPowerDNS:masterfrom
jsoref:codeql-pep8-first-argument-should-be-self
Draft

codeql PEP8 first argument should be self#16518
jsoref wants to merge 27 commits intoPowerDNS:masterfrom
jsoref:codeql-pep8-first-argument-should-be-self

Conversation

@jsoref
Copy link
Contributor

@jsoref jsoref commented Nov 17, 2025

Short description

codeql complains (per PEP8) when the first argument to methods is not self: https://github.com/check-spelling-sandbox/pdns/security/quality/rules/py%2Fnot-named-self

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document, including the AI Policy, and added a "Signed-off-by" to my commits
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)
  • checked that this code was merged to master

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…callback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
….callback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…Callback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…Callback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…Callback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…gPathCallback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…llback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…hableCallback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…entAddr2Callback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…entAddr1Callback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
…lback

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Copy link
Contributor

@miodvallat miodvallat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As someone who always types slef when trying to type self, I am strongly opposed to that PR.

"""
_verboseMode = True

def NoSVCCallback(request):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right fix, shouldn't these methods become static instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try to reason through these because it looked like they were passed through a function callback. It required more python alertness than I have in the morning. -- Someone who's comfortable w/ python should weigh in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'm convinced it should be a staticmethod.

I'll do this from home.

"""

def callback(request, headers, fromQueue, toQueue):
def callback(self, headers, fromQueue, toQueue):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, I think they should be static methods.

@jsoref jsoref marked this pull request as draft November 17, 2025 14:53
return None

def from_wire(cls, otype, wire, current, olen):
def from_wire(self, otype, wire, current, olen):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think this is the correct change:

Suggested change
def from_wire(self, otype, wire, current, olen):
@classmethod
def from_wire(cls, otype, wire, current, olen):

"""
_verboseMode = True

def NoSVCCallback(request):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I'm convinced it should be a staticmethod.

I'll do this from home.

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.

3 participants