ide-python icon indicating copy to clipboard operation
ide-python copied to clipboard

pyflakes doesn't detect unused instance variables

Open LukasWallisch opened this issue 5 years ago • 5 comments

Atom: 1.41.0 Electron: 4.2.7 Chrome: 69.0.3497.128 Node: v10.11.0 atom-ide-ui: 0.13.0 ide-python: 1.5.0 python-language-server: 0.31.0 pyflakes: 2.1.1

This is detected as unused: test = ""

This not -.- self.test = "" pyflakes_bug pyflakes_bug2

LukasWallisch avatar Nov 18 '19 10:11 LukasWallisch

Is it possible that test really never used?) Please provide the whole file.

stavinsky avatar Nov 18 '19 10:11 stavinsky

Hey Anton,

here’s the shortest example i could find: testfile.py:

# -*- Mode: Python; coding: utf-8 -*-
class TestClass():
    def init(self):
        test = ""
        self.test = ""

LukasWallisch avatar Nov 18 '19 15:11 LukasWallisch

The variable is unused. Because there is no other function in the initialization function or the calculation uses that variable, especially that variable is not used by self.

Translated by Google Translator

timmy61109 avatar Jan 09 '20 14:01 timmy61109

I didn't test but this may be a pyflakes bug.

leotada avatar Jan 31 '20 13:01 leotada

@lenlen I don't understand what you mean, can you describe it in more detail?

timmy61109 avatar Feb 03 '20 11:02 timmy61109