Fatih Degirmenci | f4a2bbf | 2020-01-14 15:59:15 +0000 | [diff] [blame] | 1 | .. _framework-developer-guide: |
Fatih Degirmenci | 66d1e60 | 2020-01-13 12:50:03 +0000 | [diff] [blame] | 2 | |
Fatih Degirmenci | f4a2bbf | 2020-01-14 15:59:15 +0000 | [diff] [blame] | 3 | ================================================ |
| 4 | Cloud Infra Automation Framework Developer Guide |
| 5 | ================================================ |
Fatih Degirmenci | 89b4f8f | 2020-01-07 00:08:50 +0000 | [diff] [blame] | 6 | |
| 7 | Introduction |
| 8 | ============ |
| 9 | |
| 10 | TBD |
| 11 | |
| 12 | Developing New Features |
| 13 | ======================= |
| 14 | |
| 15 | TBD |
| 16 | |
| 17 | Testing Your Changes |
| 18 | -------------------- |
| 19 | |
| 20 | **Static Code Analysis** |
| 21 | |
| 22 | Engine bash scripts, Ansible playbooks, and other YAML files are subject |
| 23 | to static code analysis using various utilities listed below. |
| 24 | |
| 25 | * `ansible-lint <https://github.com/ansible/ansible-lint>`_ |
| 26 | * `shellcheck <https://github.com/koalaman/shellcheck>`_ |
| 27 | * `yamllint <https://github.com/adrienverge/yamllint>`_ |
| 28 | |
| 29 | It is always a good idea to test your changes locally before sending them |
| 30 | for code review and for further testing in order to receive fastest possible |
| 31 | feedback and also to avoid unnecessary failures on CI. |
| 32 | |
| 33 | 1. Install python and virtualenv |
| 34 | |
| 35 | | ``sudo apt install -y python3-minimal virtualenv`` |
| 36 | |
| 37 | 2. Create and activate virtualenv |
| 38 | |
| 39 | | ``virtualenv -p python3 .venv`` |
| 40 | | ``source .venv/bin/activate`` |
| 41 | |
| 42 | 3. Install test requirements |
| 43 | |
| 44 | | ``pip install -r test-requirements.txt`` |
| 45 | |
| 46 | 4. Use tox to run static code analysis |
| 47 | |
| 48 | 4a. Run all tests |
| 49 | |
| 50 | | ``tox`` |
| 51 | |
| 52 | 4b. Run ansible-lint |
| 53 | |
| 54 | | ``tox -e ansible-lint`` |
| 55 | |
| 56 | 4c. Run shellcheck |
| 57 | |
| 58 | | ``tox -e shellcheck`` |
| 59 | |
| 60 | 4d. Run yamllint |
| 61 | |
| 62 | | ``tox -e yamllint`` |
| 63 | |
| 64 | 4e. Run multiple checks using comma seperated list |
| 65 | |
| 66 | | ``tox -e ansible-lint,shellcheck`` |
| 67 | |
| 68 | References |
| 69 | ========== |
| 70 | |
| 71 | TBD |