From: Thanh Ha Date: Sat, 8 Aug 2020 19:24:48 +0000 (-0400) Subject: Migrate write-good to pre-commit hook X-Git-Tag: v0.6.0~3 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=737d84cf9b7cdaa12fe3b741ee185d5301120996;p=releng%2Fdocs-conf.git Migrate write-good to pre-commit hook This final patch removes our dependency on the Coala platform and migrates the write-good linter over to a pre-commit hook. Also resolves some write-good issues that were ignored on the Coala platform. Issue: INFRA-2642 Change-Id: I805f840bd651e76f877a9caccf9c4b80561aa01b Signed-off-by: Thanh Ha --- diff --git a/.coafile b/.coafile deleted file mode 100644 index 464aed4..0000000 --- a/.coafile +++ /dev/null @@ -1,11 +0,0 @@ -[all] -ignore = .tox/**, - .git/**, - .gitignore, - .gitreview, - .gitmodules, - node_modules/** - -[all.Documentation] -bears = WriteGoodLintBear -files = docs/**.rst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 76fbb82..3122cfc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -45,3 +45,14 @@ repos: rev: v1.24.2 hooks: - id: yamllint + + - repo: local + hooks: + # TODO: Switch to upstream hook when https://github.com/btford/write-good/pull/119 is merged. + - id: write-good + name: write-good + description: Check docs for English prose with write-good + entry: write-good + language: node + files: "\\.(rst|md|markdown|mdown|mkdn)$" + additional_dependencies: ["write-good"] diff --git a/README.rst b/README.rst index f7c3015..8996445 100644 --- a/README.rst +++ b/README.rst @@ -5,17 +5,17 @@ The purpose of this project is to allow LF projects a centralized location for storing common project configuration. To use this a project should create a conf.yaml file in the same -directory as their conf.py. Conf.py should contain at minimum:: +directory as their conf.py. The minimal configuration for ``conf.py`` is:: from docs_conf import * -The conf.yaml file should contain at minimum:: +The minimal configuration for ``conf.yaml`` file is:: --- project_cfg=myproject -If defaults for 'myproject' exist, they will be loaded from this -package, otherwise the basic Sphinx defaults will be set. +Docs will load default configuration for 'myproject' from this package if it +exists, otherwise it will load basic configuration from Sphinx defaults. Configuration precedence for configuration is as follows: @@ -25,26 +25,26 @@ Configuration precedence for configuration is as follows: #. docs_conf/defaults/default.yaml #. docs_conf/__init__.py -conf.py structure and documentation: +``conf.py`` structure and documentation: http://www.sphinx-doc.org/en/stable/config.html TODO ---- -- [ ] Define the minimum set of config values to release initial version. +- [ ] Define the minimal set of config values to release initial version. These can probably come from ODL/OPNFV site conf.py files. - [ ] Use sane defaults, and don't error out if something is not set. - Each config needs to be imported gracefully (if it doesn't - exist, set None or something; similar to dict.get + We must import each config cleanly (if it doesn't + exist, set None or something; like the function dict.get()). - [ ] Create own documentation for project detailing use of 'conf.cfg' file as some values will require subkeys given that they're dictionaries or expect a list of tuples. -- [ ] Setup and document section. The documentation already is organized - by section, so the config should also contain these section and look - for their values under them. +- [ ] Setup and document section. With the documentation organized by section, + the config should also contain these section and look for their values + under them. Sections: diff --git a/tox.ini b/tox.ini index affd716..d4421cf 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,6 @@ [tox] minversion = 2.0 envlist = - coala, docs, docs-linkcheck, pre-commit, @@ -14,21 +13,6 @@ deps = commands = pytest --basetemp={envtmpdir} {posargs} -[testenv:coala] -basepython = python3 -deps = - coala - coala-bears - nodeenv==1.1.2 - pygments~=2.3.1 -commands = - nodeenv -p - npm install --global write-good - # Workaround for systems that do not have `skip_install` (tox>=1.9) - pip install Sphinx~=1.4.9 - coala --non-interactive -skip_install=True - [testenv:docs] basepython = python3 deps = -rdocs/requirements.txt