question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide pylint plugin to avoid warnings in IDE when working with conanfile.py

See original GitHub issue

Problem

When editing conanfile.py with editor which has linter support (VS Code with Python extension in my case) there are a bunch of errors related to dynamic fields (like self.copy is not callable or Instance of ConanFile doesn't have package_folder member).

Proposal

Conan has a built-in linting support for conanfile.py, but it deals with dynamic fields by post-processing json output.

It would be useful if this logic is moved to a pylint plugin which can be reused by editor/IDE or via command line options.

There are few tutorials on the Internet about how to do it.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ytimenkovcommented, Jul 3, 2018

@mmatrosov It works better if you install conan via pip. If you have standalone installer which provides python modules (not sure if the official one does, pyinstaller explicitly hides modules so they can’t be imported) you can add it to sys.path. For example my .pylintrc looks like:

[MASTER]
init-hook='import sys; sys.path.extend(["/home/user/conan-install"])'

load-plugins=conans.client.conanfile_plugin

[MESSAGES CONTROL]
disable=C,R

(the plugin is in PR yet)

0reactions
memshardedcommented, Jul 13, 2018

Hi all!

Many thanks to @ytimenkov for implementing it! It will be released in next 1.6, keep tuned for testing it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linting conanfile.py — conan 1.8.4 documentation
The conan create command verifies the recipe file using pylint. However, if you have an IDE that supports Python and may do linting...
Read more >
How do I disable a Pylint warning? - python - Stack Overflow
pylint --generate-rcfile shows it like this: [MESSAGES CONTROL] # Enable the message, report, category or checker with the given id(s).
Read more >
Frequently Asked Questions — Pylint 1.5.4 documentation
3.1 Can I give pylint a file as an argument instead of a module?¶ ... “pylint mymodule.py” should always work since the current...
Read more >
conan Changelog - pyup.io
Bugfix: Fix crash in pylint plugin with pylint >= 2.14.0. ... Feature: Adding ``root`` to layout model to allow conanfile.py in subfolders.
Read more >
Messages control - Pylint 2.16.0-dev documentation
W various warnings. E errors, for probable bugs in the code. F fatal, if an error occurred which prevented pylint from doing further...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found