meilisearch-wordpress icon indicating copy to clipboard operation
meilisearch-wordpress copied to clipboard

Add yaml linting check in CI

Open meili-bot opened this issue 1 year ago • 0 comments

This PR is auto-generated.

To avoid mistakes in the yaml files, for example, duplicated keys or wrong indentation, we decided to add a lint check on yaml files.

Additional to the .yamllint files added in this pr, the following must be added as well:

  • Linting check in CI: Example in `tests.yml create a new job:
    yaml-lint:
      name: Yaml linting check
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v3
        - name: Yaml lint check
          uses: ibiqlik/action-yamllint@v3
          with:
            config_file: .yamllint.yml
    
  • Inside .yamllint, you might want to ignore some folders. For example node_modules in JS repos Example in .yamllint:
    ignore: |
      node_modules
    

Since yamllint is a python package, we cannot add a local check unless you download .yamllint. In which case, you can check if the yaml files are correctly linted by running the following command: yamllint .

Additionally, you can use the VSCode extension YAML by redhat which automatically highlights errors.

To help users be aware of this, we recommend adding this to your contributing guide:

To check if your `yaml` files are correctly formatted, you need to [install yamllint](https://yamllint.readthedocs.io/en/stable/quickstart.html#installing-yamllint) and then run `yamllint .`

TODO

  • [ ] Add the directories or files to ignore in .yamllint
  • [ ] Add information in the contributing guide on this new check.

meili-bot avatar Jun 14 '23 14:06 meili-bot