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-helm                     Syntax check helm configs
lint-json                     Syntax check json sources
lint-license                  Verify sources contain a license block.
lint-python                   Syntax check using pylint and flake8
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)

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

Helm Charts

Command(s): - helmlint.sh

make clean
make lint-chart lint-helm 2>&1 | tee log

Sources:


Golang

Command:

Sources:


JSON

Command: - json.tool

make clean
make lint-json 2>&1 | tee log

Sources:


python

Command: - flake8 - pylint

make clean
make lint-python 2>&1 | tee log

Sources:

Notes:

  • pylint the –py3k option is no longer supported by v3.10+

  • lint-python target dependency will create a python virtual env

  • python 3.10+ requires virtual env patching (dynamic, applied when needed).


Robot

Command: rflint

Sources:


reStructedTextFile (rst)

Command: doc8

Sources:


Yaml

Command: yamllint

make clean
make lint-yaml 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

  • Make lint complaints are not necessarily fatal.

  • Volume problem reports require cleanup before linting can become a default.

  • 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…