yamllint icon indicating copy to clipboard operation
yamllint copied to clipboard

Configuring yamlint from setup.cfg

Open ashleve opened this issue 3 years ago • 4 comments

Hi, is it possibile to configure all the flags from https://yamllint.readthedocs.io/en/stable/configuration.html with setup.cfg?

ashleve avatar May 20 '21 13:05 ashleve

Hi, I don't understand your question.

adrienverge avatar May 20 '21 17:05 adrienverge

@adrienverge

I think this might be similar to issue I was about to raise, which is support yamllint configuration from TOML files.

For example, when using formatter black, you can provide configuration for black as shown here:- https://github.com/psf/black/blob/main/pyproject.toml#L8

here tool black only uses configuration in section [tool.black]

saurabheights avatar Jun 25 '21 01:06 saurabheights

Hi, sorry for not responding earlier,

@saurabheights yes, same as with toml files, many linters have option to be configured from setup.cfg, for example isort or flake8:

[isort]
line_length = 99
profile = black

[flake8]
max_line_length = 99
ignore =
    F401 
    W504 

It's nice when you don't need a separate dot file config for every tool that you're using

ashleve avatar Jun 25 '21 09:06 ashleve

Hello,

If I undestand correctly, you would like yamllint to read its configuration from a file setup.cfg in current directory, if present?

This seems very Python-specific. Although yamllint is written in Python, it is a tool used in many repos with many languages. If we read configuration from setup.cfg, then it would be fair to also support package.json, config.toml, application.rb, pyproject.toml, etc.

Moreover, yamllint configuration is written in YAML and can be quite complex, it has a nested hierarchy of various options and keywords. I don't see how it can be easily written in setup.cfg.

adrienverge avatar Jun 28 '21 14:06 adrienverge