OCA / pylint-odoo

Odoo plugin for Pylint
http://www.pylint.org
143 stars 168 forks source link

False positive error #242

Closed shepilov-vladislav closed 5 years ago

shepilov-vladislav commented 5 years ago
Missing external dependency "odoo" from manifest. More info: https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#external-dependencies
Missing external dependency "odoo.addons...." from manifest. More info: https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#external-dependencies
pedrobaeza commented 5 years ago

We haven't faced these errors ever. If you don't put in context...

moylop260 commented 5 years ago

What is your python version, pylint, astroid and pylint-odoo? Could you share the minimal code to reproduce it, please?

blaggacao commented 5 years ago

odoo is not in the environment. pylint_odoo runs as a pre-commit hook which does not have access to a full odoo environment.

blaggacao commented 5 years ago

you can reproduce by using this: https://github.com/xoe-labs/dockery-odoo-scaffold Steps (eg. in /tmp): https://xoe-labs.github.io/dockery-odoo/

While it's not minimal, it's the environment to reproduce unless you have odoo installed on your host machine.

EDIT: We had to disable several false positive: https://github.com/xoe-labs/dockery-odoo-scaffold/blob/master/.pylintrc#L56-L64 but the idea is not to turn off everything... :stuck_out_tongue_winking_eye:

blaggacao commented 5 years ago

@shepilov-vladislav specifically see also: https://github.com/xoe-labs/dockery-odoo-scaffold/blame/0c634238cc0675c166d76ffff06fde4b13efbc62/.pylintrc#L57

moylop260 commented 5 years ago

@blaggacao You are confusing “missing external dependency from manifest” vs “Import Error” are very different. The first one for pylint-odoo and the second one is a core check from pylint itself.

Then we won’t fix here And we don’t have enough information to reproduce the first one

blaggacao commented 5 years ago

@moylop260 sed '/You are confusing “missing external dependency from manifest” vs “Import Error” are very different. The first one for pylint-odoo and the second one is a core check from pylint itself./Why do you think they convolut?/' Would be just a way more productive way to further the discussion...

But maybe you can explain why do you think this is closeable?

blaggacao commented 5 years ago

@moylop260

Why do you think they convolut?

I think they convolute, because I can imagine that odoo not being in the environment, both checks give false positive resulting in complaining. If I'm right, that would be how they are "not so different".

Based on this maybe you (or @pedrobaeza) can enlighten us if there is a way to trick pylint and pylint_odoo into taking on a different environment in a git-commit hook.

Ultimately it's probably a wont-fix, but just maybe you have an idea how we can deal with this... :wink:

moylop260 commented 4 years ago

Could you check if the following comment fixes this one too, please?

Regards!

blaggacao commented 4 years ago

For what it's worth, nix-shell is one very promising option to generate a predictable environment for this sort of tooling.