mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-11 16:58:10 +00:00
(#13274) linters: Add annotations for YAML lint + add schema verification for config.yml
and conandata.yml
* first attempt at a yaml linter wit github actions output * This is less strict but has more information * fixup message * run config linter in Action * better ux feedback * try to use newlines https://github.com/actions/toolkit/issues/193#issuecomment-605394935 * clean up * fixup file name * trying custom class for quoted str * underlying yaml parser does not keep quotes * trying to catch ints as problems * remove test code * and to "linter testing" * install deps * run new linter unconditionally * revert testing changes * new script for conandata (this one is much harder to spec) * debugging * lets see all the errors * yamale -s ../linter/config_yaml_schema.yml aaf/config.yml from linters folder as a test * adjust script to match meeting discussion * make sure the docs and linters match * fix link * Update conandata.yml * exit 1 is not needed with annotations * add annotation matchers for yaml since those do do much * fix search for type * fix whitespace * tryout a yamllint file with a better looking matcher * copy syntax from readme * test if it's running in the wrong dir 🤔 * try with debug output * bump since i dont have permissions * bump - dont glob star * bump * less star globs * also add action to conandata way * bump * drop action for cli + matcher * more docs around linters * fix file and name * cleanup
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
# ConanCenterIndex Linters
|
||||
|
||||
Some linter configuration files are available in the folder [linter](../linter), which are executed by Github Actions to improve recipe quality.
|
||||
They consume python scripts which are executed to fit CCI rules. Those scripts use [astroid](https://github.com/PyCQA/astroid) and
|
||||
[pylint](https://pylint.pycqa.org/en/latest/) classes to parse Conan recipe files and manage their warnings and errors.
|
||||
Some linter configuration files are available in the folder [linter](../linter), which are executed by Github Actions
|
||||
and are displayed during [code review](https://github.com/features/code-review) as annotations, to improve recipe quality.
|
||||
They consume python scripts which are executed to fit CCI rules. Those scripts use [astroid](https://github.com/PyCQA/astroid)
|
||||
and [pylint](https://pylint.pycqa.org/en/latest/) classes to parse Conan recipe files and manage their warnings and errors.
|
||||
|
||||
Pylint by itself is not able to find ConanCenterIndex rules, so astroid is used to iterate over conanfiles content and
|
||||
validate CCI conditions. Also, pylint uses [rcfile](https://pylint.pycqa.org/en/latest/user_guide/configuration/index.html)
|
||||
(a configuration file based on [toml](https://toml.io/en/) format) to configure plugins, warnings and errors which should be enabled or disabled.
|
||||
|
||||
Also, the Github [code review](https://github.com/features/code-review) is integrated with the pylint output,
|
||||
parsed by [recipe_linter.json](../linter/recipe_linter.json), then presented to all users on the tab `Files changed`.
|
||||
Pylint by itself is not able to find ConanCenterIndex rules, so astroid is used to iterate over a conanfile's content and
|
||||
validate CCI requirements. Pylint uses an [rcfile](https://pylint.pycqa.org/en/latest/user_guide/configuration/index.html)
|
||||
to configure plugins, warnings and errors which should be enabled or disabled.
|
||||
|
||||
<!-- toc -->
|
||||
## Contents
|
||||
@@ -26,9 +24,17 @@ parsed by [recipe_linter.json](../linter/recipe_linter.json), then presented to
|
||||
* [E9010 - conan-import-error-conaninvalidconfiguration: conans.errors is deprecated and conan.errors should be used instead](#e9010---conan-import-error-conaninvalidconfiguration-conanserrors-is-deprecated-and-conanerrors-should-be-used-instead)
|
||||
* [E9011 - conan-import-tools: Importing conan.tools or conan.tools.xxx.zzz.yyy should be considered as private](#e9011---conan-import-tools-importing-conantools-or-conantoolsxxxzzzyyy-should-be-considered-as-private)<!-- endToc -->
|
||||
|
||||
## Running the linter locally
|
||||
## Understanding the different linters
|
||||
|
||||
Check the [Developing Recipes](developing_recipes_locally.md#running-the-python-linters) page for details.
|
||||
There's a three classes of linters currently in place for ConanCenterIndex
|
||||
|
||||
- ConanCenter Hook - these are responsible for validating the structure of the recipes and packages.
|
||||
- Pylint Linter - these are used to ensure the code quality and conventions of a recipes (i.e `conanfile.py`)
|
||||
- Yaml Checks - stylistic guidance and schema validation check for support files and best practices
|
||||
|
||||
## Running the linters locally
|
||||
|
||||
Check the [Developing Recipes](developing_recipes_locally.md) for more information on each of the three linters.
|
||||
|
||||
## Pylint configuration files
|
||||
|
||||
|
Reference in New Issue
Block a user