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] |
| 24 | lint-flake8 Syntax check using pylint and flake8 |
| 25 | lint-pylint Syntax check using pylint and flake8 |
| 26 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 27 | | |
| 28 | |
| 29 | |
| 30 | All Sources |
| 31 | +++++++++++ |
| 32 | |
| 33 | The generic lint target can be used to invoke all defined lint targets. |
| 34 | |
| 35 | .. code:: bash |
| 36 | |
| 37 | make clean |
| 38 | make lint 2>&1 | tee log |
| 39 | |
| 40 | | |
| 41 | |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 42 | |
| 43 | Makefile help |
| 44 | ~~~~~~~~~~~~~ |
| 45 | |
Joey Armstrong | bd6cc3d | 2023-01-09 19:52:12 -0500 | [diff] [blame] | 46 | Individual Makefiles support a help target that will display a list of |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 47 | targets and functionality supported. |
| 48 | |
| 49 | .. code:: bash |
| 50 | |
| 51 | make help |
| 52 | make help-verbose |
| 53 | make help VERBOSE=1 |
| 54 | |
| 55 | | |
| 56 | |
| 57 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 58 | doc8 / RST files |
| 59 | ++++++++++++++++ |
| 60 | |
| 61 | Command: `doc8 <https://pypi.org/project/doc8/>`_ |
| 62 | |
| 63 | .. code:: bash |
| 64 | |
| 65 | make clean |
| 66 | make lint 2>&1 | tee log |
| 67 | make lint-doc8-all 2>&1 | tee log |
| 68 | make lint-doc8-modified 2>&1 | tee log |
| 69 | |
| 70 | Sources: |
| 71 | |
| 72 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 73 | - makefiles/lint/doc8.mk |
| 74 | |
| 75 | Notes: |
| 76 | |
| 77 | - lint-doc8-all target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_ |
| 78 | - python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed). |
| 79 | - `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_ |
| 80 | |
| 81 | | |
| 82 | |
| 83 | |
| 84 | python: flake8 |
| 85 | ++++++++++++++ |
| 86 | |
| 87 | Command: `flake8 <https://flake8.pycqa.org/en/latest>`_ |
| 88 | |
| 89 | .. code:: bash |
| 90 | |
| 91 | make clean |
| 92 | make lint 2>&1 | tee log |
| 93 | make lint-flake8-all 2>&1 | tee log |
| 94 | make lint-flake8-modified 2>&1 | tee log |
| 95 | |
| 96 | Sources: |
| 97 | |
| 98 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 99 | - makefiles/lint/flake8.mk |
| 100 | |
| 101 | Notes: |
| 102 | |
| 103 | - lint-flake8-all target dependency will create a `python virtual env <https://wiki.opennetworking.org/display/JOEY/PythonVenv>`_ |
| 104 | - python 3.10+ requires `virtual env patching <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/patches/>`_ (dynamic, applied when needed). |
| 105 | - `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_ |
| 106 | |
| 107 | | |
| 108 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 109 | Helm Charts |
| 110 | +++++++++++ |
| 111 | |
| 112 | Command(s): |
| 113 | - `helmlint.sh <https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/helmlint.sh>`_ |
| 114 | |
| 115 | .. code:: bash |
| 116 | |
| 117 | make clean |
| 118 | make lint-chart lint-helm 2>&1 | tee log |
| 119 | |
| 120 | Sources: |
| 121 | |
| 122 | - `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] | 123 | - `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] | 124 | - [`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>`_ |
| 125 | |
| 126 | | |
| 127 | |
| 128 | |
| 129 | Golang |
| 130 | ++++++ |
| 131 | |
| 132 | Command: |
| 133 | |
| 134 | Sources: |
| 135 | |
| 136 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 137 | |
| 138 | | |
| 139 | |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 140 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 141 | JSON |
| 142 | ++++ |
| 143 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 144 | Command: `json.tool <https://docs.python.org/3/library/json.html>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 145 | |
| 146 | .. code:: bash |
| 147 | |
| 148 | make clean |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 149 | make lint 2>&1 | tee log |
| 150 | make lint-json-all 2>&1 | tee log |
| 151 | make lint-json-modified 2>&1 | tee log |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 152 | |
| 153 | Sources: |
| 154 | |
| 155 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 156 | - `makefiles/lint/json.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/json.mk>`_ |
| 157 | |
| 158 | | |
| 159 | |
| 160 | |
| 161 | License / Copyright notice |
| 162 | ++++++++++++++++++++++++++ |
| 163 | |
| 164 | Command: |
| 165 | |
| 166 | .. code:: bash |
| 167 | |
| 168 | make clean |
| 169 | make lint-license 2>&1 | tee log |
| 170 | |
| 171 | Sources: |
| 172 | |
| 173 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint>`__ |
| 174 | - `makefiles/lint/license.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/makefiles/lint/license/include.mk>`_ |
| 175 | |
| 176 | | |
| 177 | |
| 178 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 179 | python: pylint |
| 180 | ++++++++++++++ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 181 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 182 | Command: `pylint <https://www.pylint.org/>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 183 | |
| 184 | .. code:: bash |
| 185 | |
| 186 | make clean |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 187 | make lint 2>&1 | tee log |
| 188 | make lint-pylint-all 2>&1 | tee log |
| 189 | make lint-pylint-modified 2>&1 | tee log |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 190 | |
| 191 | Sources: |
| 192 | |
| 193 | - `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] | 194 | - makefiles/lint/pylint.mk |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 195 | - `makefiles/patches/include.mk <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/patches/>`_ |
| 196 | |
| 197 | Notes: |
| 198 | |
Joey Armstrong | bd6cc3d | 2023-01-09 19:52:12 -0500 | [diff] [blame] | 199 | - pylint the --py3k option is no longer supported by v3.10+ |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 200 | - 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] | 201 | - 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] | 202 | |
| 203 | | |
| 204 | |
| 205 | |
| 206 | Robot |
| 207 | +++++ |
| 208 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 209 | Command: rflint `robotframework-lint <https://pypi.org/project/robotframework-lint/>`_ |
| 210 | |
| 211 | .. code:: bash |
| 212 | |
| 213 | make clean |
| 214 | make lint 2>&1 | tee log |
| 215 | make lint-robot-all 2>&1 | tee log |
| 216 | make lint-robot-modified 2>&1 | tee log |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 217 | |
| 218 | Sources: |
| 219 | |
| 220 | - `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] | 221 | - `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] | 222 | |
| 223 | | |
| 224 | |
| 225 | |
| 226 | reStructedTextFile (rst) |
| 227 | ++++++++++++++++++++++++ |
| 228 | |
| 229 | Command: `doc8 <https://pypi.org/project/doc8/>`_ |
| 230 | |
| 231 | Sources: |
| 232 | |
| 233 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 234 | - `Makefiles::doc8 <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/Makefile#98>`_ |
| 235 | |
| 236 | | |
| 237 | |
| 238 | |
| 239 | Shell |
| 240 | +++++ |
| 241 | |
| 242 | Command: `shellcheck <https://github.com/koalaman/shellcheck>`_ |
| 243 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 244 | .. code:: bash |
| 245 | |
| 246 | make clean |
| 247 | make lint 2>&1 | tee log |
| 248 | make lint-shell-all 2>&1 | tee log |
| 249 | make lint-shell-modified 2>&1 | tee log |
| 250 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 251 | Sources: |
| 252 | |
| 253 | - `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] | 254 | - `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] | 255 | |
| 256 | | |
| 257 | |
| 258 | |
| 259 | Yaml |
| 260 | ++++ |
| 261 | |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 262 | Command: `yamllint <https://yamllint.readthedocs.io/en/stable/>`_ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 263 | |
| 264 | .. code:: bash |
| 265 | |
| 266 | make clean |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 267 | make lint 2>&1 | tee log |
| 268 | make lint-yaml-all 2>&1 | tee log |
| 269 | make lint--modified 2>&1 | tee log |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 270 | |
| 271 | Sources: |
| 272 | |
| 273 | - `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] | 274 | - `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] | 275 | |
| 276 | | |
| 277 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 278 | |
| 279 | Bugs |
| 280 | ~~~~ |
| 281 | |
| 282 | - `jira::VOLTHA <https://jira.opencord.org/projects/VOL>`- |
| 283 | - Include repository URL |
| 284 | - Include gerrit/github changeset if available. |
| 285 | - A logfile snippet of the error and surrounding context. |
| 286 | |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 287 | | |
| 288 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 289 | |
| 290 | Repositories |
| 291 | ++++++++++++ |
| 292 | |
| 293 | - [`master <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master>`__] `bbsim <https://gerrit.opencord.org/plugins/gitiles/bbsim>`_ |
| 294 | - [`master <https://gerrit.opencord.org/plugins/gitiles/pod-configs/+/refs/heads/master>`__] `pod-configs <https://gerrit.opencord.org/plugins/gitiles/pod-configs>`_ |
| 295 | - [`master <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master>`__] `voltha-docs <https://gerrit.opencord.org/plugins/gitiles/voltha-docs>`_ |
| 296 | - [`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] | 297 | - [`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] | 298 | |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 299 | | |
| 300 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 301 | |
| 302 | Notes |
| 303 | ~~~~~ |
| 304 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 305 | - Volume problem reports require cleanup before linting can become a default. |
Joey Armstrong | 4de98b7 | 2023-02-09 14:51:38 -0500 | [diff] [blame] | 306 | |
| 307 | - After bulk linting problems for a language source have been cleaned up |
| 308 | default linting can be enabled by modifing {project-root}/config.mk. |
| 309 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 310 | - Lint target support is globally available across repositories, given time |
| 311 | it will be. Submit patches as needed or open a jira ticket to request |
| 312 | linting support in specific repositories. |
| 313 | - Makefile refactoring: yes absolutely! Baby steps are needed in the interim... |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 314 | |
| 315 | | |