blob: 76f19cae052d7ce9a4e3b3168a0384568339839c [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
Joey Armstrongb544dff2022-12-07 15:12:05 -050038
39Makefile help
40~~~~~~~~~~~~~
41
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -050042Individual Makefiles support a help target that will display a list of
Joey Armstrongb544dff2022-12-07 15:12:05 -050043targets and functionality supported.
44
45.. code:: bash
46
47 make help
48 make help-verbose
49 make help VERBOSE=1
50
51|
52
53
Joey Armstronga8bc8e12022-12-04 07:06:59 -050054Helm Charts
55+++++++++++
56
57Command(s):
58- `helmlint.sh <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/helmlint.sh>`_
59
60.. code:: bash
61
62 make clean
63 make lint-chart lint-helm 2>&1 | tee log
64
65Sources:
66
67- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/>`__
68- `makefiles/lint/helm.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/helm.mk>`_
69- [`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>`_
70
71|
72
73
74Golang
75++++++
76
77Command:
78
79Sources:
80
81- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
82
83|
84
Joey Armstrongb544dff2022-12-07 15:12:05 -050085
Joey Armstronga8bc8e12022-12-04 07:06:59 -050086JSON
87++++
88
89Command:
90- `json.tool <https://docs.python.org/3/library/json.html>`_
91
92.. code:: bash
93
94 make clean
95 make lint-json 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/json.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/json.mk>`_
101
102|
103
104
105License / Copyright notice
106++++++++++++++++++++++++++
107
108Command:
109
110.. code:: bash
111
112 make clean
113 make lint-license 2>&1 | tee log
114
115Sources:
116
117- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint>`__
118- `makefiles/lint/license.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/license/include.mk>`_
119
120|
121
122
123python
124++++++
125
126Command:
127- `flake8 <https://flake8.pycqa.org/en/latest>`_
128- `pylint <https://www.pylint.org/>`_
129
130.. code:: bash
131
132 make clean
133 make lint-python 2>&1 | tee log
134
135Sources:
136
137- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
138- `makefiles/lint/python.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/python.mk>`_
139- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_
140
141Notes:
142
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500143- pylint the --py3k option is no longer supported by v3.10+
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500144- lint-python target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500145- 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 -0500146
147|
148
149
150Robot
151+++++
152
153Command: rflint
154
155Sources:
156
157- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
158- `makefiles/lint/robot.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/robot.mk>`_
159
160|
161
162
163reStructedTextFile (rst)
164++++++++++++++++++++++++
165
166Command: `doc8 <https://pypi.org/project/doc8/>`_
167
168Sources:
169
170- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
171- `Makefiles::doc8 <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/Makefile#98>`_
172
173|
174
175
176Shell
177+++++
178
179Command: `shellcheck <https://github.com/koalaman/shellcheck>`_
180
181Sources:
182
183- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
184- `makefiles/lint/shell.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/shell.mk>`_
185
186|
187
188
189Yaml
190++++
191
192Command: yamllint
193
194.. code:: bash
195
196 make clean
197 make lint-yaml 2>&1 | tee log
198
199Sources:
200
201- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__
202- `makefiles/lint/yaml.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/yaml.mk>`_
203
204|
205
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500206
207Bugs
208~~~~
209
210- `jira::VOLTHA <https://jira.opencord.org/projects/VOL>`-
211- Include repository URL
212- Include gerrit/github changeset if available.
213- A logfile snippet of the error and surrounding context.
214
Joey Armstrongb544dff2022-12-07 15:12:05 -0500215|
216
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500217
218Repositories
219++++++++++++
220
221- [`master <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master>`__] `bbsim <https://gerrit.opencord.org/plugins/gitiles/bbsim>`_
222- [`master <https://gerrit.opencord.org/plugins/gitiles/pod-configs/+/refs/heads/master>`__] `pod-configs <https://gerrit.opencord.org/plugins/gitiles/pod-configs>`_
223- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_
224- [`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>`_
225- [`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>`_
226
Joey Armstrongb544dff2022-12-07 15:12:05 -0500227|
228
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500229
230Notes
231~~~~~
232
233- Make lint complaints are not necessarily fatal.
234- Volume problem reports require cleanup before linting can become a default.
235- Lint target support is globally available across repositories, given time
236 it will be. Submit patches as needed or open a jira ticket to request
237 linting support in specific repositories.
238- Makefile refactoring: yes absolutely! Baby steps are needed in the interim...
Joey Armstrongb544dff2022-12-07 15:12:05 -0500239
240|