blob: 22a24fabfd05bbad586385d4b979bbbabd7337b5 [file] [log] [blame]
Joey Armstrongf548adc2023-09-08 15:59:42 -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
Joey Armstrong686d3b92023-09-15 17:59:59 -040032# -----------------------------------------------------------------------
33# Well that is annoying. Cannot pass two --config switches, doc8 will
34# use only one. Repos have more special exclusions so pass onf-make
35# doc8 config as command line args so local makefiles to use --config
36# -----------------------------------------------------------------------
37# lint-doc8-args += --config $(ONF_MAKEDIR)/lint/doc8/doc8.ini
38
Joey Armstrongf548adc2023-09-08 15:59:42 -040039## -----------------------------------------------------------------------
40## -----------------------------------------------------------------------
41ifndef NO-LINT-DOC8
42 lint-doc8-mode := $(if $(have-doc8-files),modified,all)
43 lint : lint-doc8-$(lint-doc8-mode)
44endif# NO-LINT-DOC8
45
46# Consistent targets across lint makefiles
47lint-doc8-all : lint-doc8
48lint-doc8-modified : lint-doc8
49
50## -----------------------------------------------------------------------
Joey Armstrongf548adc2023-09-08 15:59:42 -040051## -----------------------------------------------------------------------
Joey Armstrong686d3b92023-09-15 17:59:59 -040052## [TODO] - move lint-doc8-excl into doc8.ini
53# lint-doc8-excl := $(foreach dir,$(onf-excl-dirs) $(lint-doc8-excl),--ignore-path "$(dir)")
54lint-doc8-excl := $(null)
Joey Armstrongf548adc2023-09-08 15:59:42 -040055lint-doc8: lint-doc8-cmd-version
56
57 $(call banner-enter,Target $@)
58 $(activate) && doc8 --version
59 @echo
Joey Armstrong686d3b92023-09-15 17:59:59 -040060 $(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args)
Joey Armstrongf128de82023-09-08 17:05:18 -040061 $(call banner-enter,Target $@)
Joey Armstrongf548adc2023-09-08 15:59:42 -040062
63## -----------------------------------------------------------------------
64## Intent: Display command usage
65## -----------------------------------------------------------------------
66help::
67 @echo ' lint-doc8 Syntax check python using the doc8 command'
68 ifdef VERBOSE
69 @echo ' lint-doc8-all doc8 checking: exhaustive'
70 @echo ' lint-doc8-modified doc8 checking: only modified'
71 endif
72
73# [EOF]