Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

[REF] pylint.cfg: Enable missing-import-error, missing-manifest-dependency #354

Merged
merged 2 commits into from
Oct 11, 2016

Conversation

moylop260
Copy link
Contributor

@moylop260 moylop260 commented Sep 26, 2016

Enable new checks from: OCA/pylint-odoo#68
Version 1.3.3

@moylop260 moylop260 self-assigned this Sep 26, 2016
@moylop260
Copy link
Contributor Author

moylop260 commented Sep 26, 2016

@yajo @bealdav @alan196 your feedback is welcome

@alan196
Copy link

alan196 commented Sep 27, 2016

👍

@moylop260
Copy link
Contributor Author

ping

@jjscarafia
Copy link
Contributor

👍

@moylop260
Copy link
Contributor Author

@pedrobaeza
Could you merge it, please?

@pedrobaeza
Copy link
Member

This checks should be mandatory, not optional for PRs, as these are critical errors, so I think you should require them on 8.0/9.0 (and the upcoming 10.0).

@moylop260
Copy link
Contributor Author

Fixed

@moylop260 moylop260 force-pushed the master-oca-enable-import-deps-moy branch from 78b4989 to c9de2db Compare October 4, 2016 15:21
@yajo
Copy link
Member

yajo commented Oct 6, 2016

Conflicts found

@moylop260 moylop260 force-pushed the master-oca-enable-import-deps-moy branch 2 times, most recently from 5a69d3e to 2a25a38 Compare October 11, 2016 10:17
@moylop260
Copy link
Contributor Author

Sorry for delay...
Rebased

@pedrobaeza
Copy link
Member

Coverage is dropping a lot. Can you check it?

@moylop260
Copy link
Contributor Author

Coveralls is failing https://coveralls.io/builds/8278931/source?filename=travis%2Fself_tests again
Codecov is green.

@pedrobaeza
Copy link
Member

OK, I see, merging

@pedrobaeza pedrobaeza merged commit f2e7358 into OCA:master Oct 11, 2016
@moylop260 moylop260 deleted the master-oca-enable-import-deps-moy branch October 11, 2016 13:53
@yajo
Copy link
Member

yajo commented Oct 13, 2016

yajo added a commit to Tecnativa/reporting-engine that referenced this pull request Dec 19, 2016
Currently this dependency was not listed under `external_dependencies`, and violates OCA/maintainer-quality-tools#354, which leads to `ImportError` under some environments.

Since it adds no benefit over Python's core `json` implementation, I'm simply removing the dependency.
yajo added a commit to Tecnativa/account-financial-reporting that referenced this pull request Dec 19, 2016
yajo added a commit to Tecnativa/account-financial-reporting that referenced this pull request Dec 19, 2016
yajo added a commit to Tecnativa/website that referenced this pull request Dec 19, 2016
@lmignon
Copy link
Contributor

lmignon commented Jan 5, 2017

I hate this kind of new check! Why do I have to protect my import in connector-cmis? https://travis-ci.org/OCA/connector-cmis/jobs/189107369 This project has only one addon (9.0 and 10) and didn't work without the external dependency!!!!!! I am tired of these changes that break the tests by asking once again to adopt new rules decided by a minority.

@moylop260
Copy link
Contributor Author

@lmignon
I dont understand your real point.

Do you have a proposal to add a exception or change the guideline https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#importerror?

@moylop260
Copy link
Contributor Author

Or Do you have a proposal to change the workflow of approves for guidelines?

@lmignon
Copy link
Contributor

lmignon commented Jan 5, 2017

@moylop260 In the case of the connector-cmis it's a non sens to put the project in your addon path if you don't use it and if you use it you must have installed the external dependency. Therefore why do I have to protect the import in my source code.... The rule is not applicable to small repository build around an external library. MOREOVER IMO all changes in MQT rules should be approved by a vote of the OCA delagates!

lmignon added a commit to acsone/connector-cmis that referenced this pull request Jan 5, 2017
… is put in an addons path without the external lib installed

This error should never occur since if you put this project into your addon path you want to use it and without the lib it don't work. But Travis CI fails if these imports are not protected due to a stupid rule enforced in odoo-pylint (Oct, 11, 2016) OCA/maintainer-quality-tools#354
@pedrobaeza
Copy link
Member

I don't agree: you must always protect your external imports. It's a way to avoid an installation break if you have these modules in your addons path. In an ideal world, this shouldn't be needed, but it's not an ideal one. And think in other people that don't use pip, and Odoo's bug about static folder...

lmignon added a commit to acsone/connector-cmis that referenced this pull request Jan 5, 2017
… is put in an addons path without the external lib installed

This error should never occur since if you put this project into your addon path you want to use it and without the lib it don't work. But Travis CI fails if these imports are not protected due to a stupid rule enforced in odoo-pylint (Oct, 11, 2016) OCA/maintainer-quality-tools#354
@moylop260
Copy link
Contributor Author

moylop260 commented Jan 5, 2017

@lmignon If you have a good reason to skip this check just for that case you could use a # pylint: disable=CHECK-NAME and add the comment above.

If you think that is a global exception you could create a new PR for guidelines to change it. (And I change the lint).

