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

Enhance the hooks document generation process #1576

Open
1 of 2 tasks
ianlin opened this issue Jun 28, 2022 · 1 comment
Open
1 of 2 tasks

Enhance the hooks document generation process #1576

ianlin opened this issue Jun 28, 2022 · 1 comment
Labels
cooldown php Pull requests that update Php code type: enhancement The issue is a request for an enhancement.

Comments

@ianlin
Copy link
Member

ianlin commented Jun 28, 2022

Context

Follow-up from #1573 (comment), which it added a script to generate the hooks document and put it in src/Hooks/README.md.

User story

  • As a developer, I'd like the hooks document to be auto generated every time I add or remove the hooks (actions/filters).
  • As a developer I'd like the hooks document has a simple description under each hook.

Describe the solution you'd like

For auto generate hooks document:

  1. Add Git pre-commit hooks to check if the current staged changes have code difference with keywords do_action, add_action, apply_filter, and add_filter.
    • Maybe run git diff --cached --word-diff -U1 | grep -E 'add_action|do_action|add_filter|apply_filter'
  2. If yes, run the script to regenerate hooks document, then commit the changes (without the newly generated doc).
  3. Run git add and git commit again to commit the generated doc.

For adding descriptions under each hoook:

  1. Write down the hooks we used using PHPDoc.
  2. See if we can extend PHPDoc for having the custom tags in order to auto generate it.
  3. Also see if we can extend PHPDoc to generate the doc in markdown format and put it in src/Hooks/README.md.
@ianlin ianlin added type: enhancement The issue is a request for an enhancement. cooldown php Pull requests that update Php code labels Jun 28, 2022
@puntope
Copy link
Contributor

puntope commented Aug 21, 2023

As a developer, I'd like the hooks document to be auto generated every time I add or remove the hooks (actions/filters).

This part can be considered as done with #2060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cooldown php Pull requests that update Php code type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants