custom-components / pyscript

Pyscript adds rich Python scripting to HASS
Apache License 2.0
874 stars 46 forks source link

[Feature Request] Error/warning when function name is duplicated in code #557

Open j-steve opened 9 months ago

j-steve commented 9 months ago

One of the most frequent + annoying issues I've had when developing in PyScript is that sometimes I'll accidentally duplicate the name of a function in code, often from copying a function to make a second slightly different version. When this occurs, there's no errors in the code, but one of the functions will never trigger regardless of its trigger decorators.

I thought perhaps this was just a "me" problem but I saw another user mentioned this issue.

TLDR; it would be great if PyScript was able to throw an error/warning if it detected repeated top-level function names in a Python file.

(I'm not sure how feasible this would be or whether it is beyond the scope of the PyScript project, feel free to close this FR if so.)