From ceec1ebf1bf88dcc76e5a47370b960621f0d022e Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Thu, 1 Aug 2024 10:33:38 +0200 Subject: [PATCH] Add crate-ci/typos for typo correction There are lots of places in the code where typos might occur. Those even squeeze into the openapi and as such into the generated code. On the Rust side we already use `typos` to check that so we need to also invoke it when we generate openapi specs themselves. Change-Id: I9d27391492f9eb10a6b65d4c4589b12db2610813 --- playbooks/openapi/pre.yaml | 18 ++++++++++++++++++ playbooks/openapi/run.yaml | 3 +++ 2 files changed, 21 insertions(+) diff --git a/playbooks/openapi/pre.yaml b/playbooks/openapi/pre.yaml index 27fe812..7eac5ba 100644 --- a/playbooks/openapi/pre.yaml +++ b/playbooks/openapi/pre.yaml @@ -19,3 +19,21 @@ loop: "{{ install_additional_projects }}" loop_control: loop_var: zj_dep + + - name: Download crate-ci/typos + ansible.builtin.get_url: + url: "https://github.com/crate-ci/typos/releases/download/v1.23.6/typos-v1.23.6-x86_64-unknown-linux-musl.tar.gz" + dest: "/tmp/typos.tar.gz" + + - name: Create bin folder + ansible.builtin.file: + path: "{{ ansible_user_dir }}/bin" + state: "directory" + mode: "0755" + + - name: Unpack typos + ansible.builtin.unarchive: + src: "/tmp/typos.tar.gz" + dest: "{{ ansible_user_dir }}/bin" + creates: "{{ ansible_user_dir }}/bin/typos" + remote_src: true diff --git a/playbooks/openapi/run.yaml b/playbooks/openapi/run.yaml index 7aee78b..8ab4f5e 100644 --- a/playbooks/openapi/run.yaml +++ b/playbooks/openapi/run.yaml @@ -20,3 +20,6 @@ {%- if codegenerator_api_ref is defined and codegenerator_api_ref is mapping %} --api-ref-src {{ ansible_user_dir }}/{{ zuul.projects[codegenerator_api_ref.project].src_dir }}/{{ codegenerator_api_ref.path | default("/api-ref/build/html/index.html") }} {% endif %} + + - name: "Fix typos" + ansible.builtin.command: "{{ ansible_user_dir }}/bin/typos -vw {{ ansible_user_dir }}/{{ codegenerator_work_dir }}/openapi_specs"