blob: e500f4ce793e50294c7a3e50bab8cc3d3f14f8b6 [file] [log] [blame]
Joey Armstrongfb8f3c82024-01-29 10:13:18 -05001.. _code--makefile-lint-targets
2
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
14
15 make help | grep lint
16 lint-chart chart_version_check.sh
Joey Armstrong4de98b72023-02-09 14:51:38 -050017 lint-doc8 Syntax check *.rst documentation files.
Joey Armstronga8bc8e12022-12-04 07:06:59 -050018 lint-helm Syntax check helm configs
19 lint-json Syntax check json sources
20 lint-license Verify sources contain a license block.
Joey Armstronga8bc8e12022-12-04 07:06:59 -050021 lint-robot Syntax check robot sources using rflint
22 lint-shell Syntax check bash,bourne,etc sources
23 lint-yaml Syntax check yaml source using yamllint
24 UNSTABLE= Build targets prone to failure (lint-helm)
25
Joey Armstrong4de98b72023-02-09 14:51:38 -050026 [PYTHON]
Joey Armstronga2fa6582023-04-07 11:03:36 -040027 lint-python Syntax check using available python tools
28 lint-flake8 Syntax check using tool flake8
29 lint-pylint Syntax check using tool pylint
Joey Armstrong4de98b72023-02-09 14:51:38 -050030
Joey Armstronga8bc8e12022-12-04 07:06:59 -050031|
32
33
34All Sources
Joey Armstronga9a16b62023-11-01 14:31:15 -040035===========
Joey Armstronga8bc8e12022-12-04 07:06:59 -050036
37The generic lint target can be used to invoke all defined lint targets.
38
39.. code:: bash
40
41 make clean
42 make lint 2>&1 | tee log
43
44|
45
Joey Armstrongb544dff2022-12-07 15:12:05 -050046
47Makefile help
Joey Armstronga9a16b62023-11-01 14:31:15 -040048=============
Joey Armstrongb544dff2022-12-07 15:12:05 -050049
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -050050Individual Makefiles support a help target that will display a list of
Joey Armstrongb544dff2022-12-07 15:12:05 -050051targets and functionality supported.
52
53.. code:: bash
54
55 make help
Joey Armstronga9a16b62023-11-01 14:31:15 -040056 make help | grep {topic}
57
58.. list-table:: help
59 :widths: 20, 60
60 :header-rows: 1
61
62 * - Make Target
63 - Description
64 * - help
65 - Display available help for targets and flags
66 * - make help | lint-{topic}
67 - Display summary usage for lint-doc8, lint-license, lint-make
68 * - lint-{topic}-help
69 - Display extended help for a topic, supported makefile targets, etc
70
71Legacy Help Usage
72-----------------
73
74.. code:: bash
75
76 make help
Joey Armstrongb544dff2022-12-07 15:12:05 -050077 make help-verbose
78 make help VERBOSE=1
79
80|
81
82
Joey Armstronga9a16b62023-11-01 14:31:15 -040083doc8 / restructuredText (rst)
84=============================
Joey Armstrong4de98b72023-02-09 14:51:38 -050085
86Command: `doc8 <https://pypi.org/project/doc8/>`_
87
Joey Armstronga9a16b62023-11-01 14:31:15 -040088.. list-table:: Makefile Targets
89 :widths: 20, 60
90 :header-rows: 1
91
92 * - Target
93 - Description
94 * - help
95 - Display item ``lint-doc8`` as a summary help topic item.
96 * - lint-doc8-help
97 - Display extended help for ``lint-doc8`` targets
98 * -
99 -
100 * - lint-doc8
101 - Build system lint target used to syntax check restructuredText sources.
102 * - lint-doc8-all
103 - Filesystem traversal, check all ``*.rst`` sources.
104 * - lint-doc8-mod
105 - Syntax check locally modified files (~git status)
106 * - lint-doc8-src
107 - Syntax check a list of files passed in as an argument.
108 * -
109 -
110 * - lint-doc8-install
111 - Dependency driven installation of the doc8 tool.
112
Joey Armstrong4de98b72023-02-09 14:51:38 -0500113.. code:: bash
114
115 make clean
Joey Armstronga9a16b62023-11-01 14:31:15 -0400116 make lint-doc8 2>&1 | tee log
Joey Armstrong4de98b72023-02-09 14:51:38 -0500117
Joey Armstronga9a16b62023-11-01 14:31:15 -0400118 make lint # supported by repositories that define lint-doc8 as a default target.
Joey Armstrong4de98b72023-02-09 14:51:38 -0500119
Joey Armstronga9a16b62023-11-01 14:31:15 -0400120.. list-table:: Sources
121 :widths: 20, 60
122 :header-rows: 1
Joey Armstrong4de98b72023-02-09 14:51:38 -0500123
Joey Armstronga9a16b62023-11-01 14:31:15 -0400124 * - Source
125 - Description
126 * - `makefiles/lint/doc8/include.mk <http://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/doc8/include.mk>`_
127 - Main makefile logic for syntax checking RST sources.
128 * - `makefiles/lint/doc8/install.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/doc8/install.mk>`_
129 - Dependency logic to install the doc8 tool when needed.
130 * - `makefiles/lint/doc8/excl.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/doc8/install.mk>`_
131 - Common doc8 exclusion patterns for all repositories.
132
133See Also
134--------
Joey Armstrong4de98b72023-02-09 14:51:38 -0500135
Joey Armstrong1b8fdc32023-12-20 17:22:57 -0500136- lint-doc8-all target dependency will create a `python virtual env <https://wiki.opencord.org>`_
Joey Armstrong4de98b72023-02-09 14:51:38 -0500137- 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 -0400138- `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 -0500139
140|
141
142
143python: flake8
Joey Armstronga9a16b62023-11-01 14:31:15 -0400144==============
Joey Armstrong4de98b72023-02-09 14:51:38 -0500145
146Command: `flake8 <https://flake8.pycqa.org/en/latest>`_
147
148.. code:: bash
149
150 make clean
151 make lint 2>&1 | tee log
152 make lint-flake8-all 2>&1 | tee log
153 make lint-flake8-modified 2>&1 | tee log
154
155Sources:
156
Joey Armstrong644fb652023-10-02 13:12:20 -0400157- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500158- makefiles/lint/flake8.mk
159
160Notes:
161
Joey Armstrong1b8fdc32023-12-20 17:22:57 -0500162- lint-flake8-all target dependency will create a `python virtual env <https://wiki.opencord.org>`_
Joey Armstrong4de98b72023-02-09 14:51:38 -0500163- 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 -0400164- `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 -0500165
166|
167
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500168Helm Charts
Joey Armstronga9a16b62023-11-01 14:31:15 -0400169===========
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500170
171Command(s):
172- `helmlint.sh <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/helmlint.sh>`_
173
174.. code:: bash
175
176 make clean
177 make lint-chart lint-helm 2>&1 | tee log
178
179Sources:
180
181- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong2a687952023-02-01 13:10:12 -0500182- `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 -0500183- [`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>`_
184
185|
186
187
188Golang
Joey Armstronga9a16b62023-11-01 14:31:15 -0400189======
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500190
191Command:
192
193Sources:
194
Joey Armstrong644fb652023-10-02 13:12:20 -0400195- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500196
197|
198
Joey Armstrongb544dff2022-12-07 15:12:05 -0500199
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500200JSON
Joey Armstronga9a16b62023-11-01 14:31:15 -0400201====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500202
Joey Armstrong4de98b72023-02-09 14:51:38 -0500203Command: `json.tool <https://docs.python.org/3/library/json.html>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500204
205.. code:: bash
206
207 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500208 make lint 2>&1 | tee log
209 make lint-json-all 2>&1 | tee log
210 make lint-json-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500211
212Sources:
213
Joey Armstrong644fb652023-10-02 13:12:20 -0400214- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
215- `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 -0500216
217|
218
219
220License / Copyright notice
Joey Armstronga9a16b62023-11-01 14:31:15 -0400221==========================
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500222
223Command:
224
225.. code:: bash
226
227 make clean
228 make lint-license 2>&1 | tee log
229
230Sources:
231
232- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint>`__
Joey Armstrong8b426fc2023-11-14 16:09:11 -0500233- `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 -0500234
235|
236
237
Joey Armstrong4de98b72023-02-09 14:51:38 -0500238python: pylint
Joey Armstronga9a16b62023-11-01 14:31:15 -0400239==============
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500240
Joey Armstrong8b426fc2023-11-14 16:09:11 -0500241Command: `pylint <http://github.com/pylint-dev/pylint>`_, `pypi.org <https://pypi.org/project/pylint/>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500242
243.. code:: bash
244
245 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500246 make lint 2>&1 | tee log
247 make lint-pylint-all 2>&1 | tee log
248 make lint-pylint-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500249
250Sources:
251
Joey Armstrong644fb652023-10-02 13:12:20 -0400252- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong4de98b72023-02-09 14:51:38 -0500253- makefiles/lint/pylint.mk
Joey Armstrong644fb652023-10-02 13:12:20 -0400254- `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 -0500255
256Notes:
257
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500258- pylint the --py3k option is no longer supported by v3.10+
Joey Armstrong1b8fdc32023-12-20 17:22:57 -0500259- lint-pylint-all target dependency will create a `python virtual env <https://wiki.opencord.org>`_
Joey Armstrongbd6cc3d2023-01-09 19:52:12 -0500260- 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 -0500261
262|
263
264
265Robot
Joey Armstronga9a16b62023-11-01 14:31:15 -0400266=====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500267
Joey Armstrong4de98b72023-02-09 14:51:38 -0500268Command: rflint `robotframework-lint <https://pypi.org/project/robotframework-lint/>`_
269
270.. code:: bash
271
272 make clean
273 make lint 2>&1 | tee log
274 make lint-robot-all 2>&1 | tee log
275 make lint-robot-modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500276
277Sources:
278
Joey Armstrong644fb652023-10-02 13:12:20 -0400279- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
280- `makefiles/lint/robot.mk <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/robot.mk>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500281
282|
283
284
Joey Armstronga9a16b62023-11-01 14:31:15 -0400285Shell / Command Line Scripts
286============================
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500287
288Command: `shellcheck <https://github.com/koalaman/shellcheck>`_
289
Joey Armstrong4de98b72023-02-09 14:51:38 -0500290.. code:: bash
291
292 make clean
293 make lint 2>&1 | tee log
294 make lint-shell-all 2>&1 | tee log
295 make lint-shell-modified 2>&1 | tee log
296
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500297Sources:
298
Joey Armstrong644fb652023-10-02 13:12:20 -0400299- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
Joey Armstrong8b426fc2023-11-14 16:09:11 -0500300- `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 -0500301
302|
303
304
305Yaml
Joey Armstronga9a16b62023-11-01 14:31:15 -0400306====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500307
Joey Armstrong4de98b72023-02-09 14:51:38 -0500308Command: `yamllint <https://yamllint.readthedocs.io/en/stable/>`_
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500309
310.. code:: bash
311
312 make clean
Joey Armstrong4de98b72023-02-09 14:51:38 -0500313 make lint 2>&1 | tee log
314 make lint-yaml-all 2>&1 | tee log
315 make lint--modified 2>&1 | tee log
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500316
317Sources:
318
Joey Armstrong644fb652023-10-02 13:12:20 -0400319- `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/onf-make/+/refs/heads/master/makefiles/lint/>`__
320- `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 -0500321
322|
323
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500324
325Bugs
Joey Armstronga9a16b62023-11-01 14:31:15 -0400326====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500327
328- `jira::VOLTHA <https://jira.opencord.org/projects/VOL>`-
329- Include repository URL
330- Include gerrit/github changeset if available.
331- A logfile snippet of the error and surrounding context.
332
Joey Armstrongb544dff2022-12-07 15:12:05 -0500333|
334
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500335
336Repositories
Joey Armstronga9a16b62023-11-01 14:31:15 -0400337============
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500338
339- [`master <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master>`__] `bbsim <https://gerrit.opencord.org/plugins/gitiles/bbsim>`_
340- [`master <https://gerrit.opencord.org/plugins/gitiles/pod-configs/+/refs/heads/master>`__] `pod-configs <https://gerrit.opencord.org/plugins/gitiles/pod-configs>`_
341- [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_
342- [`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 -0500343- [`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 -0500344
Joey Armstrongb544dff2022-12-07 15:12:05 -0500345|
346
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500347
348Notes
Joey Armstronga9a16b62023-11-01 14:31:15 -0400349=====
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500350
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500351- Volume problem reports require cleanup before linting can become a default.
Joey Armstrong4de98b72023-02-09 14:51:38 -0500352
353 - After bulk linting problems for a language source have been cleaned up
354 default linting can be enabled by modifing {project-root}/config.mk.
355
Joey Armstronga8bc8e12022-12-04 07:06:59 -0500356- Lint target support is globally available across repositories, given time
357 it will be. Submit patches as needed or open a jira ticket to request
358 linting support in specific repositories.
359- Makefile refactoring: yes absolutely! Baby steps are needed in the interim...
Joey Armstrongb544dff2022-12-07 15:12:05 -0500360
361|