Replies: 1 comment 5 replies
-
Sounds like a bug. Can you provide a code sample (or a public source file would work) that exhibits this behavior? If so, we can take a look at it. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While it may be ideal to fix all issues flagged, in many cases that is not practical, and a system is desired so that only notifications for new issues or changed code are flagged.
This is wanted when trying to modernize older code, or to deal with changes in rules to the code scanning code that finds new issues.
My current home project is converting an old application from python2/GTK-2/libxml to python3/gtk-3/lxml.
The first phase is to convert to gtk-3 and lxml, so while python3 is the eventual target, for now the code needs to work on python2 so that I can debug it.
It would take far to long to fix all of the existing issues that pylint and now pylance are flagging, so I have to triage them as to issues that can be quickly fixed, and issues that must be deferred for a later pass.
I only found out about pylance when it started flagging additional issues in the source code, some of which are not blockers to getting the conversion done. Some issues will eventually be fixed by dropping the python2 support.
The PEP 484 specification for adding a # type: ignore is not taking into account that many of the lines that need the tags added are already at the maximum line length, and sometimes can not be easily refactored to shorter lines.
That feature of adding a "# type: ignore" to the end of a line is also not working correctly on the pylance bundled with Visual Studio Code 1.58.2.
Instead of operating on just that line, it is still operating on the entire file. So disabling it for line where it is a false positive like using importing modules from "six.moves" disables it for other places where it might be flagging a real issue that got introduced with a change.
Other code analysis and lint tools that I work with use comments at the beginning of a block or a scope or
at just before a line to disable a check. This works very well and is already a common convention.
Another convention that is used is to have the comments turn a check off only from the point where the comment is added and then a later comment can re-enable the check for the rest of the file.
Beta Was this translation helpful? Give feedback.
All reactions