canonical / hotsos

Software analysis toolkit. Define checks in high-level language and leverage library to perform analysis of common Cloud applications.
Apache License 2.0
30 stars 37 forks source link

Add `yamllint` to the project #833

Closed mustafakemalgilor closed 3 months ago

mustafakemalgilor commented 3 months ago

since the project is using many YAML files, it would be beneficial to use a linter both in tox testing and CI. This patch adds yamllint 1.35.1 to the project as a test dependency. this patch also adds a new tox target named yamllint which runs yamllint at the which runs yamllint at the hotsos/ and tests/ directories.

the yamllint currently uses the yamllintrc file supplied in this patch. this configuration inherits from the default configuration of the yamllint, and excludes only one path, i.e.: fake_data_root, because it contains test data captured from some environment and should be kept as-is. For further reference regarding available options, please see the docs.

summary of changes made to yaml files:

PS: please don't be scared of the gargantuan list of YAML file changes, these are all just cosmetic changes to make the linter happy.

mustafakemalgilor commented 3 months ago

Removing the CI step for now, because it completely removes all tasks from the "tests.yaml" file since the file has been changed. This raises another question: "Should we separate ".yaml" files so newly added CI steps do not interfere with the execution of the existing ones?"

mustafakemalgilor commented 3 months ago

I missed reverting expr changes on these:

  • src_migration.yaml
  • lp1948906.yaml
  • lp1996230.yaml
  • lp2029857.yaml

And there are some unintended changes to tests/unit/fake_data_root which are remnants of before "ignore" path.

Fixed.