Makefile edits to improve library lint target support.
Makefile
--------
o Replace inlined includes with single $(MAKEDIR)/include.mk
o virtualenv install w/dependencies handled by makefiles/virtualenv.mk
o Use '&&' for command separation to improve error handling.
o Added more target documentation.
o Re-home doc8/rst syntax checking into makefiles/lint/doc8.mk.
howto/code/linting.rst
----------------------
o Document supported lint targets on docs.voltha.org.
howto/release/index.rst
howto/release/post-release/
howto/release/vcs/
---------------------------
o Document more release related activity (bugfix branch creation)
makefiles/consts.mk
-------------------
o Define and use more library macros.
config.mk
---------
o Per-repository library makefile configuration, disable linting.
makefiles/virtualenv.mk
-----------------------
o Library virtualenv install with dependences.
o Begin using a consistent install directory.
o Ugh: repository (voltha-docs) submodules each install a full venv.
o Install dependency drive based on existence of activate script.
o Lint targets updated to use activate script as a dependency.
o Update activate macro to run: set -u && activate && set +u
makefiles/patches/include.mk
----------------------------
o Update to use virtualenv.mk defined macros.
makefiles/lint/doc8.mk
makefiles/lint/python/flake8.mk
makefiles/lint/json.mk
makefiles/lint/python/pylint.mk
makefiles/lint/robot.mk
makefiles/lint/shell.mk
makefiles/lint/yaml.mk
-------------------------------
o All library linting defines consistent targets and logic.
o Support two library targets: lint-all and lint-modified.
o Default to checking all available sources.
o Linting can be disabled per-repository via {project}/config.mk
Change-Id: I7b7b5e523c867183d44244a0da21cfa3584e9a50
diff --git a/makefiles/lint/doc8.mk b/makefiles/lint/doc8.mk
new file mode 100644
index 0000000..e0594df
--- /dev/null
+++ b/makefiles/lint/doc8.mk
@@ -0,0 +1,79 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2022 Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-doc8 lint-doc8-all lint-doc8-modified
+
+have-rst-files := $(if $(strip $(RST_SOURCE)),true)
+RST_SOURCE ?= $(error RST_SOURCE= is required)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+ifndef NO-LINT-DOC8
+ lint-doc8-mode := $(if $(have-doc8-files),modified,all)
+ lint : lint-doc8-$(lint-doc8-mode)
+endif# NO-LINT-DOC8
+
+# Consistent targets across lint makefiles
+lint-doc8-all : lint-doc8
+lint-doc8-modified : lint-doc8
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+lint-doc8-excl += --ignore-path '$(venv-name)'
+lint-doc8-excl += --ignore-path '$(BUILDDIR)'
+
+# YUCK! -- overhead
+# o Submodule(s) use individual/variant virtualenv install paths.
+# o Exclude special snowflakes to enable library makefile use.
+# o [TODO] Use makefiles/virtualenv.mk to avoid duplication.
+
+lint-doc8-excl += --ignore-path '*/venv_cord'
+lint-doc8-excl += --ignore-path '*/vst_venv'
+
+lint-doc8-excl += --ignore-path './cord-tester'
+lint-doc8-excl += --ignore-path './repos/cord-tester'
+
+lint-doc8-excl += --ignore-path './bbsim/internal/bbsim/responders/sadis/dp.txt'
+lint-doc8-excl += --ignore-path './repos/bbsim/internal/bbsim/responders/sadis/dp.txt'
+lint-doc8-excl += --ignore-path './repos/voltha-helm-charts/voltha-infra/templates/NOTES.txt'
+lint-doc8-excl += --ignore-path './voltha-helm-charts/voltha-infra/templates/NOTES.txt'
+
+lint-doc8-args += --max-line-length 120
+
+lint-doc8: $(venv-activate-script)
+ @echo
+ @echo '** -----------------------------------------------------------------------'
+ @echo '** doc8 *.rst syntax checking'
+ @echo '** -----------------------------------------------------------------------'
+ $(activate) && doc8 --version
+ @echo
+ $(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args) .
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-doc8 Syntax check python using the doc8 command'
+ ifdef VERBOSE
+ @echo ' lint-doc8-all doc8 checking: exhaustive'
+ @echo ' lint-doc8-modified doc8 checking: only modified'
+ endif
+
+# [EOF]