blob: e0594dfc25da9cf49d4fb53a4cda57f80d410dbd [file] [log] [blame]
Joey Armstrong4de98b72023-02-09 14:51:38 -05001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Copyright 2017-2022 Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# -----------------------------------------------------------------------
17
18##-------------------##
19##---] GLOBALS [---##
20##-------------------##
21.PHONY: lint-doc8 lint-doc8-all lint-doc8-modified
22
23have-rst-files := $(if $(strip $(RST_SOURCE)),true)
24RST_SOURCE ?= $(error RST_SOURCE= is required)
25
26## -----------------------------------------------------------------------
27## -----------------------------------------------------------------------
28ifndef NO-LINT-DOC8
29 lint-doc8-mode := $(if $(have-doc8-files),modified,all)
30 lint : lint-doc8-$(lint-doc8-mode)
31endif# NO-LINT-DOC8
32
33# Consistent targets across lint makefiles
34lint-doc8-all : lint-doc8
35lint-doc8-modified : lint-doc8
36
37## -----------------------------------------------------------------------
38## -----------------------------------------------------------------------
39lint-doc8-excl += --ignore-path '$(venv-name)'
40lint-doc8-excl += --ignore-path '$(BUILDDIR)'
41
42# YUCK! -- overhead
43# o Submodule(s) use individual/variant virtualenv install paths.
44# o Exclude special snowflakes to enable library makefile use.
45# o [TODO] Use makefiles/virtualenv.mk to avoid duplication.
46
47lint-doc8-excl += --ignore-path '*/venv_cord'
48lint-doc8-excl += --ignore-path '*/vst_venv'
49
50lint-doc8-excl += --ignore-path './cord-tester'
51lint-doc8-excl += --ignore-path './repos/cord-tester'
52
53lint-doc8-excl += --ignore-path './bbsim/internal/bbsim/responders/sadis/dp.txt'
54lint-doc8-excl += --ignore-path './repos/bbsim/internal/bbsim/responders/sadis/dp.txt'
55lint-doc8-excl += --ignore-path './repos/voltha-helm-charts/voltha-infra/templates/NOTES.txt'
56lint-doc8-excl += --ignore-path './voltha-helm-charts/voltha-infra/templates/NOTES.txt'
57
58lint-doc8-args += --max-line-length 120
59
60lint-doc8: $(venv-activate-script)
61 @echo
62 @echo '** -----------------------------------------------------------------------'
63 @echo '** doc8 *.rst syntax checking'
64 @echo '** -----------------------------------------------------------------------'
65 $(activate) && doc8 --version
66 @echo
67 $(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args) .
68
69## -----------------------------------------------------------------------
70## Intent: Display command usage
71## -----------------------------------------------------------------------
72help::
73 @echo ' lint-doc8 Syntax check python using the doc8 command'
74 ifdef VERBOSE
75 @echo ' lint-doc8-all doc8 checking: exhaustive'
76 @echo ' lint-doc8-modified doc8 checking: only modified'
77 endif
78
79# [EOF]