(#12298) [linter] Fix linter v2 running on test_v1_package conanfiles

* [linter] Fix linter v2 running on test_v1_package conanfiles

* Update .github/workflows/linter-conan-v2.yml

* Update .github/workflows/linter-conan-v2.yml

* remove skip for testing

* remove other skip to make it fail

* it works!

* update docs
This commit is contained in:
Daniel
2022-08-18 17:46:54 +02:00
committed by GitHub
parent f25ad3ec64
commit 65a5def0c4
2 changed files with 6 additions and 10 deletions

View File

@@ -48,7 +48,7 @@ jobs:
id: linter_test_package
if: steps.changed_files.outputs.any_changed == 'true'
run: |
pylint --rcfile=linter/pylintrc_testpackage recipes/*/*/test_*/conanfile.py --output-format=json --output=test_package.json --score=y --fail-under=${{ env.SCORE_THRESHOLD }}
pylint --rcfile=linter/pylintrc_testpackage recipes/*/*/test_*/conanfile.py --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py" --output-format=json --output=test_package.json --score=y --fail-under=${{ env.SCORE_THRESHOLD }}
- name: Archive production artifacts
if: steps.changed_files.outputs.any_changed == 'true' && always()
@@ -145,6 +145,5 @@ jobs:
run: |
echo "::add-matcher::linter/recipe_linter.json"
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
pylint --rcfile=linter/pylintrc_testpackage --output-format=parseable ${file}
pylint --rcfile=linter/pylintrc_testpackage --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py" --output-format=parseable ${file}
done

View File

@@ -48,15 +48,12 @@ Here is a list of different imports and their new equivalent (note that the inte
| conans.errors.ConanException | [conan.errors.ConanException](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#migrating-the-recipes) |
# Disable linter for `test_v1_*/conanfile.py`
# Disable linter for a specific conanfile
Using the pattern `test_v1_*/conanfile.py` you can write a test that will be executed using only Conan v1,
you probably don't want v2-migration linter to check this file, as it will likely contain syntax that is
specific to Conan v1.
If for some reason a conanfile of a recipe or a test_package is not yet prepared to pass
all the checks of the linter, it can be skipped from `pylint` adding the following comment to the file:
To skip the file you just need to add the following comment to the file and `pylint` will skip it:
**`test_v1_*/conanfile.py`**
**`conanfile.py`**
```python
# pylint: skip-file
from conans import ConanFile, CMake, tools