Joey Armstrong | 96bcf1b | 2023-06-27 14:49:40 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | 2c03936 | 2024-02-04 18:51:52 -0500 | [diff] [blame] | 3 | # Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Joey Armstrong | 96bcf1b | 2023-06-27 14:49:40 -0400 | [diff] [blame] | 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 | |
| 23 | have-rst-files := $(if $(strip $(RST_SOURCE)),true) |
| 24 | RST_SOURCE ?= $(error RST_SOURCE= is required) |
| 25 | |
| 26 | ## ----------------------------------------------------------------------- |
| 27 | ## ----------------------------------------------------------------------- |
| 28 | ifndef NO-LINT-DOC8 |
| 29 | lint-doc8-mode := $(if $(have-doc8-files),modified,all) |
| 30 | lint : lint-doc8-$(lint-doc8-mode) |
| 31 | endif# NO-LINT-DOC8 |
| 32 | |
| 33 | # Consistent targets across lint makefiles |
| 34 | lint-doc8-all : lint-doc8 |
| 35 | lint-doc8-modified : lint-doc8 |
| 36 | |
| 37 | ## ----------------------------------------------------------------------- |
| 38 | ## ----------------------------------------------------------------------- |
| 39 | include $(MAKEDIR)/lint/doc8/excl.mk |
| 40 | |
| 41 | ifdef lint-doc8-excl |
| 42 | lint-doc8-excl-args += $(addprefix --ignore-path$(space),$(lint-doc8-excl)) |
| 43 | endif |
| 44 | lint-doc8-excl-args += $(addprefix --ignore-path$(space),$(lint-doc8-excl-raw)) |
| 45 | |
| 46 | lint-doc8-args += --max-line-length 120 |
| 47 | |
| 48 | lint-doc8: $(venv-activate-script) |
| 49 | @echo |
| 50 | @echo '** -----------------------------------------------------------------------' |
| 51 | @echo '** doc8 *.rst syntax checking' |
| 52 | @echo '** -----------------------------------------------------------------------' |
| 53 | $(activate) && doc8 --version |
| 54 | @echo |
| 55 | $(activate) && doc8 $(lint-doc8-excl-args) $(lint-doc8-args) . |
| 56 | |
| 57 | ## ----------------------------------------------------------------------- |
| 58 | ## Intent: Display command usage |
| 59 | ## ----------------------------------------------------------------------- |
| 60 | help:: |
| 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] |