Joey Armstrong | f548adc | 2023-09-08 15:59:42 -0400 | [diff] [blame] | 1 | # -*- 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 | |
| 23 | have-doc8-files := $(if $(strip $(DOC8_SOURCE)),true) |
| 24 | DOC8_SOURCE ?= $(error DOC8_SOURCE= is required) |
| 25 | |
| 26 | ##--------------------## |
| 27 | ##---] INCLUDES [---## |
| 28 | ##--------------------## |
| 29 | # include $(ONF_MAKEDIR)/lint/doc8/help.mk |
| 30 | include $(ONF_MAKEDIR)/lint/doc8/install.mk |
| 31 | |
Joey Armstrong | 686d3b9 | 2023-09-15 17:59:59 -0400 | [diff] [blame] | 32 | # ----------------------------------------------------------------------- |
| 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 Armstrong | f548adc | 2023-09-08 15:59:42 -0400 | [diff] [blame] | 39 | ## ----------------------------------------------------------------------- |
| 40 | ## ----------------------------------------------------------------------- |
| 41 | ifndef NO-LINT-DOC8 |
| 42 | lint-doc8-mode := $(if $(have-doc8-files),modified,all) |
| 43 | lint : lint-doc8-$(lint-doc8-mode) |
| 44 | endif# NO-LINT-DOC8 |
| 45 | |
| 46 | # Consistent targets across lint makefiles |
| 47 | lint-doc8-all : lint-doc8 |
| 48 | lint-doc8-modified : lint-doc8 |
| 49 | |
| 50 | ## ----------------------------------------------------------------------- |
Joey Armstrong | f548adc | 2023-09-08 15:59:42 -0400 | [diff] [blame] | 51 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 686d3b9 | 2023-09-15 17:59:59 -0400 | [diff] [blame] | 52 | ## [TODO] - move lint-doc8-excl into doc8.ini |
| 53 | # lint-doc8-excl := $(foreach dir,$(onf-excl-dirs) $(lint-doc8-excl),--ignore-path "$(dir)") |
| 54 | lint-doc8-excl := $(null) |
Joey Armstrong | f548adc | 2023-09-08 15:59:42 -0400 | [diff] [blame] | 55 | lint-doc8: lint-doc8-cmd-version |
| 56 | |
| 57 | $(call banner-enter,Target $@) |
| 58 | $(activate) && doc8 --version |
| 59 | @echo |
Joey Armstrong | 686d3b9 | 2023-09-15 17:59:59 -0400 | [diff] [blame] | 60 | $(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args) |
Joey Armstrong | f128de8 | 2023-09-08 17:05:18 -0400 | [diff] [blame] | 61 | $(call banner-enter,Target $@) |
Joey Armstrong | f548adc | 2023-09-08 15:59:42 -0400 | [diff] [blame] | 62 | |
| 63 | ## ----------------------------------------------------------------------- |
| 64 | ## Intent: Display command usage |
| 65 | ## ----------------------------------------------------------------------- |
| 66 | help:: |
| 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] |