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
A project I'm working on is quite large - has a lot of modules (so lots of imports) and a lot of dataclasses. The dataclasses (or other classes that do not contain their own methods) and their fields show as 100% covered if the module containing them was loaded, whether the classes / fields are used or not.
This can also happen with imports - the import is run, and the target module loaded, so coverage records them as covered. However, nothing actually used the module / functions / classes that were imported.
Describe the solution you'd like
A new option, similar to branch coverage, that collects the extra details at runtime (whether the class is instantiated, and which fields are accessed, which imports are used)
Highlight unused items in reports, similar to how missing branches are shown
Describe alternatives you've considered
Static checkers can sometimes find unused code, such as imports, but they usually assume that all functions / methods / branches are called, and do not report classes as unused if they are public and so could be used by another module.
Functions / methods could be included too, but I don't think that is necessary as the coverage of code within them is recorded.
Additional context
There are other things in python that behave in a similar way (are defined, given a name, and later accessed by that name) such as global variables.
The text was updated successfully, but these errors were encountered:
A project I'm working on is quite large - has a lot of modules (so lots of imports) and a lot of dataclasses. The dataclasses (or other classes that do not contain their own methods) and their fields show as 100% covered if the module containing them was loaded, whether the classes / fields are used or not.
This can also happen with imports - the import is run, and the target module loaded, so coverage records them as covered. However, nothing actually used the module / functions / classes that were imported.
Describe the solution you'd like
Describe alternatives you've considered
Static checkers can sometimes find unused code, such as imports, but they usually assume that all functions / methods / branches are called, and do not report classes as unused if they are public and so could be used by another module.
Functions / methods could be included too, but I don't think that is necessary as the coverage of code within them is recorded.
Additional context
There are other things in python that behave in a similar way (are defined, given a name, and later accessed by that name) such as global variables.
The text was updated successfully, but these errors were encountered: