blob: 9550d54a8e510f6f9aa22282fea3376b1497b7af [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
Joey Armstrong4de98b72023-02-09 14:51:38 -050014 lint-doc8 Syntax check *.rst documentation files.
Joey Armstronga8bc8e12022-12-04 07:06:59 -050015 lint-helm Syntax check helm configs
16 lint-json Syntax check json sources
17 lint-license Verify sources contain a license block.
Joey Armstronga8bc8e12022-12-04 07:06:59 -050018 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
Joey Armstrong4de98b72023-02-09 14:51:38 -050023 [PYTHON]
24 lint-flake8 Syntax check using pylint and flake8
25 lint-pylint Syntax check using pylint and flake8
26
Joey Armstronga8bc8e12022-12-04 07:06:59 -050027|
28
29
30All Sources
31+++++++++++
32
33The generic lint target can be used to invoke all defined lint targets.
34
35.. code:: bash
36
37 make clean
38 make lint 2>&1 | tee log
39
40|
41
Joey Armstrongb544dff2022-12-07 15:12:05 -050042
43Makefile help
44~~~~~~~~~~~~~
45
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -050046Individual Makefiles support a help target that will display a list of
Joey Armstrongb544dff2022-12-07 15:12:05 -050047targets and functionality supported.
48
49.. code:: bash
50
51 make help
52 make help-verbose
53 make help VERBOSE=1
54
55|
56
57
Joey Armstrong4de98b72023-02-09 14:51:38 -050058doc8 / RST files
59++++++++++++++++
60
61Command: `doc8 <https://pypi.org/project/doc8/>`_
62
63.. code:: bash
64
65 make clean
66 make lint 2>&1 | tee log
67 make lint-doc8-all 2>&1 | tee log
68 make lint-doc8-modified 2>&1 | tee log
69
70Sources:
71
72- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
73- makefiles/lint/doc8.mk
74
75Notes:
76
77- lint-doc8-all target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_
78- python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed).
79- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_
80
81|
82
83
84python: flake8
85++++++++++++++
86
87Command: `flake8 <https://flake8.pycqa.org/en/latest>`_
88
89.. code:: bash
90
91 make clean
92 make lint 2>&1 | tee log
93 make lint-flake8-all 2>&1 | tee log
94 make lint-flake8-modified 2>&1 | tee log
95
96Sources:
97
98- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
99- makefiles/lint/flake8.mk
100
101Notes:
102
103- lint-flake8-all target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_
104- python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed).
105- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_
106
107|
108
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500109Helm Charts
110+++++++++++
111
112Command(s):
113- `helmlint.sh <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/helmlint.sh>`_
114
115.. code:: bash
116
117 make clean
118 make lint-chart lint-helm 2>&1 | tee log
119
120Sources:
121
122- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong2a687952023-02-01 13:10:12 -0500123- `makefiles/lint/helm/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/helm/include.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500124- [`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>`_
125
126|
127
128
129Golang
130++++++
131
132Command:
133
134Sources:
135
136- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
137
138|
139
Joey Armstrongb544dff2022-12-07 15:12:05 -0500140
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500141JSON
142++++
143
Joey Armstrong4de98b72023-02-09 14:51:38 -0500144Command: `json.tool <https://docs.python.org/3/library/json.html>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500145
146.. code:: bash
147
148 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500149 make lint 2>&1 | tee log
150 make lint-json-all 2>&1 | tee log
151 make lint-json-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500152
153Sources:
154
155- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
156- `makefiles/lint/json.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/json.mk>`_
157
158|
159
160
161License / Copyright notice
162++++++++++++++++++++++++++
163
164Command:
165
166.. code:: bash
167
168 make clean
169 make lint-license 2>&1 | tee log
170
171Sources:
172
173- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint>`__
174- `makefiles/lint/license.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/license/include.mk>`_
175
176|
177
178
Joey Armstrong4de98b72023-02-09 14:51:38 -0500179python: pylint
180++++++++++++++
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500181
Joey Armstrong4de98b72023-02-09 14:51:38 -0500182Command: `pylint <https://www.pylint.org/>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500183
184.. code:: bash
185
186 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500187 make lint 2>&1 | tee log
188 make lint-pylint-all 2>&1 | tee log
189 make lint-pylint-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500190
191Sources:
192
193- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500194- makefiles/lint/pylint.mk
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500195- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_
196
197Notes:
198
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500199- pylint the --py3k option is no longer supported by v3.10+
Joey Armstrong4de98b72023-02-09 14:51:38 -0500200- lint-pylint-all target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500201- python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed).
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500202
203|
204
205
206Robot
207+++++
208
Joey Armstrong4de98b72023-02-09 14:51:38 -0500209Command: rflint `robotframework-lint <https://pypi.org/project/robotframework-lint/>`_
210
211.. code:: bash
212
213 make clean
214 make lint 2>&1 | tee log
215 make lint-robot-all 2>&1 | tee log
216 make lint-robot-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500217
218Sources:
219
220- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500221- `makefiles/lint/robot.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/robot.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500222
223|
224
225
226reStructedTextFile (rst)
227++++++++++++++++++++++++
228
229Command: `doc8 <https://pypi.org/project/doc8/>`_
230
231Sources:
232
233- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
234- `Makefiles::doc8 <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/Makefile#98>`_
235
236|
237
238
239Shell
240+++++
241
242Command: `shellcheck <https://github.com/koalaman/shellcheck>`_
243
Joey Armstrong4de98b72023-02-09 14:51:38 -0500244.. code:: bash
245
246 make clean
247 make lint 2>&1 | tee log
248 make lint-shell-all 2>&1 | tee log
249 make lint-shell-modified 2>&1 | tee log
250
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500251Sources:
252
253- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500254- `makefiles/lint/shell.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/shell.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500255
256|
257
258
259Yaml
260++++
261
Joey Armstrong4de98b72023-02-09 14:51:38 -0500262Command: `yamllint <https://yamllint.readthedocs.io/en/stable/>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500263
264.. code:: bash
265
266 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500267 make lint 2>&1 | tee log
268 make lint-yaml-all 2>&1 | tee log
269 make lint--modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500270
271Sources:
272
273- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500274- `makefiles/lint/yaml.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/yaml.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500275
276|
277
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500278
279Bugs
280~~~~
281
282- `jira::VOLTHA <https://jira.opencord.org/projects/VOL>`-
283- Include repository URL
284- Include gerrit/github changeset if available.
285- A logfile snippet of the error and surrounding context.
286
Joey Armstrongb544dff2022-12-07 15:12:05 -0500287|
288
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500289
290Repositories
291++++++++++++
292
293- [`master <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master>`__] `bbsim <https://gerrit.opencord.org/plugins/gitiles/bbsim>`_
294- [`master <https://gerrit.opencord.org/plugins/gitiles/pod-configs/+/refs/heads/master>`__] `pod-configs <https://gerrit.opencord.org/plugins/gitiles/pod-configs>`_
295- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_
296- [`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>`_
Joey Armstrong4de98b72023-02-09 14:51:38 -0500297- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500298
Joey Armstrongb544dff2022-12-07 15:12:05 -0500299|
300
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500301
302Notes
303~~~~~
304
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500305- Volume problem reports require cleanup before linting can become a default.
Joey Armstrong4de98b72023-02-09 14:51:38 -0500306
307 - After bulk linting problems for a language source have been cleaned up
308 default linting can be enabled by modifing {project-root}/config.mk.
309
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500310- Lint target support is globally available across repositories, given time
311 it will be. Submit patches as needed or open a jira ticket to request
312 linting support in specific repositories.
313- Makefile refactoring: yes absolutely! Baby steps are needed in the interim...
Joey Armstrongb544dff2022-12-07 15:12:05 -0500314
315|