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

Add scripts/validate-flags.sh #734

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Jan 14, 2024

This script extracts all flag? macro values from the source code and compares them with the documentation.
It lists all flags that are currently defined but undocumented.

It depends on crystal tool flags, proposed in crystal-lang/crystal#14234

This could be automated in CI to check flag documentation regularly.
Adds a CI workflow that regularly checks flag documentation coverage.

Copy link

netlify bot commented Jan 14, 2024

Deploy Preview for crystal-book ready!

Name Link
🔨 Latest commit 2a26e0a
🔍 Latest deploy log https://app.netlify.com/sites/crystal-book/deploys/65c35d0e02b5580009a2eadc
😎 Deploy Preview https://deploy-preview-734--crystal-book.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@straight-shoota
Copy link
Member Author

As @Blacksmoke16 observed in #735 (comment), this script did miss out on flags that are handled by the compiler directly.

I added that now. It's not a fancy compiler tool that investigates the AST. But crystal tool flags is useful for any Crystal program, whereas Program#has_flag? is only relevant for the compiler. So a crude grep implementation does the job as well. There's less variation because the method only accepts String. And we control all the code.

@straight-shoota straight-shoota marked this pull request as ready for review February 7, 2024 10:40
@straight-shoota straight-shoota merged commit 79d5443 into crystal-lang:master Feb 8, 2024
9 checks passed
@straight-shoota straight-shoota deleted the infra/script-validate-flags branch February 8, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants