From 679fa22ebe63544d95ba7d574f4c78ad64ac3d2a Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Tue, 9 Jul 2019 22:12:48 -0400 Subject: [PATCH] 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 --- .coafile | 7 ------- .pre-commit-config.yaml | 11 +++++++++++ tox.ini | 10 ++++++++-- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 .pre-commit-config.yaml 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 # ######### -- 2.16.6