bobjacobsen / python-openlcb

MIT License
2 stars 1 forks source link

Unused variable: dest #2

Closed Poikilos closed 5 months ago

Poikilos commented 5 months ago
-                if destt == None:
-                    dest = NodeID(0)
+                if destt is not None:
+                    dest = NodeID(0)

I'm not 100% sure I know the right thing to do here to fix the area of code, so maybe let's come back to this after the next PR. Ok, I accidentally reversed the logic. Now it makes sense. PR will include correct change:

-                if destt == None:
-                    dest = NodeID(0)
+                if destt is None:
+                    destt = NodeID(0)
bobjacobsen commented 5 months ago

Thanks. Your commit comment mentions "static analysis". Is there some tool that you recommend for checking Python like this?

Poikilos commented 5 months ago

All of the above can also be used on the command line and most IDEs can be configured to have real-time checking or you can add it to a button in Geany for example (click-to-navigate to errors is possible if using a linter command argument setting it to an output style recognizable to Geany, if you place it in Geany's first two command slots in Build, Set Build Commands while having a py file open already which triggers the Python settings there). I recommend ruff since it tries to combine functionality of all of the others and is fast, but Flake8 is very good if various Flake8 extensions are installed.