Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

feat: include the purity analysis into the 'run_api` command #241

Conversation

lukarade
Copy link
Contributor

@lukarade lukarade commented Mar 14, 2024

Closes #239

Summary of Changes

The newly added purity analysis entry function: get_purity_result is now called when the run_api command is executed.
It is the starting point of the purity analysis and runs it on the provided src_path string, representing the package to analyze.

This includes further improvements and bug fixes to the purity analysis itself.

@lukarade lukarade added the purity Inferring the purity of functions label Mar 14, 2024
@lukarade lukarade self-assigned this Mar 14, 2024
@lukarade lukarade linked an issue Mar 14, 2024 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Mar 14, 2024

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 16 0 0 2.43s
✅ PYTHON mypy 16 0 4.45s
✅ PYTHON ruff 16 0 0 0.07s
✅ REPOSITORY git_diff yes no 0.03s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@lukarade
Copy link
Contributor Author

lukarade commented Apr 20, 2024

This PR is ready for review, except for the one failed test due to a recursion bug I cannot fix. It would be great if you could take a look at it @lars-reimann.

I tried to change the __hash__ methods to no longer use str(), which solved the problem by using only the attributes with primitive datatypes for hashing.
On the other hand, this simple hashing approach led to different objects being equal.
When using attributes with a non-primitive data types to fix this, the RecursionError occurred again.

lukarade and others added 3 commits April 22, 2024 10:29
…ysis-into-the-run_api-command' into 239-feat-include-the-purity-analysis-into-the-run_api-command

# Conflicts:
#	src/library_analyzer/processing/api/purity_analysis/_get_module_data.py
@lukarade
Copy link
Contributor Author

@lars-reimann the fix we found lead to some other tests failing. I will fix this, but it will take a while.

This PR is ready for review, except for the one failed test due to a recursion bug I cannot fix. It would be great if you could take a look at it @lars-reimann.

I tried to change the __hash__ methods to no longer use str(), which solved the problem by using only the attributes with primitive datatypes for hashing. On the other hand, this simple hashing approach led to different objects being equal. When using attributes with a non-primitive data types to fix this, the RecursionError occurred again.

@lars-reimann
Copy link
Member

@lars-reimann the fix we found lead to some other tests failing. I will fix this, but it will take a while.

No worries and good luck with that.

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

Attention: Patch coverage is 93.86107% with 38 lines in your changes are missing coverage. Please review.

Project coverage is 92.89%. Comparing base (4a5f673) to head (f4c47d6).

Files Patch % Lines
...er/processing/api/purity_analysis/model/_purity.py 83.56% 12 Missing ⚠️
...er/processing/api/purity_analysis/_infer_purity.py 92.62% 9 Missing ⚠️
...cessing/api/purity_analysis/_resolve_references.py 98.18% 5 Missing ⚠️
...rocessing/api/purity_analysis/model/_call_graph.py 54.54% 5 Missing ⚠️
...ocessing/api/purity_analysis/model/_module_data.py 91.07% 5 Missing ⚠️
...processing/api/purity_analysis/_get_module_data.py 95.23% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #241      +/-   ##
==========================================
+ Coverage   92.67%   92.89%   +0.22%     
==========================================
  Files          97       98       +1     
  Lines        6467     6773     +306     
==========================================
+ Hits         5993     6292     +299     
- Misses        474      481       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lukarade lukarade marked this pull request as ready for review April 26, 2024 10:11
@lukarade lukarade requested a review from a team as a code owner April 26, 2024 10:11
Copy link
Member

@lars-reimann lars-reimann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only had time for spot checks, but in that context everything looks great. Thank you!

@lars-reimann lars-reimann merged commit 7b09e3b into main May 1, 2024
8 checks passed
@lars-reimann lars-reimann deleted the 239-feat-include-the-purity-analysis-into-the-run_api-command branch May 1, 2024 09:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
purity Inferring the purity of functions
Projects
Status: ✔️ Done
Development

Successfully merging this pull request may close these issues.

Include the purity analysis into the run_api command
3 participants