From: Thanh Ha Date: Wed, 10 Jul 2019 02:12:48 +0000 (-0400) Subject: Use prettier for automatic formatting for YAML X-Git-Tag: v0.40.0~15 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F16141%2F3;p=releng%2Fglobal-jjb.git Use prettier for automatic formatting for YAML No more debate on style formatting, prettier is an opinionated style formatter that will automatically format to the right style. Signed-off-by: Thanh Ha Change-Id: If9aae2087c3299ae5d54728cd17d86c2b0dcb8a0 --- diff --git a/.coafile b/.coafile index 44f62150..c0e13b0b 100644 --- a/.coafile +++ b/.coafile @@ -44,10 +44,3 @@ files = **.sh shell = bash indent_size = 4 use_spaces = yeah - -[all.YAML] -bears = YAMLLintBear -files = **.yaml, **.yml -document_start = True -yamllint_config = yamllint.conf - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..a496135d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.2.1 + hooks: + - id: trailing-whitespace + + - repo: https://github.com/prettier/prettier + rev: 1.18.2 + hooks: + - id: prettier diff --git a/tox.ini b/tox.ini index bcde1a59..54b2761d 100644 --- a/tox.ini +++ b/tox.ini @@ -6,8 +6,9 @@ envlist = jjb, jjb-compare-xml, jjb-latest, - jjb-version - license + jjb-version, + license, + pre-commit skipsdist = true passenv = TOX_WORK_DIR toxworkdir = {env:TOX_WORK_DIR:/tmp/v} @@ -63,6 +64,11 @@ commands = python {toxinidir}/check_jjb_version.py deps = lftools commands = lftools license check-dir -r '.+' shell +[testenv:pre-commit] +deps = pre-commit +commands = + pre-commit run --all-files + ######### # Tools # #########