Migrate yamllint to pre-commit hook 69/64969/1
authorThanh Ha <zxiiro@gmail.com>
Sat, 8 Aug 2020 19:08:14 +0000 (15:08 -0400)
committerThanh Ha <zxiiro@gmail.com>
Sat, 8 Aug 2020 19:13:23 +0000 (15:13 -0400)
We'd like to move off of Coala as it hasn't had a release in a very
long time. This patch sets up the pre-commit configuration for the
yamllint hook as well as "prettier" for automated file formatting.

This patch also sets YAML indents to 2 as it is the corrent dominant
indent size for the YAML files in this project.

Issue: RELENG-2642
Change-Id: I3827d922023ac18519d94c906b211274ff3e65d9
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
.coafile
.editorconfig
.pre-commit-config.yaml
.yamllint.yaml [moved from yamllint.conf with 100% similarity]
docs_conf/defaults/default.yaml
docs_conf/defaults/lfdocs.yaml
docs_conf/defaults/onap.yaml
docs_conf/defaults/opendaylight.yaml
docs_conf/defaults/opnfv.yaml
docs_conf/defaults/oran.yaml
examples/conf.yaml

index 3cab223..464aed4 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -9,9 +9,3 @@ ignore = .tox/**,
 [all.Documentation]
 bears = WriteGoodLintBear
 files = docs/**.rst
-
-[all.YAML]
-bears = YAMLLintBear
-files = docs_conf/**.yaml
-document_start = True
-yamllint_config = yamllint.conf
index 3b13db5..c235528 100644 (file)
@@ -14,4 +14,4 @@ indent_size = 4
 max_line_legth = 88
 
 [*.yaml]
-indent_size = 4
+indent_size = 2
index 08519df..76fbb82 100644 (file)
@@ -11,27 +11,37 @@ repos:
   - repo: https://github.com/jorisroovers/gitlint
     rev: v0.13.1
     hooks:
-    -   id: gitlint
+      - id: gitlint
+
+  - repo: https://github.com/prettier/prettier
+    rev: 2.0.5
+    hooks:
+      - id: prettier
 
   - repo: https://github.com/ambv/black
     rev: stable
     hooks:
-    - id: black
+      - id: black
 
   - repo: https://gitlab.com/pycqa/flake8
     rev: 3.8.3
     hooks:
-    - id: flake8
-      args: ['--max-line-length=88']
+      - id: flake8
+        args: ["--max-line-length=88"]
 
   - repo: https://github.com/pycqa/bandit
     rev: 1.6.2
     hooks:
-    - id: bandit
-      # Bandit does not need to run on test code
-      exclude: tests/*
+      - id: bandit
+        # Bandit does not need to run on test code
+        exclude: tests/*
 
   - repo: https://github.com/pycqa/pydocstyle
     rev: 5.0.2
     hooks:
-    - id: pydocstyle
+      - id: pydocstyle
+
+  - repo: https://github.com/adrienverge/yamllint
+    rev: v1.24.2
+    hooks:
+      - id: yamllint
similarity index 100%
rename from yamllint.conf
rename to .yamllint.yaml
index bcf0140..1a0dbcc 100644 (file)
@@ -5,7 +5,7 @@ version: master
 author: DEFAULT_AUTHOR
 copyright: 2018, DEFAULT_PROJECT
 
-needs_sphinx: '1.6.5'
+needs_sphinx: "1.6.5"
 extensions:
   - sphinx.ext.autodoc
   - sphinx.ext.doctest
index 12d0315..578ecd9 100644 (file)
@@ -5,7 +5,7 @@ version: master
 author: Linux Foundation Releng
 copyright: 2017-2018, The Linux Foundation
 
-needs_sphinx: '1.6.5'
+needs_sphinx: "1.6.5"
 extensions:
   - sphinx.ext.autodoc
   - sphinx.ext.doctest
index c1c71dd..b605d1b 100644 (file)
@@ -3,15 +3,15 @@ project: onap
 release: master
 version: master
 
-author: 'Open Network Automation Platform'
+author: "Open Network Automation Platform"
 # yamllint disable-line rule:line-length
-copyright: '2020 ONAP. Licensed under Creative Commons Attribution 4.0 International License'
+copyright: "2020 ONAP. Licensed under Creative Commons Attribution 4.0 International License"
 
-pygments_style: 'sphinx'
+pygments_style: "sphinx"
 html_theme: sphinx_rtd_theme
 html_theme_options:
-  style_nav_header_background: 'white'
-  sticky_navigation: 'False'
+  style_nav_header_background: "white"
+  sticky_navigation: "False"
 html_logo: _static/logo_onap_2017.png
 html_favicon: _static/favicon.ico
 html_static_path:
@@ -36,7 +36,6 @@ extensions:
   - sphinxcontrib.plantuml
   - sphinxcontrib.swaggerdoc
 
-
 exclude_patterns:
   - .DS_Store
   - _build
index 2998551..2d968c9 100644 (file)
@@ -5,7 +5,7 @@ version: master
 author: OpenDaylight Project
 copyright: 2016-2018, OpenDaylight Project
 
-needs_sphinx: '1.6.5'
+needs_sphinx: "1.6.5"
 extensions:
   - sphinx.ext.autodoc
   - sphinx.ext.doctest
index aa74d69..1014f13 100644 (file)
@@ -5,7 +5,7 @@ version: Latest
 author: Open Platform for NFV
 copyright: 2020, OPNFV. Licensed under CC BY 4.0
 
-needs_sphinx: '1.3'
+needs_sphinx: "1.3"
 extensions:
   - sphinxcontrib.httpdomain
   - sphinx.ext.autodoc
@@ -17,7 +17,7 @@ html_theme: opnfv
 html_theme_options:
   bootswatch_theme: journal
   navbar_sidebarrel: false
-  navbar_title: ' '
+  navbar_title: " "
 html_logo: _static/logo.png
 html_favicon: _static/favicon.ico
 html_static_path:
index 53abb41..7fddb5e 100644 (file)
@@ -5,7 +5,7 @@ version: master
 author: O-RAN Project
 copyright: 2019, O-RAN Project
 
-needs_sphinx: '1.6.5'
+needs_sphinx: "1.6.5"
 extensions:
   - sphinx.ext.autodoc
   - sphinx.ext.doctest
@@ -26,5 +26,5 @@ html_static_path:
   - _static
 html_theme: sphinx_rtd_theme
 html_theme_options:
-  style_nav_header_background: 'white'
-  sticky_navigation: 'False'
+  style_nav_header_background: "white"
+  sticky_navigation: "False"
index bfac326..d260739 100644 (file)
@@ -6,7 +6,7 @@ version: 1.2.3
 author: OpenDaylight Project
 copyright: 2018, OpenDaylight Project a Series of LF Projects, LLC
 
-needs_sphinx: '1.6.5'
+needs_sphinx: "1.6.5"
 extensions:
   - sphinx.ext.autodoc
   - sphinx.ext.doctest