mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-13 18:27:10 +00:00

* linter - check ConanFile import and cross_building * remove unused code * Add docs * improve docs * example - abseil * md syntax * revert uneeded changes * Update docs/v2_linter.md Co-authored-by: Daniel <danimanzaneque@gmail.com> Co-authored-by: Daniel <danimanzaneque@gmail.com>
29 lines
922 B
Python
29 lines
922 B
Python
|
|
from pylint.checkers import BaseChecker
|
|
from pylint.interfaces import IAstroidChecker
|
|
from astroid import nodes, Const, AssignName
|
|
|
|
|
|
class ImportConanFile(BaseChecker):
|
|
"""
|
|
Import ConanFile from new 'conan' module
|
|
"""
|
|
|
|
__implements__ = IAstroidChecker
|
|
|
|
name = "conan-import-conanfile"
|
|
msgs = {
|
|
"W9006": (
|
|
"Import ConanFile from new module: `from conan import ConanFile`. Old import is deprecated in Conan v2.",
|
|
"conan-import-conanfile",
|
|
"Import ConanFile from new module: `from conan import ConanFile`. Old import is deprecated in Conan v2.",
|
|
),
|
|
}
|
|
|
|
def visit_importfrom(self, node: nodes.ImportFrom) -> None:
|
|
basename = node.modname
|
|
if basename == 'conans':
|
|
names = [name for name, _ in node.names]
|
|
if 'ConanFile' in names:
|
|
self.add_message("conan-import-conanfile", node=node)
|