Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
(conan-io#25329) Remove Linter v2 migration
Browse files Browse the repository at this point in the history
Signed-off-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
uilianries authored Sep 20, 2024
1 parent 61274b9 commit 5c32f2a
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 521 deletions.
124 changes: 0 additions & 124 deletions .github/workflows/linter-conan-v2.yml

This file was deleted.

82 changes: 1 addition & 81 deletions docs/linters.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ to configure plugins, warnings and errors which should be enabled or disabled.
* [Understanding the different linters](#understanding-the-different-linters)
* [Running the linters locally](#running-the-linters-locally)
* [Pylint configuration files](#pylint-configuration-files)
* [Linter Warning and Errors](#linter-warning-and-errors)
* [E9005 - conan-missing-name: Every conan recipe must contain the attribute name](#e9005---conan-missing-name-every-conan-recipe-must-contain-the-attribute-name)
* [E9007 - conan-test-no-name: Do not add name attribute in test package recipes](#e9007---conan-test-no-name-do-not-add-name-attribute-in-test-package-recipes)
* [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)
* [E9012 - conan-attr-version: Recipe should not contain version attribute](#e9012---conan-attr-version-recipe-should-not-contain-version-attribute)<!-- endToc -->
<!-- endToc -->

## Understanding the different linters

Expand All @@ -37,79 +33,3 @@ Check the [Developing Recipes](developing_recipes_locally.md) for more informati

- [Pylint Recipe](../linter/pylintrc_recipe): This `rcfile` lists plugins and rules to be executed over all recipes (not test package) and validate them.
- [Pylint Test Package Recipe](../linter/pylintrc_testpackage): This `rcfile` lists plugins and rules to be executed over all recipes in test package folders only:

## Linter Warning and Errors

Here is the list of current warning and errors provided by pylint, when using CCI configuration.

### E9005 - conan-missing-name: Every conan recipe must contain the attribute name

The attribute `name` is always expected. On the other hand, `version` should not be listed.

```python
def BazConanfile(ConanFile):
name = "baz"
```

### E9007 - conan-test-no-name: Do not add name attribute in test package recipes

The test package is not a recipe, thus, it should not have a name

```python
def TestPackageConanFile(ConanFile):
name = "test_package" # Wrong!
```

### E9011 - conan-import-tools: Importing conan.tools or conan.tools.xxx.zzz.yyy should be considered as private

Documented on [conanfile.tools](https://docs.conan.io/1/reference/conanfile/tools.html):
It's not allowed to use `tools.xxx` directly:

```python
from conan import tools
...

tools.scm.Version(self.version)
```

Neither sub modules:

```python
from conan.tools.apple.apple import is_apple_os
```

Only modules under `conan.tools` and `conan.tools.xxx` are allowed:

```python
from conan.tools.files import rmdir
from conan.tools import scm
```

### E9012 - conan-attr-version: Recipe should not contain version attribute

All recipes on CCI should be generic enough to support as many versions as possible, so enforcing a specific
version as attribute will not allow to re-use the same recipe for multiple release versions.

```python
from conan import ConanFile

class FooConanFile(ConanFile):
version = "1.0.0" # Wrong!
```

The package version should be passed as command argument, e.g:

conan create all/ 1.0.0@ -pr:h=default -pr:b=default

Or, if you are running Conan 2.0:

conan create all/ --version=1.0.0 -pr:h=default -pr:b=default

The only exception is when providing ``system`` packages, which are allowed.

```python
from conan import ConanFile

class FooConanFile(ConanFile):
version = "system" # Okay!
```
147 changes: 0 additions & 147 deletions docs/v2_migration.md

This file was deleted.

30 changes: 0 additions & 30 deletions linter/check_import_tools.py

This file was deleted.

Loading

0 comments on commit 5c32f2a

Please sign in to comment.