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

Setup per use case #15

Open
xipasduarte opened this issue May 21, 2024 · 1 comment
Open

Setup per use case #15

xipasduarte opened this issue May 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@xipasduarte
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently the users are required to configure their standard manually, dealing with decisions that make it hard to go from composer require ... to codding with standard.

Describe the solution you'd like
Instead of recommending that the user be on her own, we should add commands that install what is required for the standard approach to PHPCS on a given framework, library, etc.. The commands will replace the existing docs and we'd need a unified interface to add support for other frameworks.

Describe alternatives you've considered
The current approach was considered, as a lower maintenance, but it pushes the burden to the user. We could be better at it, effectively improving the DX while using ph-pre-commit.

Additional context
None.

@xipasduarte xipasduarte added the enhancement New feature or request label May 21, 2024
@xipasduarte
Copy link
Member Author

A Proposal for the actual commands and restructuring.

We should add something that facilitates the CLI maintenance. Ideally something in PHP, to keep with the environment (Laravel Zero).

The CLI should include the following commands:

init

Initializes the library fully with a guided aid (interactive) or accepting flags to speedup. This would do the following:

  1. Hook into git hooks or any existing framework for hooks, like Husky
  2. Add the standards base (using templates: WordPress, Laravel)
  3. Build the local folder structure to keep standards local (.php-pre-commit/)
  4. Add command that runs the pre-commit action

run

Executes PHPCS and compares the diffs with support for what exists today.

hook

Adds the run command to the pre-commit hook. Also checks to see if the hook command is running in certain composer scripts to make sure it's always there.

setup

Downloads and activates all the standards that are specified for a given base (WordPress, Laravel).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant