Skip to content

use mago in pre-commit.com hooks #833

@matlads

Description

@matlads

Feature

I'd like to add code to mago so that integration with pre-commit.com style hooks is easier. pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. One of the supported languages is rust, which mago is written in.

Since the mago git repo results in an installable package or exposes an executable, it can be used with pre-commit. All that is required in the repo is too a small YAML file .pre-commit-hooks.yaml . An example would be something like so:

---
# mago pre-commit-hooks
 - id: mago-lint
   name: mago lint
   description: Lint using mago an extremely fast PHP linter, formatter, and static analyzer, written in Rust.
   entry: mago lint
   language: rust
   types: [php]

 - id: mago-fmt
   name: mago fmt
   description: format files using mago an extremely fast PHP linter, formatter, and static analyzer, written in Rust.
   entry: mago fmt
   language: rust
   types: [php]

Example

pre-commit run mago-lint --verbose --all-files
pre-commit run mago-fmt --verbose --all-files

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementRequest for additions or changes that improve existing functionality.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions