Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 1 | Source code syntax checking |
| 2 | =========================== |
| 3 | |
| 4 | Getting 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 Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 14 | lint-doc8 Syntax check *.rst documentation files. |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 15 | lint-helm Syntax check helm configs |
| 16 | lint-json Syntax check json sources |
| 17 | lint-license Verify sources contain a license block. |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 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 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 23 | [PYTHON] |
Joey Armstrong | a2fa658 | 2023-04-07 11:03:36 -0400 | [diff] [blame] | 24 | 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 Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 27 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 28 | | |
| 29 | |
| 30 | |
| 31 | All Sources |
| 32 | +++++++++++ |
| 33 | |
| 34 | The 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 Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 43 | |
| 44 | Makefile help |
| 45 | ~~~~~~~~~~~~~ |
| 46 | |
Joey Armstrong | bd6cc3d | 2023-01-09 19:52:12 -0500 | [diff] [blame] | 47 | Individual Makefiles support a help target that will display a list of |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 48 | targets 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 Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 59 | doc8 / RST files |
| 60 | ++++++++++++++++ |
| 61 | |
| 62 | Command: `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 | |
| 71 | Sources: |
| 72 | |
| 73 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 74 | - makefiles/lint/doc8.mk |
| 75 | |
| 76 | Notes: |
| 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 | |
| 85 | python: flake8 |
| 86 | ++++++++++++++ |
| 87 | |
| 88 | Command: `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 | |
| 97 | Sources: |
| 98 | |
| 99 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 100 | - makefiles/lint/flake8.mk |
| 101 | |
| 102 | Notes: |
| 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 Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 110 | Helm Charts |
| 111 | +++++++++++ |
| 112 | |
| 113 | Command(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 | |
| 121 | Sources: |
| 122 | |
| 123 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/>`__ |
Joey Armstrong | 2a68795 | 2023-02-01 13:10:12 -0500 | [diff] [blame] | 124 | - `makefiles/lint/helm/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-helm-charts/+/refs/heads/master/makefiles/lint/helm/include.mk>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 125 | - [`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 | |
| 130 | Golang |
| 131 | ++++++ |
| 132 | |
| 133 | Command: |
| 134 | |
| 135 | Sources: |
| 136 | |
| 137 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 138 | |
| 139 | | |
| 140 | |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 141 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 142 | JSON |
| 143 | ++++ |
| 144 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 145 | Command: `json.tool <https://docs.python.org/3/library/json.html>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 146 | |
| 147 | .. code:: bash |
| 148 | |
| 149 | make clean |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 150 | 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 Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 153 | |
| 154 | Sources: |
| 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 | |
| 162 | License / Copyright notice |
| 163 | ++++++++++++++++++++++++++ |
| 164 | |
| 165 | Command: |
| 166 | |
| 167 | .. code:: bash |
| 168 | |
| 169 | make clean |
| 170 | make lint-license 2>&1 | tee log |
| 171 | |
| 172 | Sources: |
| 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 Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 180 | python: pylint |
| 181 | ++++++++++++++ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 182 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 183 | Command: `pylint <https://www.pylint.org/>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 184 | |
| 185 | .. code:: bash |
| 186 | |
| 187 | make clean |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 188 | 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 Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 191 | |
| 192 | Sources: |
| 193 | |
| 194 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 195 | - makefiles/lint/pylint.mk |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 196 | - `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_ |
| 197 | |
| 198 | Notes: |
| 199 | |
Joey Armstrong | bd6cc3d | 2023-01-09 19:52:12 -0500 | [diff] [blame] | 200 | - pylint the --py3k option is no longer supported by v3.10+ |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 201 | - lint-pylint-all target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_ |
Joey Armstrong | bd6cc3d | 2023-01-09 19:52:12 -0500 | [diff] [blame] | 202 | - python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed). |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 203 | |
| 204 | | |
| 205 | |
| 206 | |
| 207 | Robot |
| 208 | +++++ |
| 209 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 210 | Command: 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 Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 218 | |
| 219 | Sources: |
| 220 | |
| 221 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 222 | - `makefiles/lint/robot.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/robot.mk>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 223 | |
| 224 | | |
| 225 | |
| 226 | |
| 227 | reStructedTextFile (rst) |
| 228 | ++++++++++++++++++++++++ |
| 229 | |
| 230 | Command: `doc8 <https://pypi.org/project/doc8/>`_ |
| 231 | |
| 232 | Sources: |
| 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 | |
| 240 | Shell |
| 241 | +++++ |
| 242 | |
| 243 | Command: `shellcheck <https://github.com/koalaman/shellcheck>`_ |
| 244 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 245 | .. 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 Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 252 | Sources: |
| 253 | |
| 254 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 255 | - `makefiles/lint/shell.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/shell.mk>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 256 | |
| 257 | | |
| 258 | |
| 259 | |
| 260 | Yaml |
| 261 | ++++ |
| 262 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 263 | Command: `yamllint <https://yamllint.readthedocs.io/en/stable/>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 264 | |
| 265 | .. code:: bash |
| 266 | |
| 267 | make clean |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 268 | make lint 2>&1 | tee log |
| 269 | make lint-yaml-all 2>&1 | tee log |
| 270 | make lint--modified 2>&1 | tee log |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 271 | |
| 272 | Sources: |
| 273 | |
| 274 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 275 | - `makefiles/lint/yaml.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/yaml.mk>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 276 | |
| 277 | | |
| 278 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 279 | |
| 280 | Bugs |
| 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 Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 288 | | |
| 289 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 290 | |
| 291 | Repositories |
| 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 Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 298 | - [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 299 | |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 300 | | |
| 301 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 302 | |
| 303 | Notes |
| 304 | ~~~~~ |
| 305 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 306 | - Volume problem reports require cleanup before linting can become a default. |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 307 | |
| 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 Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 311 | - 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 Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 315 | |
| 316 | | |