Skip to content

Custom pre-commit hooks for formatting source code

License

Notifications You must be signed in to change notification settings

pelotoncycle/fw-precommit-hooks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pre-commit-hooks

Contains custom hooks for the pre-commit python package for checking source code.

Support

This works with two different tools to format source code with the help of pre-commit:

  • astyle - an old package that does a pretty decent job, but no longer maintained
  • clang-format - a newer tools that is well supported with lots of formatting options

Usage

In order to use this, you need to add a section to your .pre-commit-config.yaml file to get this hook that specifies which of the formatters you want to use and give it a path to the options file(s). You can use either or both astyle or clang-format

Here is an example of clang format usage:

-   repo: https://github.com/delsauce/pre-commit-hooks
    rev: v1.0.0
    hooks:
    -   id: format-c-source
        types: [file, c]
        args: [--clangformat, 'path-to-clang-format-options-file']

If you'd rather use astyle change the args:

        args: [--astlye, 'path-to-astyle-options-file']

About

Custom pre-commit hooks for formatting source code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%