Giter Site home page Giter Site logo

pre-commit-text's Introduction

pre-commit-text tag python Build pre-commit

Scripts that can work as git hooks to modify (text) files. These scripts can be called directly or with the provided configuration for the pre-commit framework. For details see below.

Using pre-commit-text with pre-commit

Add this to your .pre-commit-config.yaml:

    -   repo: https://github.com/boidolr/pre-commit-text
        rev: v1.2.16  # Use the ref you want to point at
        hooks:
        -   id: pretty-format-yaml
        -   id: replace-tabs
        # -   id: ...

For an extended example see .pre-commit-config.yaml.

Available hooks

  • pretty-format-yaml: Format yaml files.
    • --mapping space to use as offset for mappings.
    • --sequence space to use as offset for sequences (default is value for mapping plus two).
    • --preserve-quotes whether to keep quoting as is or change to default.
  • properties-whitespace: Remove whitespace around equal signs in property files. Implemented using the search-replace hook.
  • replace-tabs: Replace tabs in files.
    • --tabsize spaces to replace a tab with.
  • search-replace: Replace patterns in files.
    • --search regular expression to use for search.
    • --replacement replacement for matches.

Using scripts directly

Install the package to get access to the scripts defined as command line entry points in pyproject.toml. The scripts accept the arguments given for the pre-commit hooks. Additionally they exepect to receive the file names to work on.

An example invocation could be format-yaml --preserve-quotes .github/release.yml.

Available entry points are:

  • format-yaml
  • replace-tabs
  • search-replace

pre-commit-text's People

Contributors

boidolr avatar github-actions[bot] avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.