facebook / pyre-check

Performant type-checking for python.
https://pyre-check.org/
MIT License
6.79k stars 432 forks source link

Added a stepLog API to reduce code duplication. #876

Closed esohel30 closed 2 months ago

esohel30 commented 2 months ago

845

This pull request introduces a new StepLogger API to simplify and standardize the logging and performance measurement process in the Pysa taint analysis codebase. By encapsulating common patterns of starting timers, logging information, and recording performance metrics, this API helps to reduce code duplication and improve maintainability.

Questions:

Is this the right Idea for the steplog API?

image

IF this general Idea is correct. Please take look at the newly created steplog.ml and stepLog.mli file and provide any feedback.

I will then implement the feedback and update the taintAnalysis.ml file and ask for feedback once again!

facebook-github-bot commented 2 months ago

Hi @esohel30!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

esohel30 commented 2 months ago

I updated the code according to the feedback. Please review again!

facebook-github-bot commented 2 months ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

esohel30 commented 2 months ago

Finished adding steplog api to places where applicable in taintAnalysis.ml to reduce code duplication

arthaud commented 2 months ago

Thanks, that's mostly it! We just have to make sure the end messages stay the same as before because we use those internally for statistics and monitoring.

esohel30 commented 2 months ago

All feedback has been applied and code is ready for a final review. I double checked but as there is a lot of code I probably missed a thing or two again. Sorry in advanced and thank you for the great feedback! I am really learning a lot and feeling more confident.

facebook-github-bot commented 2 months ago

@arthaud has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 2 months ago

@arthaud merged this pull request in facebook/pyre-check@847c396c1cf8b859fb924d63b0a895f7e5c1a19e.