S1144 False Positive when method referenced with variable other than self

Please provide

  • Operating system: MacOS 10.15.7 (19H1615)
  • SonarLint plugin version:
  • Programming language you’re coding in: Python 3.11.1
  • Is connected mode used: No
    • Connected to SonarCloud or SonarQube (and which version): N/A
class LinkedListNode:
    def __init__(self):
        self.next = None
        self.prev = None

    def __insert_next(self, node):
        node.next = self.next
        node.prev = self
        self.next.prev = node
        self.next = node

    def add_after_first_node(self, node, new_node):
        while node.prev is not None:
            node = node.prev

Expected: No issues reported.

For the last line in the code snippet above, sonarlint reports:

Remove this unused class-private ‘__insert_next’ method.

If the last line is changed to:


then the issue goes away.

Hello @rossbundy , thank you for your report.

This is indeed a false-positive in our analyzer. I created a ticket to keep track of this problem on our side.



Thank you, Gyula! :slight_smile: