blob: 56b5e4949d0848360b2c4ca0820c8720352f5e91 [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
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## https://github.com/pycqa/doc8
45## create .config/doc8.ini
46## -----------------------------------------------------------------------
47lint-doc8-excl := $(foreach dir,$(onf-excl-dirs),--ignore-path "$(dir)")
48lint-doc8-excl += --ignore-path $(venv-name)
49lint-doc8: lint-doc8-cmd-version
50
51 $(call banner-enter,Target $@)
52 $(activate) && doc8 --version
53 @echo
54 $(activate) && doc8 $(lint-doc8-excl)
55 $(call banner-leave,Target $@)
56
57## -----------------------------------------------------------------------
58## Intent: Display command usage
59## -----------------------------------------------------------------------
60help::
61 @echo ' lint-doc8 Syntax check python using the doc8 command'
62 ifdef VERBOSE
63 @echo ' lint-doc8-all doc8 checking: exhaustive'
64 @echo ' lint-doc8-modified doc8 checking: only modified'
65 endif
66
67# [EOF]