From b4fd1ead42e0b92dce243f0699bfbbb1745fa08f Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 12 Sep 2023 17:02:27 +0100 Subject: [PATCH] Enable prettier (#137) --- .github/workflows/ack.yml | 12 ++++++------ .github/workflows/notify.yml | 6 +++--- .github/workflows/push.yml | 6 +++--- .github/workflows/release.yml | 7 +++---- .pre-commit-config.yaml | 8 +++++++- README.md | 1 + config/devtools.yml | 2 +- docs/guides/gha.md | 14 +++++++------- docs/guides/mentoring.md | 9 +++++++-- docs/guides/python/packaging.md | 15 +++++++-------- docs/guides/python/pytest.md | 2 +- docs/guides/python/release.md | 9 +++++---- docs/guides/python/tox.md | 11 +++++------ docs/guides/vscode/release.md | 2 +- docs/stats/molecule-plugins.md | 15 +++++++-------- playbooks/sync.yml | 2 +- 16 files changed, 65 insertions(+), 56 deletions(-) diff --git a/.github/workflows/ack.yml b/.github/workflows/ack.yml index 8d78105..b617f9f 100644 --- a/.github/workflows/ack.yml +++ b/.github/workflows/ack.yml @@ -5,17 +5,17 @@ name: ack on: pull_request_target: types: [opened, labeled, unlabeled, synchronize] - workflow_call: # allows reuse of this workflow from other devtools repos + workflow_call: # allows reuse of this workflow from other devtools repos jobs: ack: runs-on: ubuntu-latest + environment: ack permissions: checks: write contents: read pull-requests: write steps: - - name: Checkout uses: actions/checkout@v4 @@ -37,10 +37,10 @@ jobs: - name: Verify PR label action uses: jesusvasquez333/verify-pr-label-action@v1.4.0 with: - github-token: '${{ secrets.GITHUB_TOKEN }}' - valid-labels: 'bug, enhancement, feature, refactoring, major, deprecated, skip-changelog, bot:chronographer:skip' - invalid-labels: 'help wanted, invalid, feedback-needed, incomplete' - pull-request-number: '${{ github.event.pull_request.number }}' + github-token: "${{ secrets.GITHUB_TOKEN }}" + valid-labels: "bug, enhancement, feature, refactoring, major, deprecated, skip-changelog, bot:chronographer:skip" + invalid-labels: "help wanted, invalid, feedback-needed, incomplete" + pull-request-number: "${{ github.event.pull_request.number }}" disable-reviews: true - name: Update release notes if this is already merged diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index 59a86db..5b854a6 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -12,7 +12,7 @@ on: matrix_room_id: description: Matrix ROOM ID type: string - default: '!aqMMMrOxRZzVDkUlWF:matrix.org' # ansible-devtools + default: "!aqMMMrOxRZzVDkUlWF:matrix.org" # ansible-devtools workflow_dispatch: inputs: message: @@ -22,7 +22,7 @@ on: matrix_room_id: description: Matrix ROOM ID type: string - default: '!aqMMMrOxRZzVDkUlWF:matrix.org' # ansible-devtools + default: "!aqMMMrOxRZzVDkUlWF:matrix.org" # ansible-devtools jobs: send-message: @@ -43,7 +43,7 @@ jobs: - name: send message uses: s3krit/matrix-message-action@v0.0.3 with: - room_id: '!aqMMMrOxRZzVDkUlWF:matrix.org' # ansible-devtools + room_id: "!aqMMMrOxRZzVDkUlWF:matrix.org" # ansible-devtools access_token: ${{ secrets.MATRIX_TOKEN }} # https://doc.matrix.tu-dresden.de/en/messaging/formatting/ message: > diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 41e6aa0..b74cc93 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -8,9 +8,9 @@ on: # branches to consider in the event; optional, defaults to all branches: - main - - 'releases/**' - - 'stable/**' - workflow_call: # allows reuse of this workflow from other devtools repos + - "releases/**" + - "stable/**" + workflow_call: # allows reuse of this workflow from other devtools repos jobs: update_release_draft: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e72704..3d7e510 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,10 +11,10 @@ on: type: boolean secrets: pypi_password: - description: 'API token for pypi.org' + description: "API token for pypi.org" required: true testpypi_password: - description: 'API token for test.pypi.org' + description: "API token for test.pypi.org" required: true jobs: @@ -31,7 +31,6 @@ jobs: TOX_PARALLEL_NO_SPINNER: 1 steps: - - name: Switch to using Python 3.8 by default uses: actions/setup-python@v4 with: @@ -44,7 +43,7 @@ jobs: - name: Check out src from Git uses: actions/checkout@v4 with: - fetch-depth: 0 # needed by setuptools-scm + fetch-depth: 0 # needed by setuptools-scm - name: Build dists run: python -m tox diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 863cd7e..c043429 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,13 @@ --- repos: + - repo: https://github.com/pre-commit/mirrors-prettier + # keep it before yamllint + rev: v3.0.3 + hooks: + - id: prettier + always_run: true - repo: https://github.com/PyCQA/doc8 - rev: 'v1.1.1' + rev: "v1.1.1" hooks: - id: doc8 - repo: https://github.com/codespell-project/codespell diff --git a/README.md b/README.md index 6b6e0bc..c956884 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ vscode-ansible:::tsclass --> vscode-yaml; ``` Note: + 1. [vscode-yaml](https://github.com/redhat-developer/vscode-yaml) project is not directly supported by Ansible devtools team. 2. dotted lines are either test, build or optional requirements 3. 📘 python, 📙 typescript, 📕 ansible collection, 📗 container 📒 github action diff --git a/config/devtools.yml b/config/devtools.yml index 613adfa..9041940 100644 --- a/config/devtools.yml +++ b/config/devtools.yml @@ -4,7 +4,7 @@ repos: - ansible-community/molecule - ansible-community/molecule-plugins - - ansible-community/protogen # deprecated? + - ansible-community/protogen # deprecated? - ansible-community/role2collection - ansible/ansible-compat - ansible/ansible-language-server diff --git a/docs/guides/gha.md b/docs/guides/gha.md index 809b768..12467e2 100644 --- a/docs/guides/gha.md +++ b/docs/guides/gha.md @@ -1,15 +1,15 @@ # Github Actions -* workflow name should be **short** and **lowercase** and match the name of the workflow file -* do not use a workflow name like "ci" because all workflows are related to CI one way or another so they would not be informative +- workflow name should be **short** and **lowercase** and match the name of the workflow file +- do not use a workflow name like "ci" because all workflows are related to CI one way or another so they would not be informative ## Common workflow names -* `tox` : testing jobs that rely on tox, job names should match `tox -e xxx` -* `npm` : testing jobs that reply on npm, job name should match `npm run xxx` -* `ack` : shared workflow that is triggered on any pull-request review, like editing labels -* `push` : shared workflow that is triggered on a merge, usually updates release note drafts -* `release` : workflow that is triggered when a release is made +- `tox` : testing jobs that rely on tox, job names should match `tox -e xxx` +- `npm` : testing jobs that reply on npm, job name should match `npm run xxx` +- `ack` : shared workflow that is triggered on any pull-request review, like editing labels +- `push` : shared workflow that is triggered on a merge, usually updates release note drafts +- `release` : workflow that is triggered when a release is made ## Use a final `check` job to summarize results diff --git a/docs/guides/mentoring.md b/docs/guides/mentoring.md index 7276749..9625036 100644 --- a/docs/guides/mentoring.md +++ b/docs/guides/mentoring.md @@ -3,14 +3,16 @@ **Ansible DevTools** team works almost exclusively on upstream projects, we do engage with other contributors every day. That is why, we are welcoming various periodic mentorship programs. ## For mentees + If you want to learn better on how to improve your **open-source collaboration** and maybe become maintainer of one project, that program might help you achieve this much easier. The mentorship program should also help you improve collaboration with other open-source projects, especially with those from Python ecosystem. ### Checklist + - [ ] Read and acknowledge our [CoC](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html). TDLD; just be nice and friendly! - [ ] Join `#ansible-devtools` [matrix or irc](https://docs.ansible.com/ansible/latest/community/communication.html#working-groups) channels using a permanent username, preferably the same as your GitHub account. Remain there as that would be the main medium of communication. Matrix keeps messages by default but if you choose the irc bridged room, you will need to use a bouncer to not miss messages while away. -- [ ] You are welcomed to join or follow us on [twitter](https://twitter.com/i/communities/1530798265561714693), [reddit](https://www.reddit.com/r/ansible/) and engage with others. Socializing is an important skill to master, but also try to avoid overdoing it. Making your name known to others plays an important part in improving collaboration with them but it is a slow process. +- [ ] You are welcomed to join or follow us on [twitter](https://twitter.com/i/communities/1530798265561714693), [reddit](https://www.reddit.com/r/ansible/) and engage with others. Socializing is an important skill to master, but also try to avoid overdoing it. Making your name known to others plays an important part in improving collaboration with them but it is a slow process. - [ ] Ask your mentor to setup a weekly meeting with you, likely 30 minutes. - [ ] Check time availability during the day and remember when it is more likely to be able to have quick chats with your mentor. - [ ] Keep an agenda of items you want to discuss with your mentor, as you are the one that drives the process, not him. @@ -18,17 +20,20 @@ The mentorship program should also help you improve collaboration with other ope - [ ] You will see that often enough, you discover unrelated problems that need to be sorted before you can even address the one you were working on. You can either fix them yourself or nicely try to persuade someone else to fix them, often they are problems on some external dependencies. ### Suggestions -- Prefer using the public channel unless the question is really sensitive, like a security or a personal one + +- Prefer using the public channel unless the question is really sensitive, like a security or a personal one - If blocked trying to do something, ask for someone to help you with directions - If you fail to understand a particular CI/CD failure, ask about it ## For mentors + - [ ] Maintain a recurrent meetings with your mentee and support them in their goals - [ ] Be available on chat, make use of public and private channels - [ ] Remember that each side is expected to learn from the other one and that the mentorship program is not about teaching someone that the way you do is the right way. - [ ] Welcome mentees to question anything, to see why things are one way or another and allow them to come with new ideas. ## Asking for mentorship + - As mentoring is a personal experience, you will need to ask your potential mentor about it in a private message, chat or email. - Check if you have enough available time to invest in that. It would not be unreasonable to assume that at least **4h/week** would be needed for at least few months. - Be sure you mention what you aim to gain from that experience, what areas you want to focus on. diff --git a/docs/guides/python/packaging.md b/docs/guides/python/packaging.md index 752ee30..fe27a08 100644 --- a/docs/guides/python/packaging.md +++ b/docs/guides/python/packaging.md @@ -1,13 +1,12 @@ This document is work-in-progress. For the moment it contains only generic guidelines, most of them already used by our projects. -* Ensure we use `src/` layout so we do not accidentally import the module without installation -* Use PEP-517 and seek removal `setup.py`, test if via `tox -e pkg` command. -* Use PEP-621 and seek removal of `setup.cfg` and `pyprojects.toml` files. -* Make docs and test dependencies extras -* Have a single `requirements.txt` that is a lock file produced by pip-compile (pip-tools) -* Enable dependabot to update the `requirements.txt` lock file, optionally focus on a subset of dependencies and limit the maximum number of open pull-requests -* Create tox `deps` job that is updating all dependencies using pip-compile. - +- Ensure we use `src/` layout so we do not accidentally import the module without installation +- Use PEP-517 and seek removal `setup.py`, test if via `tox -e pkg` command. +- Use PEP-621 and seek removal of `setup.cfg` and `pyprojects.toml` files. +- Make docs and test dependencies extras +- Have a single `requirements.txt` that is a lock file produced by pip-compile (pip-tools) +- Enable dependabot to update the `requirements.txt` lock file, optionally focus on a subset of dependencies and limit the maximum number of open pull-requests +- Create tox `deps` job that is updating all dependencies using pip-compile. # tox -e pkg diff --git a/docs/guides/python/pytest.md b/docs/guides/python/pytest.md index e1a289e..489ae50 100644 --- a/docs/guides/python/pytest.md +++ b/docs/guides/python/pytest.md @@ -1,3 +1,3 @@ Useful resources for pytest: -* https://pganssle-talks.github.io/xfail-lightning +- https://pganssle-talks.github.io/xfail-lightning diff --git a/docs/guides/python/release.md b/docs/guides/python/release.md index 313bd75..3ef38ab 100644 --- a/docs/guides/python/release.md +++ b/docs/guides/python/release.md @@ -2,10 +2,10 @@ Thanks to the integrations which are in place, it is very easy to release a newer version of our python projects i.e. [ansible-lint], [ansible-navigator], [ansible-compat] and [molecule]. -[ansible-lint]:https://github.com/ansible/ansible-lint -[ansible-navigator]:https://github.com/ansible/ansible-navigator -[ansible-compat]:https://github.com/ansible/ansible-compat -[molecule]:https://github.com/ansible-community/molecule +[ansible-lint]: https://github.com/ansible/ansible-lint +[ansible-navigator]: https://github.com/ansible/ansible-navigator +[ansible-compat]: https://github.com/ansible/ansible-compat +[molecule]: https://github.com/ansible-community/molecule Anyone with appropriate permission to the respective projects will be able to rollout a new release. @@ -19,6 +19,7 @@ We use [release-drafter](https://github.com/release-drafter/release-drafter) whi When a PR is merged, release-drafter runs and adds PR details to the changelog as shown above. # Releasing a new version + Go to `Draft a new release` inside Github releases and release it! while being sure that you create a discussion thread for it. This will create a new tag. Once released, the latest version will be deployed and published to PyPI registry. diff --git a/docs/guides/python/tox.md b/docs/guides/python/tox.md index aa0e17f..fafc321 100644 --- a/docs/guides/python/tox.md +++ b/docs/guides/python/tox.md @@ -42,7 +42,6 @@ In order to fail-fast, we want to run quick tests first, like `lint`. The longes When you run `tox -av`, you will also see the description of each environment, which can be quite informative for a new contributor. Be sure that all of them have a description, one that is less than ~100 characters as wrapping them in terminal makes the whole list harder to read. If you want to add extra details, use comments inside the ini file. - ## use short and consistent naming for env names Tox env names should be short (easy to type) and consistent across projects, so they do not conflict with muscle-memory. @@ -51,11 +50,11 @@ Tox env name should not be about the tool as that may change, it should be more Current list of popular names: -* `py` - unitests -* `lint` - linting, runts all linters (likely pre-commit) -* `docs` - anything related to building docs (aka Sphinx) -* `packaging` - tests related to python packaging -* `deps` - Bumping of test dependencies. This should not be included in default `envlist`, expected to be run only manually. +- `py` - unitests +- `lint` - linting, runts all linters (likely pre-commit) +- `docs` - anything related to building docs (aka Sphinx) +- `packaging` - tests related to python packaging +- `deps` - Bumping of test dependencies. This should not be included in default `envlist`, expected to be run only manually. ## Dependency pinning diff --git a/docs/guides/vscode/release.md b/docs/guides/vscode/release.md index dd75ac3..bee29af 100644 --- a/docs/guides/vscode/release.md +++ b/docs/guides/vscode/release.md @@ -12,7 +12,7 @@ Assuming that the next version is `0.8.1`: 1. `pre-commit run -a` 1. `gh pr create --draft --label skip-changelog` 1. Open pull request on github wait for it to pass. Merge it. -1. Go github releases and release it! while being sure that you create a discussion thread for it. This will create a **tag*. +1. Go github releases and release it! while being sure that you create a discussion thread for it. This will create a \*_tag_. 1. Go to https://studio-jenkins-csb-codeready.apps.ocp-c1.prod.psi.redhat.com/job/ansible/job/vscode-ansible/ and login using IPA/kerberos password (that is **not** the pin+otp one) and requires you to be on corporate VPN. In case you forgot it, you can reset it using https://identity.corp.redhat.com/resetipa 1. trigger the effective publishing. Remember to check both publishing options as they are disabled by default. 1. Use the `Approve` button to approve the effective publishing. This can be found either in the live console last line or on the graphical pipeline view as a dialog. diff --git a/docs/stats/molecule-plugins.md b/docs/stats/molecule-plugins.md index 7780b8a..5bda3da 100644 --- a/docs/stats/molecule-plugins.md +++ b/docs/stats/molecule-plugins.md @@ -6,16 +6,15 @@ Unmaintained drivers archived between January 5th-8th, 2023: openstack, goss, li The relatively active drivers were moved to [molecule-plugins](https://github.com/ansible-community/molecule-plugins) repository, where we expected them to be maintained by the community. - ### Which drivers should we still see in addition to delegated? -* azure -* docker -* containers -* podman -* ec2 -* gce -* vagrant +- azure +- docker +- containers +- podman +- ec2 +- gce +- vagrant ### How did we measure the driver popularity? diff --git a/playbooks/sync.yml b/playbooks/sync.yml index 51ff20d..964b3fe 100644 --- a/playbooks/sync.yml +++ b/playbooks/sync.yml @@ -15,7 +15,7 @@ # ansible.builtin.include_vars: # file: ../config/devtools.yml # name: devtools - - name: Clone projects # noqa: latest[git] + - name: Clone projects # noqa: latest[git] loop: "{{ repos }}" loop_control: label: "{{ item.name }}"