Commit efe5a029 authored by nimrod's avatar nimrod
Browse files

Merge branch 'pre-commit'

parents 2b6c9fe2 a78ed654
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@
include:
  - project: shore/ci-stuff
    file: templates/pre-commit.yml
  - project: shore/ci-stuff
    file: templates/pre-commit-repo.yml
  - project: shore/ci-stuff
    file: templates/python.yml

+6 −8
Original line number Diff line number Diff line
@@ -24,13 +24,6 @@ repos:
    hooks:
      - id: detect-secrets

  - repo: https://github.com/amperser/proselint.git
    rev: 0.10.2
    hooks:
      - id: proselint
        types: [plain-text]
        exclude: LICENSE

  - repo: https://gitlab.com/devopshq/gitlab-ci-linter.git
    rev: v1.0.2
    hooks:
@@ -103,3 +96,8 @@ repos:
    rev: '0.47'
    hooks:
      - id: check-manifest

  - repo: https://github.com/pre-commit/pre-commit.git
    rev: v2.15.0
    hooks:
      - id: validate_manifest

.pre-commit-hooks.yaml

0 → 100644
+8 −0
Original line number Diff line number Diff line
---
  - id: yamltool  # yamllint disable-line rule:indentation
    name: YAML tool
    description: Validate and pretty-print YAML files.
    language: python
    entry: yt
    args: ["--in-place"]
    types: [yaml]
+1 −0
Original line number Diff line number Diff line
include *.rst
include *.txt
exclude .pre-commit-config.yaml
exclude .pre-commit-hooks.yaml
exclude .gitlab-ci.yml
exclude .gitignore
+33 −10
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ Usage

.. code:: shell

   usage: yt [-h] [infile] [outfile]
    usage: yt [-h] [-i] [files ...]

    YAML tool, a clone of the json.tool Python module for YAML.

@@ -25,11 +25,34 @@ Usage
    documents (like comments and anchors).

    positional arguments:
     infile      a YAML file to be validated or pretty-printed
     outfile     write the output of infile to outfile
      files           a YAML file to be validated or pretty-printed

    optional arguments:
      -h, --help      show this help message and exit
      -i, --in-place  Perform the pretty-print in place, overwriting the existing files.

    When enabling --in-place, all files are processed as input files.
    When --in-place is not enabled and there are more then 2 files
    passed, the last files is considered as the output file. If you
    wish to pretty-print multiple files and output to standard out,
    specify the last file as "-" .
    Please note that specifying multiple input files will concatenate
    them, resulting in a single file that has multiple documents.

pre-commit hook
---------------

YAML tool can be used as a `pre-commit <https://pre-commit.com/>` hook by
adding the following to your :code:`.pre-commit-config.yaml` file:

.. code:: yaml

    ---
    repos:
      - repo: https://git.shore.co.il/nimrod/yamltool.git
        rev: 0.1.0  # Check for the latest tag or run pre-commit autoupdate.
        hooks:
          - id: yamltool

License
-------
Loading