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 |
| 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 | |
| 26 | All Sources |
| 27 | +++++++++++ |
| 28 | |
| 29 | The 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 Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 38 | |
| 39 | Makefile help |
| 40 | ~~~~~~~~~~~~~ |
| 41 | |
Joey Armstrong | bd6cc3d | 2023-01-09 19:52:12 -0500 | [diff] [blame] | 42 | Individual Makefiles support a help target that will display a list of |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 43 | targets 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 Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 54 | Helm Charts |
| 55 | +++++++++++ |
| 56 | |
| 57 | Command(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 | |
| 65 | Sources: |
| 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 | |
| 74 | Golang |
| 75 | ++++++ |
| 76 | |
| 77 | Command: |
| 78 | |
| 79 | Sources: |
| 80 | |
| 81 | - `makefiles/lint <https://gerrit.opencord.org/plugins/gitiles/voltha-docs/+/refs/heads/master/makefiles/lint/>`__ |
| 82 | |
| 83 | | |
| 84 | |
Joey Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 85 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 86 | JSON |
| 87 | ++++ |
| 88 | |
| 89 | Command: |
| 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 | |
| 97 | Sources: |
| 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 | |
| 105 | License / Copyright notice |
| 106 | ++++++++++++++++++++++++++ |
| 107 | |
| 108 | Command: |
| 109 | |
| 110 | .. code:: bash |
| 111 | |
| 112 | make clean |
| 113 | make lint-license 2>&1 | tee log |
| 114 | |
| 115 | Sources: |
| 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 | |
| 123 | python |
| 124 | ++++++ |
| 125 | |
| 126 | Command: |
| 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 | |
| 135 | Sources: |
| 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 | |
| 141 | Notes: |
| 142 | |
Joey Armstrong | bd6cc3d | 2023-01-09 19:52:12 -0500 | [diff] [blame] | 143 | - pylint the --py3k option is no longer supported by v3.10+ |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 144 | - lint-python 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] | 145 | - 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] | 146 | |
| 147 | | |
| 148 | |
| 149 | |
| 150 | Robot |
| 151 | +++++ |
| 152 | |
| 153 | Command: rflint |
| 154 | |
| 155 | Sources: |
| 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 | |
| 163 | reStructedTextFile (rst) |
| 164 | ++++++++++++++++++++++++ |
| 165 | |
| 166 | Command: `doc8 <https://pypi.org/project/doc8/>`_ |
| 167 | |
| 168 | Sources: |
| 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 | |
| 176 | Shell |
| 177 | +++++ |
| 178 | |
| 179 | Command: `shellcheck <https://github.com/koalaman/shellcheck>`_ |
| 180 | |
| 181 | Sources: |
| 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 | |
| 189 | Yaml |
| 190 | ++++ |
| 191 | |
| 192 | Command: yamllint |
| 193 | |
| 194 | .. code:: bash |
| 195 | |
| 196 | make clean |
| 197 | make lint-yaml 2>&1 | tee log |
| 198 | |
| 199 | Sources: |
| 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 Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 206 | |
| 207 | Bugs |
| 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 Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 215 | | |
| 216 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 217 | |
| 218 | Repositories |
| 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 Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 227 | | |
| 228 | |
Joey Armstrong | a8bc8e1 | 2022-12-04 07:06:59 -0500 | [diff] [blame] | 229 | |
| 230 | Notes |
| 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 Armstrong | b544dff | 2022-12-07 15:12:05 -0500 | [diff] [blame] | 239 | |
| 240 | | |