Skip to content

Add script to generate function map for static analysis tools #1436

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

Merged
merged 6 commits into from
Jun 22, 2023

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Jun 20, 2023

The newly added script generates function maps in the format that PHPStan and Psalm use. The function map is stored in scripts/functionmap.php. The script is invoked via a make target, ensuring that the extension is built to generate the correct map:

$ make generate-function-map

The script generates maps for all functions, classes, and interfaces in the MongoDB\BSON and MongoDB\Driver namespaces.

@alcaeus alcaeus requested a review from jmikola June 20, 2023 11:55
@alcaeus alcaeus self-assigned this Jun 20, 2023
@alcaeus
Copy link
Member Author

alcaeus commented Jun 21, 2023

I made some more changes. Previously, the script always generated the function map for the installed extension version. There is now a make target called generate-function-map, which invokes the script the same way run-tests.php is invoked. This ensures that the extension is built before invoking the script with the latest extension version loaded. Additionally, the script now places a functionmap.php file in the scripts directory. This file is not committed to git, but it allows reformatting the code a little easier before copying it over to the files for PHPStan and Psalm.

Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

Some small suggestions but LGTM with some contributing docs added.

@alcaeus alcaeus force-pushed the sa-function-map-generator branch from 5f013af to 4880238 Compare June 22, 2023 07:37
@alcaeus alcaeus merged commit 2cb650b into mongodb:master Jun 22, 2023
@alcaeus alcaeus deleted the sa-function-map-generator branch June 22, 2023 08:25
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

Successfully merging this pull request may close these issues.

3 participants