Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pysa][MLH] Hide warnings about high number of overrides #870

Open
arthaud opened this issue May 31, 2024 · 0 comments
Open

[pysa][MLH] Hide warnings about high number of overrides #870

arthaud opened this issue May 31, 2024 · 0 comments

Comments

@arthaud
Copy link
Contributor

arthaud commented May 31, 2024

When going through the pysa tutorial, users currently get these warnings:

ƛ  `libcst._nodes.base.CSTNode._codegen_impl` has 102 overrides, this might slow down the analysis considerably.
ƛ  `libcst._nodes.base.CSTNode._visit_and_replace_children` has 119 overrides, this might slow down the analysis considerably.
ƛ  `object.__eq__` has 371 overrides, this might slow down the analysis considerably.
ƛ  `object.__hash__` has 204 overrides, this might slow down the analysis considerably.
ƛ  `object.__init__` has 1811 overrides, this might slow down the analysis considerably.
ƛ  `object.__ne__` has 83 overrides, this might slow down the analysis considerably.
ƛ  `object.__repr__` has 340 overrides, this might slow down the analysis considerably.
ƛ  `object.__setattr__` has 59 overrides, this might slow down the analysis considerably.
ƛ  `object.__str__` has 110 overrides, this might slow down the analysis considerably.
ƛ  `type.__call__` has 289 overrides, this might slow down the analysis considerably.
ƛ  `type.__init__` has 1468 overrides, this might slow down the analysis considerably.
ƛ  `type.__new__` has 259 overrides, this might slow down the analysis considerably.
ƛ  `type.__or__` has 84 overrides, this might slow down the analysis considerably.
ƛ  `type.__ror__` has 52 overrides, this might slow down the analysis considerably.
ƛ  `typing.Collection.__len__` has 89 overrides, this might slow down the analysis considerably.
ƛ  `typing.GenericMeta.__getitem__` has 56 overrides, this might slow down the analysis considerably.
ƛ  `typing.Iterable.__iter__` has 82 overrides, this might slow down the analysis considerably.
ƛ  `typing.Iterator.__iter__` has 58 overrides, this might slow down the analysis considerably.
ƛ  `typing.Iterator.__next__` has 62 overrides, this might slow down the analysis considerably.
ƛ  `typing.Mapping.__getitem__` has 54 overrides, this might slow down the analysis considerably.
ƛ  `typing.NamedTuple.__init__` has 165 overrides, this might slow down the analysis considerably.

This is because classes with a lot of overrides can lead to slow down of the analysis, since Pysa needs to analyze each override.
To avoid this, we usually set the "maximum_overrides_to_analyze" option: https://pyre-check.org/docs/pysa-advanced/#ignoring-overrides

Anyway, this can be pretty confusing to a new user. Here is what we should do:

  • Define a maximum_overrides_to_analyze in the taint.config for each tutorial exercise
  • Improve the error message, saying something like "Use maximum_overrides_to_analyze to hide this message" or add a link to the documentation.
  • (Optional) Maybe add a default maximum_overrides_to_analyze when using pyre init_pysa.
facebook-github-bot pushed a commit that referenced this issue Jun 18, 2024
Summary:
#870

This pull request addresses the issue of warnings related to classes with a high number of overrides in Pysa. It includes the following changes:

**Update Override Warning Messages:**

Enhanced the warning messages for classes with many overrides to include a suggestion to use the maximum_overrides_to_analyze option.
Added a link to the relevant documentation for further guidance.

**Configuration Updates:**

Added the maximum_overrides_to_analyze option to the taint.config files for different exercises to improve analysis performance and reduce warning messages.

**Please provide any feedback as comments for this pull request. I will then apply the feedback and update the code. **

Pull Request resolved: #878

Reviewed By: tianhan0

Differential Revision: D58673147

Pulled By: arthaud

fbshipit-source-id: 364a5ec6865c737562906cda6d164120e8698b05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant