Joey Armstrong | a527814 | 2023-06-28 16:56:54 -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-robot lint-robot-all lint-robot-modified |
| 22 | |
| 23 | have-robot-files := $(if $(strip $(ROBOT_FILES)),true) |
| 24 | ROBOT_FILES ?= $(error ROBOT_FILES= is required) |
| 25 | |
| 26 | ## ----------------------------------------------------------------------- |
| 27 | ## ----------------------------------------------------------------------- |
| 28 | ifndef NO-LINT-ROBOT |
| 29 | lint-robot-mode := $(if $(have-robot-files),modified,all) |
| 30 | lint : lint-robot-$(lint-robot-mode) |
| 31 | endif# NO-LINT-ROBOT |
| 32 | |
| 33 | # Consistent targets across lint makefiles |
| 34 | lint-robot-all : lint-robot |
| 35 | lint-robot-modified : lint-robot |
| 36 | |
| 37 | LINT_ARGS ?= --verbose --configure LineTooLong:130 -e LineTooLong \ |
| 38 | --configure TooManyTestSteps:65 -e TooManyTestSteps \ |
| 39 | --configure TooManyTestCases:50 -e TooManyTestCases \ |
| 40 | --configure TooFewTestSteps:1 \ |
| 41 | --configure TooFewKeywordSteps:1 \ |
| 42 | --configure FileTooLong:2000 -e FileTooLong \ |
| 43 | -e TrailingWhitespace |
| 44 | |
| 45 | ## ----------------------------------------------------------------------- |
| 46 | ## ----------------------------------------------------------------------- |
| 47 | lint-robot: $(venv-activate-script) |
| 48 | @echo |
| 49 | @echo '** -----------------------------------------------------------------------' |
| 50 | @echo '** robot *.rst syntax checking' |
| 51 | @echo '** -----------------------------------------------------------------------' |
| 52 | # $(activate) && rflint --version |
| 53 | $(activate) && rflint $(LINT_ARGS) $(ROBOT_FILES) |
| 54 | |
| 55 | ## ----------------------------------------------------------------------- |
| 56 | ## Intent: Display command usage |
| 57 | ## ----------------------------------------------------------------------- |
| 58 | help:: |
| 59 | @echo ' lint-robot Syntax check python using the robot command' |
| 60 | ifdef VERBOSE |
| 61 | @echo ' lint-robot-all robot checking: exhaustive' |
| 62 | @echo ' lint-robot-modified robot checking: only modified' |
| 63 | endif |
| 64 | |
| 65 | # [EOF] |