Source code syntax checking¶
Getting Started¶
git clone ssh://gerrit.opencord.org:29418/voltha-helm-charts.git
cd voltha-helm-charts
make help | grep lint
lint-chart chart_version_check.sh
lint-doc8 Syntax check *.rst documentation files.
lint-helm Syntax check helm configs
lint-json Syntax check json sources
lint-license Verify sources contain a license block.
lint-robot Syntax check robot sources using rflint
lint-shell Syntax check bash,bourne,etc sources
lint-yaml Syntax check yaml source using yamllint
UNSTABLE= Build targets prone to failure (lint-helm)
[PYTHON]
lint-python Syntax check using available python tools
lint-flake8 Syntax check using tool flake8
lint-pylint Syntax check using tool pylint
All Sources¶
The generic lint target can be used to invoke all defined lint targets.
make clean
make lint 2>&1 | tee log
Makefile help¶
Individual Makefiles support a help target that will display a list of targets and functionality supported.
make help
make help-verbose
make help VERBOSE=1
doc8 / RST files¶
Command: doc8
make clean
make lint 2>&1 | tee log
make lint-doc8-all 2>&1 | tee log
make lint-doc8-modified 2>&1 | tee log
Sources:
makefiles/lint/doc8.mk
Notes:
lint-doc8-all target dependency will create a python virtual env
python 3.10+ requires virtual env patching (dynamic, applied when needed).
python: flake8¶
Command: flake8
make clean
make lint 2>&1 | tee log
make lint-flake8-all 2>&1 | tee log
make lint-flake8-modified 2>&1 | tee log
Sources:
makefiles/lint/flake8.mk
Notes:
lint-flake8-all target dependency will create a python virtual env
python 3.10+ requires virtual env patching (dynamic, applied when needed).
JSON¶
Command: json.tool
make clean
make lint 2>&1 | tee log
make lint-json-all 2>&1 | tee log
make lint-json-modified 2>&1 | tee log
Sources:
python: pylint¶
Command: pylint
make clean
make lint 2>&1 | tee log
make lint-pylint-all 2>&1 | tee log
make lint-pylint-modified 2>&1 | tee log
Sources:
makefiles/lint/pylint.mk
Notes:
pylint the –py3k option is no longer supported by v3.10+
lint-pylint-all target dependency will create a python virtual env
python 3.10+ requires virtual env patching (dynamic, applied when needed).
Robot¶
Command: rflint robotframework-lint
make clean
make lint 2>&1 | tee log
make lint-robot-all 2>&1 | tee log
make lint-robot-modified 2>&1 | tee log
Sources:
Shell¶
Command: shellcheck
make clean
make lint 2>&1 | tee log
make lint-shell-all 2>&1 | tee log
make lint-shell-modified 2>&1 | tee log
Sources:
Yaml¶
Command: yamllint
make clean
make lint 2>&1 | tee log
make lint-yaml-all 2>&1 | tee log
make lint--modified 2>&1 | tee log
Sources:
Bugs¶
jira::VOLTHA <https://jira.opencord.org/projects/VOL>-
Include repository URL
Include gerrit/github changeset if available.
A logfile snippet of the error and surrounding context.
Repositories¶
Notes¶
Volume problem reports require cleanup before linting can become a default.
After bulk linting problems for a language source have been cleaned up default linting can be enabled by modifing {project-root}/config.mk.
Lint target support is globally available across repositories, given time it will be. Submit patches as needed or open a jira ticket to request linting support in specific repositories.
Makefile refactoring: yes absolutely! Baby steps are needed in the interim…