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

Added configurable automatic fixing and docker support #30

Open
wants to merge 40 commits into
base: master
Choose a base branch
from

Conversation

indy2kro
Copy link
Contributor

Added multiple enhancements for the running and automatic fixing for hooks:

  • automatically_fix_errors: automatically run the fixer without any CLI prompt
  • rerun_analyzer_after_autofix: automatically re-run the analyzer command after autofix (by default it only runs once before the fix)
  • stop_at_first_analyzer_failure: stop (or not) at the first analyzer failure encountered - useful when many hooks are configured to see (and maybe fix) all the issues instead of running multiple times

Added various debug features:

  • output_errors: output any errors encountered during execution directly for easy debug
  • debug_commands: display the commands that are executed
  • debug_output: display the output of each command during execution directly for easy debug

Added support for docker execution for hooks - each hook can be configured independently using run_in_docker and docker_container parameter.

Small enhancement for file_extensions parameter on Larastan hook (was probably missed, it should only run for php files).

The default values for the new parameters are set so that they are compatible with the previous version behavior, for optimal usage would probably want to set to something like:

  • output_errors: true
  • automatically_fix_errors: true
  • rerun_analyzer_after_autofix: true
  • stop_at_first_analyzer_failure: false

Added unit tests for some of the functionality, unfortunately I was not able to get 100% code coverage though.

Also added dev deps for pestphp/pest-plugin-laravel for some better auto-completion and extra functionalities (not used for the new tests though).

Copy link

what-the-diff bot commented Apr 15, 2024

PR Summary

  • Introduction of Docker Support
    This update brings in the convenience of using Docker. It means users can now run this package in an environment that's isolated from the host system, leading to fewer compatibility issues and easier setup process.

  • Boosted Code Coverage
    We've improved the depth of our code testing coverage. This allows us to catch and prevent more potential errors and bugs before they get to the end user, enhancing our overall code quality and reliability.

  • Expanded Git Hook Configuration
    The configuration settings for git hooks have been enhanced. This new flexibility makes it easier for developers to modify the behavior of these hooks according to their needs.

  • Enhanced Checking of Pipeline Failures
    A new feature for monitoring pipeline failures has been added. This will help to quickly identify where and when failures occur, speeding up the overall debugging process.

  • Improved Handling of Failed Hooks
    We’ve updated the way failed hooks are dealt with in the pre-commit command, making error handling more efficient.

  • Updates to BaseCodeAnalyzerPreCommitHook
    We've augmented the BaseCodeAnalyzerPreCommitHook class by introducing new methods and parameters. This will further refine its ability to check and enforce code quality rules.

  • New Test Cases
    New test cases have been created specifically for Pint and Prettier pre-commit hooks. These additions enhance our verification checks in anticipating code quality and style rules.

  • Updates to TestCase Class
    We've added a new configuration setting to the TestCase class, giving developers more options for their testing setup.

cradu and others added 3 commits April 16, 2024 13:26
@indy2kro
Copy link
Contributor Author

Ack, I have Github's way of adding any new commits to the open PR - right now it became more or less a huge one with a ton of changes (which were not intended to be in a single PR) - although they are .. well, a lot, they are all quite nice, but they do extend the scope quite a bit by also adding strong typing and a few nice enhancements to the pipeline.
All this would be a nice addition to the original project, but it would clearly need an increase in the major version as it breaks compatibility with old custom hooks implementations.

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@igorsgm
Copy link
Owner

igorsgm commented Apr 22, 2024

Thanks for the contributions made so far @indy2kro. I will review and test them all during this week 🙏

Please let me know if you still have any WIP feature on this PR.

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