Commit Graph

95 Commits (master)

Author SHA1 Message Date
Georgi Georgiev e636848ddc
config: Look for configuration file in parent directories
Inspired be ESLint's search, it looks for configuration files in all
parent directories up until it reaches the user's home or root.

closes #571
2 years ago
Adrien Vergé 15eafeb80a build: Migrate from setup.py to pyproject.toml
Using `setup.py` is deprecated and the new recommanded way is to declare
a `pyproject.toml` file (see PEP 517 [^1]).

This commit proposes to use setuptools to achieve that, because
setuptools is already used by yamllint, is standard and referenced by
the official Python packaging documentation [^2], and seems to be the
most lightweight solution. An alternative could have been to use Poetry,
see the dedicated pull request and discussion [^3].

For some period, the `setup.py` file will be kept (although almost
empty), to allow old tools versions to keep working.

Closes https://github.com/adrienverge/yamllint/issues/509.

[^1]: https://peps.python.org/pep-0517/
[^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/
[^3]: https://github.com/adrienverge/yamllint/pull/557
2 years ago
Adrien Vergé 16eae28a50 build: Stop using setup.py to generate documentation
Because `setup.py` is deprecated, let's switch from:

    python setup.py build_sphinx

to:

    make -C docs html

to build Sphinx documentation.

The generated HTML files in `docs/_build/html` are exactly the same (I
compared with `diff -qr`).

Also add `-W` (turn warnings into errors) to the `sphinx-build` options
to keep the previous behavior.
2 years ago
Andrew Imeson 6bfd6756e2 docs: Update links that redirect 2 years ago
Adrien Vergé ebd6b90d3e anchors: Add new rule to detect undeclared or duplicated anchors
According to the YAML specification [^1]:

- > It is an error for an alias node to use an anchor that does not
  > previously occur in the document.

  The `forbid-undeclared-aliases` option checks that aliases do have a
  matching anchor declared previously in the document. Since this is
  required by the YAML spec, this option is enabled by default.

- > The alias refers to the most recent preceding node having the same
  > anchor.

  This means that having a same anchor repeated in a document is
  allowed. However users could want to avoid this, so the new option
  `forbid-duplicated-anchors` allows that. It's disabled by default.

- > It is not an error to specify an anchor that is not used by any
  > alias node.

  This means that it's OK to declare anchors but don't have any alias
  referencing them. However users could want to avoid this, so a new
  option (e.g. `forbid-unused-anchors`) could be implemented in the
  future. See https://github.com/adrienverge/yamllint/pull/537.

Fixes #395
Closes #420

[^1]: https://yaml.org/spec/1.2.2/#71-alias-nodes
2 years ago
Andrew Imeson 8aaa226830
docs: Update pre-commit hook example
Update syntax of pre-commit hook docs to work with newer pre-commit versions.

Closes #551, #553
2 years ago
Andrew Imeson 404656394c docs: Explicitly specify language even when it's plain text
rstcheck succeeds with a failure (heh) when there's a code block without
a language specified. This can lead to false negatives as the file is no
longer being checked by rstcheck.

Error:

    An `AttributeError` error occured. This is most propably due to a
    code block directive (code/code-block/sourcecode) without a
    specified language. This may result in a false negative for source:
    'docs/disable_with_comments.rst'. See
    https://rstcheck-core.readthedocs.io/en/latest/faq/#code-blocks-without-language-sphinx
    for more information.  Success! No issues detected.
2 years ago
Okue 06db2af9b0
docs: Fix misleading Python API example
`yamllint.linter.run("example.yaml", yaml_config)` example seems
`yamllint.linter.run` opens a given file.
It's misleading.
2 years ago
Peter Leitzen fa0bb03f9a
cli: Add --list-files command line option
This option lists the files to lint by yamllint, taking into account `ignore`
and `yaml-files` configuration options.
2 years ago
Matthew Gamble 2a904f8fc1
configuration: Allow using a list of strings in ignore configuration
This may feel more natural for some users, rather than embedding
multiple entries in a multi-line string.
2 years ago
Ville Skyttä 6194a282fc
docs: Spelling and grammar fixes 2 years ago
Dimitri Papadopoulos 5b21a3d9ea Remove Unicode marker before strings
All strings are Unicode in Python 3. No need for u'€', just use '€'.
2 years ago
Dimitri Papadopoulos 5fbf44c203 docs: Fix typos 2 years ago
Adrien Vergé eb7b7ca627 docs: Fix Sphinx error on non-YAML code snippet
This problem was just introduced by commit cec4f33 "Clarify disable-line
and parser errors, workaround" and produced this error when building
documentation:

    docs/disable_with_comments.rst:120:Could not lex literal_block as
    "yaml". Highlighting skipped.
2 years ago
Andrew Imeson cec4f3383a cocs: Clarify disable-line and parser errors, workaround
Lots of user confusion expecting `disable-line` to work around parser
errors caused by templating syntax.

Relates to #61, #65, #128, #311, #460, #462
2 years ago
Andrew Imeson 52234b7a46 docs: remove erroneous example text in disable-file 2 years ago
andrewnaguib 2f8ad7003a config: Implement for `ignore-from-file` option
Closes https://github.com/adrienverge/yamllint/issues/360
Co-authored-by: Adrien Vergé <@adrienverge>
2 years ago
Andrew Imeson 94c1c2bcf2 docs: Update ALE vim plugin link 2 years ago
Andrew Imeson 0130e15c8c docs: Simplify GitHub Actions example 2 years ago
Dimitri Papadopoulos Orfanos 3346843edc
docs: Better compress PNG image 2 years ago
Derek Brown 8ac7d58693 float-values: Add a new rule to check floating-point numbers 3 years ago
Andrew Imeson 34a4f76e8b docs: Remove repeated word 'copyright'
Fixes #476 - credit to @chrillep and @adrienverge
3 years ago
Christian Widlund 695fc5f1f1 docs: Add plugin section for Visual Studio Code 3 years ago
Christian Widlund 632665c3e6 docs: Add plugin section for IntelliJ 3 years ago
Adrien Vergé 89b75b7c05 refactor: Remove UTF-8 headers in Python files
The `# -*- coding: utf-8 -*-` headers were useful for Python 2, and
aren't needed for Python 3 where UTF-8 is the default.

yamllint support of Python 2 was dropped in early 2021, see commit
a3fc64d "End support for Python 2".

Let's drop these headers.
3 years ago
Andrew Imeson 2f423117c1
docs: Attempt to clarify configuration file location
Closes #96, Closes #212
3 years ago
Andrew Imeson 8a320aaf2c Make man page show up in apropos
Set the 'description' attribute so that Sphinx builds the manpage with
the 'NAME' section. This is necessary for `apropos` to be able to find
yamllint

Fixes part of #76
3 years ago
Andrew Imeson c34c962691 Remove the repeated word "automatically" in GHA doc 3 years ago
Madison Swain-Bowden 4f1bbc33dc
docs: Fix link syntax on integration.rst 3 years ago
Rex Ledesma 0f9dffde23
docs: Add configuration for integration with Arcanist 4 years ago
Andrew Imeson 67cb4eb24d Auto-change output format if GitHub Actions detected 4 years ago
Adrien Vergé 597e88bb7b docs: Make 'yaml-file' config documentation clearer
Related to https://github.com/adrienverge/yamllint/issues/311.
4 years ago
Sorin Sbarnea d274543b72
docs: Add Python API usage example
Fixes: #297
4 years ago
Wolfgang Walther b5b436a3a4
Add global "locale" config option and make key-ordering rule locale-aware
Support sorting by locale with strcoll(). Properly handle case and accents.

Note: this is a second implementation, for context see:
https://github.com/adrienverge/yamllint/pull/280
https://github.com/adrienverge/yamllint/issues/285
https://github.com/adrienverge/yamllint/pull/288
5 years ago
Adrien Vergé 9403f1f3ec Revert "Add global "locale" config option"
This reverts commit 9e90c77, because it caused a bug that affected
different people just after being released:
https://github.com/adrienverge/yamllint/issues/285
https://github.com/adrienverge/yamllint/issues/286
5 years ago
Wolfgang Walther 9e90c777cb
Add global "locale" config option and make key-ordering rule locale-aware
Support sorting by locale with strcoll(). Properly handle case and accents.
5 years ago
Adrien Vergé 954fdd5e8f style: Fix 'noqa' for flake8 3.8.0
There was a change in behavior of E402, see:
https://gitlab.com/pycqa/flake8/-/issues/638#note_345108633
5 years ago
Will Badart 278a79f093 Mention YAMLLINT_CONFIG_FILE in the documentation 5 years ago
ffapitalle 8fa9eb3ced Add --no-warnings option to suppress warning messages
Use `--no-warnings` option to hide warning messages. It only shows
problems marked as errors.
5 years ago
Joel Baranick fb400dc64b Allow disabling all checks for a file
Allow disabling of a file, even if it is invalid YAML (syntax error) by
including `# yamllint disable-file` in the first line.
5 years ago
Hossein Zolfi 579a975b70 docs: Fix pre-commit config file
* pre-commit show warning for unsupported key (sha)
* Demonstrate how to use custom yamllint
5 years ago
Imran Iqbal f3d9196aa0 docs(configuration): improve `yaml-files` code example
* A straight copy/paste of the existing example into the `.yamllint` file results in a `yamllint` error!
5 years ago
Ibrahim AshShohail 881d301883 feat: Support reading config from .yamllint.yml and .yamllint.yaml
Signed-off-by: Ibrahim AshShohail <me@ibrasho.com>
5 years ago
Adrien Vergé b62b424dd4 feat: Lint .yamllint by default 5 years ago
grzesuav 063c854658 feat: Make YAML file extensions configurable 6 years ago
Remi Pointel cb5fe2c050 add OpenBSD installation instructions. 6 years ago
Adrien Vergé 930c8eea94 docs: Simplify installation instruction in the README 6 years ago
Adrien Vergé f66661e36d docs(cli): Add a paragraph about standard input
See commit 05dfcbc "cli: Add command line option - to read from standard
input", cc @miguelbarao.
6 years ago
Adrien Vergé d6b89e94e4 chore(docs): Fix conf.py styling 6 years ago
Adrien Vergé a56a1015f0 style(docs): Fix RST lint errors reported by doc8 6 years ago