Makefile
makefiles/lint.mk
makefiles/lint/json.mk
makefiles/lint/python.mk
makefiles/lint/robot.mk
makefiles/lint/yaml.mk
makefiles/virtualenv.mk
----
* Begin simplifying 700+ line monolithic makefile.
* Extract and repackage lint based targets beneath makefiles/lint.
* Added help target(s) to document functionality.
Changed copyight end date from -present to -2022.
Change-Id: Ieaacf59ee3023d29c4e8be7b266f4c7169111138
diff --git a/Makefile b/Makefile
index e2f7277..2b6c729 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Copyright 2017-present Open Networking Foundation
+# Copyright 2017-2022 Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+TOP ?= .
+MAKEDIR ?= $(TOP)/makefiles
+
# use bash for pushd/popd, and to fail quickly. virtualenv's activate
# has undefined variables, so no -u
SHELL := bash -e -o pipefail
@@ -20,13 +23,6 @@
# Configuration and lists of files for linting/testing
VERSION ?= $(shell cat ./VERSION)
-LINT_ARGS ?= --verbose --configure LineTooLong:130 -e LineTooLong \
- --configure TooManyTestSteps:65 -e TooManyTestSteps \
- --configure TooManyTestCases:50 -e TooManyTestCases \
- --configure TooFewTestSteps:1 \
- --configure TooFewKeywordSteps:1 \
- --configure FileTooLong:2000 -e FileTooLong \
- -e TrailingWhitespace
PYTHON_FILES := $(wildcard libraries/*.py)
ROBOT_FILES := $(shell find . -name *.robot -print)
@@ -713,31 +709,15 @@
source ./$@/bin/activate ;\
python -m pip install -r requirements.txt
+##----------------##
+##---] LINT [---##
+##----------------##
+include $(MAKEDIR)/lint.mk
+
test: lint
lint: lint-robot lint-python lint-yaml lint-json
-lint-robot: vst_venv
- source ./$</bin/activate ; set -u ;\
- rflint $(LINT_ARGS) $(ROBOT_FILES)
-
-# check deps for format and python3 cleanliness
-lint-python: vst_venv
- source ./$</bin/activate ; set -u ;\
- pylint --py3k $(PYTHON_FILES) ;\
- flake8 --max-line-length=99 --count $(PYTHON_FILES)
-
-lint-yaml: vst_venv
- source ./$</bin/activate ; set -u ;\
- yamllint -s $(YAML_FILES)
-
-lint-json: vst_venv
- source ./$</bin/activate ; set -u ;\
- for jsonfile in $(JSON_FILES); do \
- echo "Validating json file: $$jsonfile" ;\
- python -m json.tool $$jsonfile > /dev/null ;\
- done
-
# tidy target will be more useful once issue with removing leading comments
# is resolved: https://github.com/robotframework/robotframework/issues/3263
tidy-robot: vst_venv
@@ -785,3 +765,5 @@
voltctl-docker-image-install-kind:
@if [ "`kind get clusters | grep kind`" = '' ]; then echo "no kind cluster found" && exit 1; fi
kind load docker-image --name `kind get clusters | grep kind` opencord/voltctl:local
+
+# [EOF]