Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

bug(yaml): .cz.yaml failed on yamllint #618

Closed
@ThomasSanson

Description

@ThomasSanson

Description

Hello,

When we use linters on our projects (Ansible projects), so with yammlint and ansible-lint, there is an error concerning the indentation of the .cz.yaml file

Instead of being for example :

commitizen:
  name: cz_jira
  version: 1.0.0
  version_files:
  - commitizen/__version__.py
  - pyproject.toml

It should be :

---
commitizen:
  name: cz_jira
  version: 1.0.0
  version_files:
    - commitizen/__version__.py
    - pyproject.toml

https://github.com/commitizen-tools/commitizen/blob/master/tests/test_cz_customize.py#L105

With each bump, the file is "badly" indented again for the linters

Sincerely,

Steps to reproduce

  1. install yamllint (pip install yamllint)
(venv) xxx@xxxx:~/workspace/tmp/commitizen$ yamllint --version
yamllint 1.28.0
  1. Create .yamllint file with this content :
---
# Based on ansible-lint config
extends: default
  1. Create .cz.yaml file with this content :
commitizen:
  name: cz_jira
  version: 1.0.0
  version_files:
  - commitizen/__version__.py
  - pyproject.toml
  1. Run yamllint
(venv) xxx@xxxx:~/workspace/tmp/commitizen$ yamllint .
./.cz.yaml
  1:1       warning  missing document start "---"  (document-start)
  5:3       error    wrong indentation: expected 4 but found 2  (indentation)
  6:19      error    no new line character at the end of file  (new-line-at-end-of-file)
  1. Fix it with .cz.yaml
---
commitizen:
  name: cz_jira
  version: 1.0.0
  version_files:
    - commitizen/__version__.py
    - pyproject.toml

Current behavior

It does not respect the yaml linters

Desired behavior

Include yamllint in ci to always have a generated .cz.yaml or cz.yaml file compatible with linters

Screenshots

No response

Environment

(venv) xxx@xxxx:~/workspace/tmp/commitizen$ python --version
Python 3.8.12
(venv) xxx@xxxx:~/workspace/tmp/commitizen$ python3 -c "import platform; print(platform.system())"
Linux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions