blob: e3619b2ef162ec9f07d9999589044fd2ef8d7330 [file] [log] [blame]
Joey Armstronga8bc8e12022-12-04 07:06:59 -05001Source code syntax checking
2===========================
3
4Getting Started
5---------------
6
7.. code:: bash
8
9 git clone ssh://gerrit.opencord.org:29418/voltha-helm-charts.git
10 cd voltha-helm-charts
11
12 make help | grep lint
13 lint-chart chart_version_check.sh
14 lint-helm Syntax check helm configs
15 lint-json Syntax check json sources
16 lint-license Verify sources contain a license block.
17 lint-python Syntax check using pylint and flake8
18 lint-robot Syntax check robot sources using rflint
19 lint-shell Syntax check bash,bourne,etc sources
20 lint-yaml Syntax check yaml source using yamllint
21 UNSTABLE= Build targets prone to failure (lint-helm)
22
23|
24
25
26All Sources
27+++++++++++
28
29The generic lint target can be used to invoke all defined lint targets.
30
31.. code:: bash
32
33 make clean
34 make lint 2>&1 | tee log
35
36|
37
38Helm Charts
39+++++++++++
40
41Command(s):
42- `helmlint.sh <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/helmlint.sh>`_
43
44.. code:: bash
45
46 make clean
47 make lint-chart lint-helm 2>&1 | tee log
48
49Sources:
50
51- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/>`__
52- `makefiles/lint/helm.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/helm.mk>`_
53- [`master <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master>`__] `helm-repo-tools <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools>`_
54
55|
56
57
58Golang
59++++++
60
61Command:
62
63Sources:
64
65- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
66
67|
68
69JSON
70++++
71
72Command:
73- `json.tool <https://docs.python.org/3/library/json.html>`_
74
75.. code:: bash
76
77 make clean
78 make lint-json 2>&1 | tee log
79
80Sources:
81
82- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
83- `makefiles/lint/json.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/json.mk>`_
84
85|
86
87
88License / Copyright notice
89++++++++++++++++++++++++++
90
91Command:
92
93.. code:: bash
94
95 make clean
96 make lint-license 2>&1 | tee log
97
98Sources:
99
100- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint>`__
101- `makefiles/lint/license.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/license/include.mk>`_
102
103|
104
105
106python
107++++++
108
109Command:
110- `flake8 <https://flake8.pycqa.org/en/latest>`_
111- `pylint <https://www.pylint.org/>`_
112
113.. code:: bash
114
115 make clean
116 make lint-python 2>&1 | tee log
117
118Sources:
119
120- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
121- `makefiles/lint/python.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/python.mk>`_
122- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_
123
124Notes:
125
126- pylint --py3k options is no longer supported by v3.10+
127- lint-python target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_
128- python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_
129
130|
131
132
133Robot
134+++++
135
136Command: rflint
137
138Sources:
139
140- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
141- `makefiles/lint/robot.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/robot.mk>`_
142
143|
144
145
146reStructedTextFile (rst)
147++++++++++++++++++++++++
148
149Command: `doc8 <https://pypi.org/project/doc8/>`_
150
151Sources:
152
153- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
154- `Makefiles::doc8 <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/Makefile#98>`_
155
156|
157
158
159Shell
160+++++
161
162Command: `shellcheck <https://github.com/koalaman/shellcheck>`_
163
164Sources:
165
166- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
167- `makefiles/lint/shell.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/shell.mk>`_
168
169|
170
171
172Yaml
173++++
174
175Command: yamllint
176
177.. code:: bash
178
179 make clean
180 make lint-yaml 2>&1 | tee log
181
182Sources:
183
184- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
185- `makefiles/lint/yaml.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/yaml.mk>`_
186
187|
188
189Makefile help
190~~~~~~~~~~~~~
191
192Individual Makefiles support a help targe that will display a list of
193targets and functionality supported.
194
195.. code:: bash
196
197 make help
198 make help-verbose
199 make help VERBOSE=1
200
201
202Bugs
203~~~~
204
205- `jira::VOLTHA <https://jira.opencord.org/projects/VOL>`-
206- Include repository URL
207- Include gerrit/github changeset if available.
208- A logfile snippet of the error and surrounding context.
209
210
211Repositories
212++++++++++++
213
214- [`master <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master>`__] `bbsim <https://gerrit.opencord.org/plugins/gitiles/bbsim>`_
215- [`master <https://gerrit.opencord.org/plugins/gitiles/pod-configs/+/refs/heads/master>`__] `pod-configs <https://gerrit.opencord.org/plugins/gitiles/pod-configs>`_
216- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_
217- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master>`__] `voltha-helm-charts <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts>`_
218- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master>`__] `voltha-system-tests <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests>`_
219
220
221Notes
222~~~~~
223
224- Make lint complaints are not necessarily fatal.
225- Volume problem reports require cleanup before linting can become a default.
226- Lint target support is globally available across repositories, given time
227 it will be. Submit patches as needed or open a jira ticket to request
228 linting support in specific repositories.
229- Makefile refactoring: yes absolutely! Baby steps are needed in the interim...