blob: 2763e53c3ba0c117bcd887f3e27243a34c547eec [file] [log] [blame]
Joey Armstrongbb26e932024-01-29 16:17:27 -05001.. _code--makefile-lint-targets:
Joey Armstrongfb8f3c82024-01-29 10:13:18 -05002
Joey Armstronga9a16b62023-11-01 14:31:15 -04003======================================
4Makefile Lint Targets: Syntax Checking
5======================================
Joey Armstronga8bc8e12022-12-04 07:06:59 -05006
Joey Armstronga9a16b62023-11-01 14:31:15 -04007Targets
8=======
Joey Armstronga8bc8e12022-12-04 07:06:59 -05009
10.. code:: bash
11
12 git clone ssh://gerrit.opencord.org:29418/voltha-helm-charts.git
13 cd voltha-helm-charts
Joey Armstronga8bc8e12022-12-04 07:06:59 -050014 make help | grep lint
15 lint-chart chart_version_check.sh
Joey Armstrong4de98b72023-02-09 14:51:38 -050016 lint-doc8 Syntax check *.rst documentation files.
Joey Armstronga8bc8e12022-12-04 07:06:59 -050017 lint-helm Syntax check helm configs
18 lint-json Syntax check json sources
19 lint-license Verify sources contain a license block.
Joey Armstronga8bc8e12022-12-04 07:06:59 -050020 lint-robot Syntax check robot sources using rflint
21 lint-shell Syntax check bash,bourne,etc sources
22 lint-yaml Syntax check yaml source using yamllint
23 UNSTABLE= Build targets prone to failure (lint-helm)
24
Joey Armstrong4de98b72023-02-09 14:51:38 -050025 [PYTHON]
Joey Armstronga2fa6582023-04-07 11:03:36 -040026 lint-python Syntax check using available python tools
27 lint-flake8 Syntax check using tool flake8
28 lint-pylint Syntax check using tool pylint
Joey Armstrong4de98b72023-02-09 14:51:38 -050029
Joey Armstronga8bc8e12022-12-04 07:06:59 -050030|
31
Joey Armstrong82180592024-02-10 15:34:21 -050032.. seealso::
33
34- :ref:`Makefile Target lint-chart`
35- :ref:`Makefile Target lint-helm`
36
Joey Armstronga8bc8e12022-12-04 07:06:59 -050037
38All Sources
Joey Armstronga9a16b62023-11-01 14:31:15 -040039===========
Joey Armstronga8bc8e12022-12-04 07:06:59 -050040
41The generic lint target can be used to invoke all defined lint targets.
42
43.. code:: bash
44
45 make clean
46 make lint 2>&1 | tee log
47
48|
49
Joey Armstrongb544dff2022-12-07 15:12:05 -050050
51Makefile help
Joey Armstronga9a16b62023-11-01 14:31:15 -040052=============
Joey Armstrongb544dff2022-12-07 15:12:05 -050053
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -050054Individual Makefiles support a help target that will display a list of
Joey Armstrongb544dff2022-12-07 15:12:05 -050055targets and functionality supported.
56
57.. code:: bash
58
59 make help
Joey Armstronga9a16b62023-11-01 14:31:15 -040060 make help | grep {topic}
61
62.. list-table:: help
63 :widths: 20, 60
64 :header-rows: 1
65
66 * - Make Target
67 - Description
68 * - help
69 - Display available help for targets and flags
70 * - make help | lint-{topic}
71 - Display summary usage for lint-doc8, lint-license, lint-make
72 * - lint-{topic}-help
73 - Display extended help for a topic, supported makefile targets, etc
74
75Legacy Help Usage
76-----------------
77
78.. code:: bash
79
80 make help
Joey Armstrongb544dff2022-12-07 15:12:05 -050081 make help-verbose
82 make help VERBOSE=1
83
84|
85
86
Joey Armstronga9a16b62023-11-01 14:31:15 -040087doc8 / restructuredText (rst)
88=============================
Joey Armstrong4de98b72023-02-09 14:51:38 -050089
90Command: `doc8 <https://pypi.org/project/doc8/>`_
91
Joey Armstronga9a16b62023-11-01 14:31:15 -040092.. list-table:: Makefile Targets
93 :widths: 20, 60
94 :header-rows: 1
95
96 * - Target
97 - Description
98 * - help
99 - Display item ``lint-doc8`` as a summary help topic item.
100 * - lint-doc8-help
101 - Display extended help for ``lint-doc8`` targets
102 * -
103 -
104 * - lint-doc8
105 - Build system lint target used to syntax check restructuredText sources.
106 * - lint-doc8-all
107 - Filesystem traversal, check all ``*.rst`` sources.
108 * - lint-doc8-mod
109 - Syntax check locally modified files (~git status)
110 * - lint-doc8-src
111 - Syntax check a list of files passed in as an argument.
112 * -
113 -
114 * - lint-doc8-install
115 - Dependency driven installation of the doc8 tool.
116
Joey Armstrong4de98b72023-02-09 14:51:38 -0500117.. code:: bash
118
119 make clean
Joey Armstronga9a16b62023-11-01 14:31:15 -0400120 make lint-doc8 2>&1 | tee log
Joey Armstrong4de98b72023-02-09 14:51:38 -0500121
Joey Armstronga9a16b62023-11-01 14:31:15 -0400122 make lint # supported by repositories that define lint-doc8 as a default target.
Joey Armstrong4de98b72023-02-09 14:51:38 -0500123
Joey Armstronga9a16b62023-11-01 14:31:15 -0400124.. list-table:: Sources
125 :widths: 20, 60
126 :header-rows: 1
Joey Armstrong4de98b72023-02-09 14:51:38 -0500127
Joey Armstronga9a16b62023-11-01 14:31:15 -0400128 * - Source
129 - Description
130 * - `makefiles/lint/doc8/include.mk <http://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/doc8/include.mk>`_
131 - Main makefile logic for syntax checking RST sources.
132 * - `makefiles/lint/doc8/install.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/doc8/install.mk>`_
133 - Dependency logic to install the doc8 tool when needed.
134 * - `makefiles/lint/doc8/excl.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/doc8/install.mk>`_
135 - Common doc8 exclusion patterns for all repositories.
136
137See Also
138--------
Joey Armstrong4de98b72023-02-09 14:51:38 -0500139
Joey Armstrong1b8fdc32023-12-20 17:22:57 -0500140- lint-doc8-all target dependency will create a `python virtual env <https://wiki.opencord.org>`_
Joey Armstrong4de98b72023-02-09 14:51:38 -0500141- python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed).
Joey Armstrong644fb652023-10-02 13:12:20 -0400142- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles-orig/patches/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500143
144|
145
146
147python: flake8
Joey Armstronga9a16b62023-11-01 14:31:15 -0400148==============
Joey Armstrong4de98b72023-02-09 14:51:38 -0500149
150Command: `flake8 <https://flake8.pycqa.org/en/latest>`_
151
152.. code:: bash
153
154 make clean
155 make lint 2>&1 | tee log
156 make lint-flake8-all 2>&1 | tee log
157 make lint-flake8-modified 2>&1 | tee log
158
159Sources:
160
Joey Armstrong644fb652023-10-02 13:12:20 -0400161- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500162- makefiles/lint/flake8.mk
163
164Notes:
165
Joey Armstrong1b8fdc32023-12-20 17:22:57 -0500166- lint-flake8-all target dependency will create a `python virtual env <https://wiki.opencord.org>`_
Joey Armstrong4de98b72023-02-09 14:51:38 -0500167- python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed).
Joey Armstrong644fb652023-10-02 13:12:20 -0400168- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles-orig/patches/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500169
170|
171
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500172Helm Charts
Joey Armstronga9a16b62023-11-01 14:31:15 -0400173===========
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500174
175Command(s):
176- `helmlint.sh <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/helmlint.sh>`_
177
178.. code:: bash
179
180 make clean
181 make lint-chart lint-helm 2>&1 | tee log
182
183Sources:
184
185- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong2a687952023-02-01 13:10:12 -0500186- `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 -0500187- [`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>`_
188
189|
190
191
192Golang
Joey Armstronga9a16b62023-11-01 14:31:15 -0400193======
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500194
195Command:
196
197Sources:
198
Joey Armstrong644fb652023-10-02 13:12:20 -0400199- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500200
201|
202
Joey Armstrongb544dff2022-12-07 15:12:05 -0500203
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500204JSON
Joey Armstronga9a16b62023-11-01 14:31:15 -0400205====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500206
Joey Armstrong4de98b72023-02-09 14:51:38 -0500207Command: `json.tool <https://docs.python.org/3/library/json.html>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500208
209.. code:: bash
210
211 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500212 make lint 2>&1 | tee log
213 make lint-json-all 2>&1 | tee log
214 make lint-json-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500215
216Sources:
217
Joey Armstrong644fb652023-10-02 13:12:20 -0400218- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
219- `makefiles/lint/json.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/json.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500220
221|
222
223
224License / Copyright notice
Joey Armstronga9a16b62023-11-01 14:31:15 -0400225==========================
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500226
227Command:
228
229.. code:: bash
230
231 make clean
232 make lint-license 2>&1 | tee log
233
234Sources:
235
236- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint>`__
Joey Armstrong8b426fc2023-11-14 16:09:11 -0500237- `makefiles/lint/license.mk <http://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/license/include.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500238
239|
240
241
Joey Armstrong4de98b72023-02-09 14:51:38 -0500242python: pylint
Joey Armstronga9a16b62023-11-01 14:31:15 -0400243==============
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500244
Joey Armstrong8b426fc2023-11-14 16:09:11 -0500245Command: `pylint <http://github.com/pylint-dev/pylint>`_, `pypi.org <https://pypi.org/project/pylint/>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500246
247.. code:: bash
248
249 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500250 make lint 2>&1 | tee log
251 make lint-pylint-all 2>&1 | tee log
252 make lint-pylint-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500253
254Sources:
255
Joey Armstrong644fb652023-10-02 13:12:20 -0400256- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500257- makefiles/lint/pylint.mk
Joey Armstrong644fb652023-10-02 13:12:20 -0400258- `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles-orig/patches/>`__
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500259
260Notes:
261
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500262- pylint the --py3k option is no longer supported by v3.10+
Joey Armstrong1b8fdc32023-12-20 17:22:57 -0500263- lint-pylint-all target dependency will create a `python virtual env <https://wiki.opencord.org>`_
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500264- 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 -0500265
266|
267
268
269Robot
Joey Armstronga9a16b62023-11-01 14:31:15 -0400270=====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500271
Joey Armstrong4de98b72023-02-09 14:51:38 -0500272Command: rflint `robotframework-lint <https://pypi.org/project/robotframework-lint/>`_
273
274.. code:: bash
275
276 make clean
277 make lint 2>&1 | tee log
278 make lint-robot-all 2>&1 | tee log
279 make lint-robot-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500280
281Sources:
282
Joey Armstrong644fb652023-10-02 13:12:20 -0400283- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong1eb713f2024-01-30 13:53:00 -0500284- `makefiles/lint/robot/*.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/robot>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500285
286|
287
288
Joey Armstronga9a16b62023-11-01 14:31:15 -0400289Shell / Command Line Scripts
290============================
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500291
292Command: `shellcheck <https://github.com/koalaman/shellcheck>`_
293
Joey Armstrong4de98b72023-02-09 14:51:38 -0500294.. code:: bash
295
296 make clean
297 make lint 2>&1 | tee log
298 make lint-shell-all 2>&1 | tee log
299 make lint-shell-modified 2>&1 | tee log
300
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500301Sources:
302
Joey Armstrong644fb652023-10-02 13:12:20 -0400303- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong8b426fc2023-11-14 16:09:11 -0500304- `makefiles/lint/shell.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/shell/include.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500305
306|
307
308
309Yaml
Joey Armstronga9a16b62023-11-01 14:31:15 -0400310====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500311
Joey Armstrong4de98b72023-02-09 14:51:38 -0500312Command: `yamllint <https://yamllint.readthedocs.io/en/stable/>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500313
314.. code:: bash
315
316 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500317 make lint 2>&1 | tee log
318 make lint-yaml-all 2>&1 | tee log
319 make lint--modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500320
321Sources:
322
Joey Armstrong644fb652023-10-02 13:12:20 -0400323- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
324- `makefiles/lint/yaml.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/yaml.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500325
326|
327
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500328
329Bugs
Joey Armstronga9a16b62023-11-01 14:31:15 -0400330====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500331
332- `jira::VOLTHA <https://jira.opencord.org/projects/VOL>`-
333- Include repository URL
334- Include gerrit/github changeset if available.
335- A logfile snippet of the error and surrounding context.
336
Joey Armstrongb544dff2022-12-07 15:12:05 -0500337|
338
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500339
340Repositories
Joey Armstronga9a16b62023-11-01 14:31:15 -0400341============
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500342
343- [`master <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master>`__] `bbsim <https://gerrit.opencord.org/plugins/gitiles/bbsim>`_
344- [`master <https://gerrit.opencord.org/plugins/gitiles/pod-configs/+/refs/heads/master>`__] `pod-configs <https://gerrit.opencord.org/plugins/gitiles/pod-configs>`_
345- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_
346- [`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 -0500347- [`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 -0500348
Joey Armstrongb544dff2022-12-07 15:12:05 -0500349|
350
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500351
352Notes
Joey Armstronga9a16b62023-11-01 14:31:15 -0400353=====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500354
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500355- Volume problem reports require cleanup before linting can become a default.
Joey Armstrong4de98b72023-02-09 14:51:38 -0500356
357 - After bulk linting problems for a language source have been cleaned up
358 default linting can be enabled by modifing {project-root}/config.mk.
359
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500360- Lint target support is globally available across repositories, given time
361 it will be. Submit patches as needed or open a jira ticket to request
362 linting support in specific repositories.
363- Makefile refactoring: yes absolutely! Baby steps are needed in the interim...
Joey Armstrongb544dff2022-12-07 15:12:05 -0500364
365|