EXTRA NOTE: Maybe the main problem is have a project with just a module. (I don't know).

MOREOVER IMO all changes in MQT rules should be approved by a vote of the OCA delagates!

Like this PR?

@lmignon
Copy link
Contributor

lmignon commented Jan 5, 2017

@pedrobaeza don't put connector-cmis in your addon path if you don't use it... This rule IS STUPID in the case of small project build around an external lib! That's the case of connector-cmis.

Maybe it's time I leave OCA...

@moylop260
Copy link
Contributor Author

@lmignon
I'm trying help you to detect your exception, please, be patient I am not so smart like you but I try help.

This rule IS STUPID in the case of small project build around an external lib!
I don't know how to detect a small project from the lint but ideas are welcome?

Do pylint disable comment looks fine for you for this cases?

@pedrobaeza
Copy link
Member

@lmignon if you think OCA doesn't benefit you, then just leave it, but I don't think it's the right idea. These conventions are built around a past knowledge of troubles that we try to avoid in the future. That's why a guard in the import, that are only 3 new lines, assures a correct functioning in all the environments. We have tried to correct this in the root (Odoo not loading python files when there is a static folder, but without no success). If we get it in the future, this convention/check just can go out, but for now it's not possible.

@lmignon
Copy link
Contributor

lmignon commented Jan 5, 2017

@moylop260 Indeed it's not possible or very difficult to automatically detect a small project build around an external lib. Is it possible to disable a rule at repository level so the PSC can decide to relax a specific rule according to the nature of the project?

@moylop260
Copy link
Contributor Author

relax a specific rule according to the nature of the project?

That is a good point.
Thanks for sharing.

I'll check it

@lmignon
Copy link
Contributor

lmignon commented Jan 5, 2017

@moylop260 Thank you for your listening.

@yajo
Copy link
Member

yajo commented Jan 5, 2017

Hi @lmignon.

Please review OCA/server-tools#89, OCA/openupgradelib#21, OCA/server-tools#232, OCA/geospatial#3, OCA/account-financial-reporting#229, OCA/l10n-spain#255, OCA/reporting-engine#64, and OCA/reporting-engine#62, just to name a few.

Specifically OCA/server-tools#666 recently broke all website builds. This means lots of headaches trying to find what in the world happened to those builds that were perfectly green yesterday, fixing it, opening PR, waiting for merge, rebasing every open website PR, and hoping all goes well and nobody else did a import without try-except that breaks a different addon and you have to start again. All of that should have never happened if the original developer acknowledged this simple linter error, such as any other you might fix.

Since the OCA is composed of a combination of many small teams that makes a big community, developing in a way that does not break others' deployments increases others' respect for you. The opposite is also true.

If we put the community effort in a balance, fixing this linter error is a matter of minutes at PR time, but a matter of hours when it is already merged. That's why there was this improvement to our tools, that should save hours at the cost of minutes. Community coding is this way, I hope you understand.

So, summarizing, just add that simple try-except and stop complaining, friend 😉

@lmignon
Copy link
Contributor

lmignon commented Jan 5, 2017

or stop contributing

@sbidoul
Copy link
Member

sbidoul commented Jan 5, 2017

Emotional reactions aside, I still believe that peppering all the OCA code with import guards is a ugly, unpythonic hack. That hurts the eyes (at least mine 😉), and makes diagnosing real import issues harder. And, fundamentally, it does not address the root cause of the import issues.

There are several ways to address those:

  • lobby Odoo SA to have a mechanism to not import uninstalled modules unless explicitly needed, eg [ADD] new manifest key no_autoload odoo/odoo#8591
  • install only required dependencies in CI: Update travis scripts to install with pip #343
  • install all dependencies mandated by a repo: if that becomes a burden, because there are heavy dependencies you don't need, it's probably a sign that said repo has become too big and must be split
  • ... and maybe other approaches that I did not think of

@yajo
Copy link
Member

yajo commented Jan 5, 2017

I agree, mostly with odoo/odoo#8591

@lasley
Copy link
Contributor

lasley commented Jan 5, 2017

Also agreed on odoo/odoo#8591

I think it would also be nice for a repo-level pylint config allowing for disabling of lints for reasons other than this, but that feature is probably best started in a new issue I think.

lasley pushed a commit to LasLabs/maintainer-quality-tools that referenced this pull request Jun 18, 2017
…dency (OCA#354)

[REF] pylint.cfg: Enable missing-import-error, missing-manifest-dependency
colinfwren pushed a commit to openeobs/maintainer-quality-tools that referenced this pull request Sep 8, 2017
…dency (OCA#354)

[REF] pylint.cfg: Enable missing-import-error, missing-manifest-dependency
lmignon added a commit to acsone/connector-cmis that referenced this pull request Sep 11, 2018
… is put in an addons path without the external lib installed

This error should never occur since if you put this project into your addon path you want to use it and without the lib it don't work. But Travis CI fails if these imports are not protected due to a stupid rule enforced in odoo-pylint (Oct, 11, 2016) OCA/maintainer-quality-tools#354
apineux pushed a commit to acsone/connector-cmis that referenced this pull request Jun 25, 2021
… is put in an addons path without the external lib installed

This error should never occur since if you put this project into your addon path you want to use it and without the lib it don't work. But Travis CI fails if these imports are not protected due to a stupid rule enforced in odoo-pylint (Oct, 11, 2016) OCA/maintainer-quality-tools#354
sbidoul pushed a commit to acsone/connector-cmis that referenced this pull request May 31, 2022
… is put in an addons path without the external lib installed

This error should never occur since if you put this project into your addon path you want to use it and without the lib it don't work. But Travis CI fails if these imports are not protected due to a stupid rule enforced in odoo-pylint (Oct, 11, 2016) OCA/maintainer-quality-tools#354
marielejeune pushed a commit to acsone/connector-cmis that referenced this pull request Mar 2, 2023
… is put in an addons path without the external lib installed

This error should never occur since if you put this project into your addon path you want to use it and without the lib it don't work. But Travis CI fails if these imports are not protected due to a stupid rule enforced in odoo-pylint (Oct, 11, 2016) OCA/maintainer-quality-tools#354
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants