Integration edits for repo:voltha-docs use.
This patch will add makefile targets and exclusions for doc8 (estructuredText) linting.
makefiles/lint/doc8/excl.mk
makefiles/lint/doc8/doc8.mk
makefiles/lint/doc8/help.mk
makefiles/lint/doc8/include.mk
makefiles/lint/doc8/install.mk
------------------------------
o Apply exclusion list so checking will not fail on python venv dirs.
o Split include.mk into named modular makfiles.
makefiles/lint/include.mk
makefiles/lint/shell.mk
-------------------------
o Remove legacy shell.mk config, lint target loads from lint/shell/*.
Change-Id: I8c214dc499356edf9778ae7ec1deeddf35bd3b65
diff --git a/makefiles/lint/doc8/doc8.mk b/makefiles/lint/doc8/doc8.mk
new file mode 100644
index 0000000..04101fe
--- /dev/null
+++ b/makefiles/lint/doc8/doc8.mk
@@ -0,0 +1,59 @@
+# -*- 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-doc8-files := $(if $(strip $(DOC8_SOURCE)),true)
+DOC8_SOURCE ?= $(error DOC8_SOURCE= is required)
+
+# -----------------------------------------------------------------------
+# Well that is annoying. Cannot pass two --config switches, doc8 will
+# use only one. Repos have more special exclusions so pass onf-make
+# doc8 config as command line args so local makefiles to use --config
+# -----------------------------------------------------------------------
+# lint-doc8-args += --config $(ONF_MAKEDIR)/lint/doc8/doc8.ini
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+ifndef NO-LINT-DOC8
+ lint-doc8-mode := $(if $(have-doc8-files),mod,all)
+ lint : lint-doc8-$(lint-doc8-mode)
+endif# NO-LINT-DOC8
+
+## -----------------------------------------------------------------------
+# Support consistent lint target names across makefiles
+# Clone logic makefiles/lint/shellcheck/shellcheck.mk deps
+# *-{mod, src} targets and exclusiosn.
+## -----------------------------------------------------------------------
+lint-doc8-all : lint-doc8
+lint-doc8-mod : lint-doc8
+lint-doc8-src : lint-doc8
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+## [TODO] - move lint-doc8-excl into doc8.ini
+lint-doc8-excl := $(foreach dir,$(onf-excl-dirs) $(lint-doc8-excl),--ignore-path "$(dir)")
+lint-doc8: lint-doc8-cmd-version
+
+ $(call banner-enter,Target $@)
+ $(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args)
+ $(call banner-enter,Target $@)
+
+# [EOF]
diff --git a/makefiles/lint/doc8/excl.mk b/makefiles/lint/doc8/excl.mk
index efa71da..65bf3fa 100644
--- a/makefiles/lint/doc8/excl.mk
+++ b/makefiles/lint/doc8/excl.mk
@@ -20,21 +20,31 @@
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-## excl := $(wildcar */*/.git)
+lint-doc8-excl-raw += '*/.git'
lint-doc8-excl-raw += '$(venv-name)'
lint-doc8-excl-raw += '*/$(venv-name)'
+
+# Should we filter generated content as redundant ?
+# Considering _build will be published and consumed.
$(if $(BUILDDIR),\
$(excl lint-doc8-excl-raw += '$(BUILDDIR)'))
+# -----------------------------------------------------------------------
# YUCK! -- overhead
# o Submodule(s) use individual/variant virtualenv install paths.
# o Exclude special snowflakes to enable library makefile use.
# o All can use virtualenv.mk for consistent names and cleanup
# o [TODO] Ignore submodules, individual repos should check their sources.
+# -----------------------------------------------------------------------
+lint-doc8-excl-raw += '*/venv_*'# # '*/venv_cord'
+lint-doc8-excl-raw += '*/*_cord'# # '*/vst_venv'
-lint-doc8-excl-raw += '*/venv_cord'
-lint-doc8-excl-raw += '*/vst_venv'
-
+## -----------------------------------------------------------------------
+## repo:voltha-docs exclusions
+## Migrate into one of:
+## makefiles/local/lint/doc8/doc8.ini
+## makefiles/local/lint/doc8/excl.mk
+## -----------------------------------------------------------------------
lint-doc8-excl-raw += './cord-tester'
lint-doc8-excl-raw += './repos/cord-tester'
diff --git a/makefiles/lint/doc8/help.mk b/makefiles/lint/doc8/help.mk
new file mode 100644
index 0000000..1ec6cb8
--- /dev/null
+++ b/makefiles/lint/doc8/help.mk
@@ -0,0 +1,46 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Display topic help
+## -----------------------------------------------------------------------
+help-summary ::
+ @printf ' %-30s %s\n' 'lint-doc8'\
+ 'Style check ReStructed Text (rst) documents'
+ @printf ' %-30s %s\n' 'lint-doc8-help'\
+ 'Show verbose target help'
+ ifdef VERBOSE
+ @$(MAKE) --no-print-directory lint-doc8-help
+ endif
+
+## -----------------------------------------------------------------------
+## Intent: Display extended topic help
+## -----------------------------------------------------------------------
+.PHONY: lint-doc8-help
+lint-doc8-help ::
+ @printf ' %-30s %s\n' 'lint-doc8-all'\
+ 'Doc8 check available sources'
+ @printf ' %-30s %s\n' 'lint-doc8-mod'\
+ 'Doc8 check locally modified files (git status)'
+# @printf ' %-30s %s\n' 'lint-doc8-src'\
+# 'Doc8 check files by path'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/doc8/include.mk b/makefiles/lint/doc8/include.mk
index 22a24fa..564fca9 100644
--- a/makefiles/lint/doc8/include.mk
+++ b/makefiles/lint/doc8/include.mk
@@ -15,59 +15,12 @@
# limitations under the License.
# -----------------------------------------------------------------------
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-.PHONY: lint-doc8 lint-doc8-all lint-doc8-modified
-
-have-doc8-files := $(if $(strip $(DOC8_SOURCE)),true)
-DOC8_SOURCE ?= $(error DOC8_SOURCE= is required)
-
##--------------------##
##---] INCLUDES [---##
##--------------------##
-# include $(ONF_MAKEDIR)/lint/doc8/help.mk
+include $(ONF_MAKEDIR)/lint/doc8/doc8.mk
+include $(ONF_MAKEDIR)/lint/doc8/excl.mk
+include $(ONF_MAKEDIR)/lint/doc8/help.mk
include $(ONF_MAKEDIR)/lint/doc8/install.mk
-# -----------------------------------------------------------------------
-# Well that is annoying. Cannot pass two --config switches, doc8 will
-# use only one. Repos have more special exclusions so pass onf-make
-# doc8 config as command line args so local makefiles to use --config
-# -----------------------------------------------------------------------
-# lint-doc8-args += --config $(ONF_MAKEDIR)/lint/doc8/doc8.ini
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-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
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-## [TODO] - move lint-doc8-excl into doc8.ini
-# lint-doc8-excl := $(foreach dir,$(onf-excl-dirs) $(lint-doc8-excl),--ignore-path "$(dir)")
-lint-doc8-excl := $(null)
-lint-doc8: lint-doc8-cmd-version
-
- $(call banner-enter,Target $@)
- $(activate) && doc8 --version
- @echo
- $(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args)
- $(call banner-enter,Target $@)
-
-## -----------------------------------------------------------------------
-## 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]