blob: 4764fa20fd36732a5f4e46f2f76796a018a0ede8 [file] [log] [blame]
Joey Armstrongee4d8262023-08-22 15:19:19 -04001# -*- 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-doc8-files := $(if $(strip $(DOC8_SOURCE)),true)
24DOC8_SOURCE ?= $(error DOC8_SOURCE= is required)
25
26##--------------------##
27##---] INCLUDES [---##
28##--------------------##
29# include $(ONF_MAKEDIR)/lint/doc8/help.mk
30include $(ONF_MAKEDIR)/lint/doc8/install.mk
31
32## -----------------------------------------------------------------------
33## -----------------------------------------------------------------------
34ifndef NO-LINT-DOC8
35 lint-doc8-mode := $(if $(have-doc8-files),modified,all)
36 lint : lint-doc8-$(lint-doc8-mode)
37endif# NO-LINT-DOC8
38
39# Consistent targets across lint makefiles
40lint-doc8-all : lint-doc8
41lint-doc8-modified : lint-doc8
42
43## -----------------------------------------------------------------------
44## -----------------------------------------------------------------------
45lint-doc8-excl := $(foreach dir,$(onf-excl-dirs),--ignore-path "$(dir)")
46lint-doc8: lint-doc8-cmd-version
47
48 $(call banner-enter,Target $@)
49 $(activate) && doc8 --version
50 @echo
51 $(activate) && doc8 $(lint-doc8-excl)
52 $(call banner-enter,Target $@)
53
54## -----------------------------------------------------------------------
55## Intent: Display command usage
56## -----------------------------------------------------------------------
57help::
58 @echo ' lint-doc8 Syntax check python using the doc8 command'
59 ifdef VERBOSE
60 @echo ' lint-doc8-all doc8 checking: exhaustive'
61 @echo ' lint-doc8-modified doc8 checking: only modified'
62 endif
63
64# [EOF]