blob: 84e369218f6c9f142c74fc6ee8821811bd31fec7 [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]
Joey Armstronga2fa6582023-04-07 11:03:36 -040024 lint-python Syntax check using available python tools
25 lint-flake8 Syntax check using tool flake8
26 lint-pylint Syntax check using tool pylint
Joey Armstrong4de98b72023-02-09 14:51:38 -050027
Joey Armstronga8bc8e12022-12-04 07:06:59 -050028|
29
30
31All Sources
32+++++++++++
33
34The generic lint target can be used to invoke all defined lint targets.
35
36.. code:: bash
37
38 make clean
39 make lint 2>&1 | tee log
40
41|
42
Joey Armstrongb544dff2022-12-07 15:12:05 -050043
44Makefile help
45~~~~~~~~~~~~~
46
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -050047Individual Makefiles support a help target that will display a list of
Joey Armstrongb544dff2022-12-07 15:12:05 -050048targets and functionality supported.
49
50.. code:: bash
51
52 make help
53 make help-verbose
54 make help VERBOSE=1
55
56|
57
58
Joey Armstrong4de98b72023-02-09 14:51:38 -050059doc8 / RST files
60++++++++++++++++
61
62Command: `doc8 <https://pypi.org/project/doc8/>`_
63
64.. code:: bash
65
66 make clean
67 make lint 2>&1 | tee log
68 make lint-doc8-all 2>&1 | tee log
69 make lint-doc8-modified 2>&1 | tee log
70
71Sources:
72
73- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
74- makefiles/lint/doc8.mk
75
76Notes:
77
78- lint-doc8-all target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_
79- python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed).
80- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_
81
82|
83
84
85python: flake8
86++++++++++++++
87
88Command: `flake8 <https://flake8.pycqa.org/en/latest>`_
89
90.. code:: bash
91
92 make clean
93 make lint 2>&1 | tee log
94 make lint-flake8-all 2>&1 | tee log
95 make lint-flake8-modified 2>&1 | tee log
96
97Sources:
98
99- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
100- makefiles/lint/flake8.mk
101
102Notes:
103
104- lint-flake8-all target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_
105- python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed).
106- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_
107
108|
109
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500110Helm Charts
111+++++++++++
112
113Command(s):
114- `helmlint.sh <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/helmlint.sh>`_
115
116.. code:: bash
117
118 make clean
119 make lint-chart lint-helm 2>&1 | tee log
120
121Sources:
122
123- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong2a687952023-02-01 13:10:12 -0500124- `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 -0500125- [`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>`_
126
127|
128
129
130Golang
131++++++
132
133Command:
134
135Sources:
136
137- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
138
139|
140
Joey Armstrongb544dff2022-12-07 15:12:05 -0500141
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500142JSON
143++++
144
Joey Armstrong4de98b72023-02-09 14:51:38 -0500145Command: `json.tool <https://docs.python.org/3/library/json.html>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500146
147.. code:: bash
148
149 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500150 make lint 2>&1 | tee log
151 make lint-json-all 2>&1 | tee log
152 make lint-json-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500153
154Sources:
155
156- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
157- `makefiles/lint/json.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/json.mk>`_
158
159|
160
161
162License / Copyright notice
163++++++++++++++++++++++++++
164
165Command:
166
167.. code:: bash
168
169 make clean
170 make lint-license 2>&1 | tee log
171
172Sources:
173
174- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint>`__
175- `makefiles/lint/license.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/license/include.mk>`_
176
177|
178
179
Joey Armstrong4de98b72023-02-09 14:51:38 -0500180python: pylint
181++++++++++++++
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500182
Joey Armstrong4de98b72023-02-09 14:51:38 -0500183Command: `pylint <https://www.pylint.org/>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500184
185.. code:: bash
186
187 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500188 make lint 2>&1 | tee log
189 make lint-pylint-all 2>&1 | tee log
190 make lint-pylint-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500191
192Sources:
193
194- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500195- makefiles/lint/pylint.mk
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500196- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_
197
198Notes:
199
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500200- pylint the --py3k option is no longer supported by v3.10+
Joey Armstrong4de98b72023-02-09 14:51:38 -0500201- 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 -0500202- 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 -0500203
204|
205
206
207Robot
208+++++
209
Joey Armstrong4de98b72023-02-09 14:51:38 -0500210Command: rflint `robotframework-lint <https://pypi.org/project/robotframework-lint/>`_
211
212.. code:: bash
213
214 make clean
215 make lint 2>&1 | tee log
216 make lint-robot-all 2>&1 | tee log
217 make lint-robot-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500218
219Sources:
220
221- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500222- `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 -0500223
224|
225
226
227reStructedTextFile (rst)
228++++++++++++++++++++++++
229
230Command: `doc8 <https://pypi.org/project/doc8/>`_
231
232Sources:
233
234- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
235- `Makefiles::doc8 <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/Makefile#98>`_
236
237|
238
239
240Shell
241+++++
242
243Command: `shellcheck <https://github.com/koalaman/shellcheck>`_
244
Joey Armstrong4de98b72023-02-09 14:51:38 -0500245.. code:: bash
246
247 make clean
248 make lint 2>&1 | tee log
249 make lint-shell-all 2>&1 | tee log
250 make lint-shell-modified 2>&1 | tee log
251
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500252Sources:
253
254- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500255- `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 -0500256
257|
258
259
260Yaml
261++++
262
Joey Armstrong4de98b72023-02-09 14:51:38 -0500263Command: `yamllint <https://yamllint.readthedocs.io/en/stable/>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500264
265.. code:: bash
266
267 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500268 make lint 2>&1 | tee log
269 make lint-yaml-all 2>&1 | tee log
270 make lint--modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500271
272Sources:
273
274- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500275- `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 -0500276
277|
278
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500279
280Bugs
281~~~~
282
283- `jira::VOLTHA <https://jira.opencord.org/projects/VOL>`-
284- Include repository URL
285- Include gerrit/github changeset if available.
286- A logfile snippet of the error and surrounding context.
287
Joey Armstrongb544dff2022-12-07 15:12:05 -0500288|
289
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500290
291Repositories
292++++++++++++
293
294- [`master <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master>`__] `bbsim <https://gerrit.opencord.org/plugins/gitiles/bbsim>`_
295- [`master <https://gerrit.opencord.org/plugins/gitiles/pod-configs/+/refs/heads/master>`__] `pod-configs <https://gerrit.opencord.org/plugins/gitiles/pod-configs>`_
296- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_
297- [`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 -0500298- [`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 -0500299
Joey Armstrongb544dff2022-12-07 15:12:05 -0500300|
301
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500302
303Notes
304~~~~~
305
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500306- Volume problem reports require cleanup before linting can become a default.
Joey Armstrong4de98b72023-02-09 14:51:38 -0500307
308 - After bulk linting problems for a language source have been cleaned up
309 default linting can be enabled by modifing {project-root}/config.mk.
310
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500311- Lint target support is globally available across repositories, given time
312 it will be. Submit patches as needed or open a jira ticket to request
313 linting support in specific repositories.
314- Makefile refactoring: yes absolutely! Baby steps are needed in the interim...
Joey Armstrongb544dff2022-12-07 15:12:05 -0500315
316|