Skip to content

[linter] Add rule about importing tools from conan module#12765

Merged
conan-center-bot merged 2 commits into
conan-io:masterfrom
jgsogo:linter/tools-imports
Sep 1, 2022
Merged

[linter] Add rule about importing tools from conan module#12765
conan-center-bot merged 2 commits into
conan-io:masterfrom
jgsogo:linter/tools-imports

Conversation

@jgsogo
Copy link
Copy Markdown
Contributor

@jgsogo jgsogo commented Sep 1, 2022

Enforcing documented ways to import tools: https://docs.conan.io/en/latest/reference/conanfile/tools.html. Everything else is considered not-stable.

from conan.tools.xxx import yyy
from conan.tools import xxx

Only 44 recipes are affected, not bad:

Import tools following pattern 'from conan.tools.xxxx import yyyyy' (https://docs.conan.io/en/latest/reference/conanfile/tools.html).: 44

Copy link
Copy Markdown
Member

@danimtb danimtb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Copy link
Copy Markdown
Member

@uilianries uilianries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@conan-center-bot conan-center-bot merged commit 04b9350 into conan-io:master Sep 1, 2022
@jgsogo jgsogo deleted the linter/tools-imports branch September 1, 2022 14:51
@jgsogo
Copy link
Copy Markdown
Contributor Author

jgsogo commented Sep 2, 2022

Please, @AndreyMlashkin, have a look at this rule. It needs to be implemented in your script, or the linter will complain. Thanks.

@AndreyMlashkin
Copy link
Copy Markdown
Contributor

My script is based on simple find and replace patterns and here some more complex logic is needed, so, I don't think it is possible to automate migration, that fulfil this rule...

@uilianries
Copy link
Copy Markdown
Member

@AndreyMlashkin, please, provide a separated project in Github for your script if possible, it will help to receive new PRs, and post its link when opening a new PR on the description. I could check during the weekend, there is no big deal replacing words.

ericLemanissier pushed a commit to ericLemanissier/cocorepo that referenced this pull request Sep 26, 2022
…odule

* [linter] Add rule about importing tools from conan module

* allow from conan.tools import xxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants