-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[linter] Transform ConanFile
class to match actual one
#11162
Conversation
py-version=3.6 | ||
recursive=no | ||
suggestion-mode=yes | ||
unsafe-load-any-extension=no | ||
|
||
[MESSAGES CONTROL] | ||
disable=all | ||
disable=fixme, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My plan is to disable everything needed for all the recipes to work... then, following PRs can try to enable one by one.
dict_class = astroid.builtin_lookup("dict") | ||
info_class = astroid.MANAGER.ast_from_module_name("conans.model.info").lookup( | ||
"ConanInfo") | ||
build_requires_class = astroid.MANAGER.ast_from_module_name( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build_requires_class = astroid.MANAGER.ast_from_module_name( | |
user_info_build_class = astroid.MANAGER.ast_from_module_name("conans.model.user_info").lookup( | |
"DepsUserInfo") | |
build_requires_class = astroid.MANAGER.ast_from_module_name( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why, but using this approach, it fails for odbc
recipe. The error is weird and I didn't manage to find a fix on the internet. With the string_build
approach, on the other hand, it works. I'm not very happy about how it is looking like, tbh.
linter/conanfile_transform.py
Outdated
"build_requires": build_requires_class, | ||
"tool_requires": build_requires_class, | ||
"info_build": info_class, | ||
"user_info_build": info_class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"user_info_build": info_class, | |
"user_info_build": user_info_build_class, |
The focus (after merging this) should be to help in the migration process to Conan v2. We want to introduce and show in the PR-files errors like: "use Convention, refactor, information,... checks might appear in the output of the GH action, but they shouldn't be picked in the problem matcher, they might add too many messages (~noise) and we are not really interested in them (at least while we push the migration to v2). About time, the global test is only triggered when the linter files are modified, not for PRs that modify recipes, so it is not an issue at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great !
All recipes are now working (recipe linter) 🎉 There are some failures for the YAML linter, but they are easy to fix by contributors (and they are not related to this PR 😄 ) Please, @danimtb , @uilianries , review too. And we can consider merging this. |
… one * [linter] Add member validation * linter - transform ConanFile to match actual class * install matching conan version * add more dynamics * no settings * these are failing * mock settings * user_info_build * add fatals to matcher (conan-io#11) * increase threshold * touch Co-authored-by: ericLemanissier <ericLemanissier@users.noreply.github.com>
Conan adds some members and functions dynamically to the
ConanFile
class.