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
I am using Visual Studio Code with Sourcery extension.
And I have encountered the bug multiple times, the bug is as follows:
Inside a script, if there is a class defined above a function, the function isn't a member of the class, Sourcery will mistake the function as a member of the class and show the following message:
Sourcery - The first argument to instance methods should be `self` sourcery(refactoring:instance-method-first-arg-name)
This is a bug, the function isn't part of the class definition. This can happen for various reasons, but the bug most frequently occurs when a class is added before a function in a script.
As an example:
class Button_Animation(QObject):
stopped = pyqtSignal()
change = pyqtSignal()
update = pyqtSignal()
def run(self):
while GLOBALS["run"]:
self.animate()
self.reset()
def animate(self):
while GLOBALS["pause"]:
QTest.qWait(42)
choices = list(range(12))
for name in TRINITY:
choice = random.choice(choices)
choices.remove(choice)
BUTTONS[choice] = name
texts = random.choices(TRINITY, k=9)
for name, i in zip(texts, choices):
BUTTONS[i] = name
self.change.emit()
self.update.emit()
def reset(self):
global BUTTONS
BUTTONS = BUTTONS_COPY.copy()
self.change.emit()
self.update.emit()
def init_connection(obj, worker, key):
thread = QThread()
worker.moveToThread(thread)
thread.started.connect(worker.run)
worker.stopped.connect(thread.quit)
GLOBALS[key] = worker
obj.qthread = thread
The message goes away if I close the editor and reopen it. But it will easily resurface if I add a new class or edit a class defined before a function.
How can I fix this?
The text was updated successfully, but these errors were encountered:
Hi @Estrangeling, this looks very much like a bug with our pattern matching system. I'll investigate and we'll hopefully have a fix in the next release.
This is the same as sourcery-ai/sourcery#328, so I'm going to close this issue in favour of the older one.
I am using Visual Studio Code with Sourcery extension.
And I have encountered the bug multiple times, the bug is as follows:
Inside a script, if there is a class defined above a function, the function isn't a member of the class, Sourcery will mistake the function as a member of the class and show the following message:
This is a bug, the function isn't part of the class definition. This can happen for various reasons, but the bug most frequently occurs when a class is added before a function in a script.
As an example:
The message goes away if I close the editor and reopen it. But it will easily resurface if I add a new class or edit a class defined before a function.
How can I fix this?
The text was updated successfully, but these errors were encountered: