-
Notifications
You must be signed in to change notification settings - Fork 91
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
[WIP] MQT-compatible pre-commit + GitHub actions for 10, 11, 12 #117
Conversation
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.
Mostly LGTM, but some comments.
per-file-ignores= | ||
__init__.py:F401 |
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.
Does not match https://github.com/OCA/maintainer-quality-tools/blob/master/travis/cfg/travis_run_flake8.cfg#L9
This may be intentional, but flagging it.
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.
Yes that can be removed because the old flake8 oca/maintainer-quality-tools is using does not support per-file-ignores.
args: ["https://github.com/OCA/{{ repo_slug }}"] | ||
- repo: https://github.com/acsone/setuptools-odoo |
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.
A lot of checks are missing here compared to 13.0:
- forbidden-files
- autoflake
- black
- prettier
- pre-commit-hooks
- pyupgrade
- isort
Some of these exclusions seem intentional, but I'm not sure all of them are.
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.
That is intentional. My goal is to imitate what oca/mqt does, so we create as little disruption as possible when we are going to apply this to 10,11,12 in order to shut down travis.
@@ -0,0 +1,100 @@ | |||
[MASTER] |
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.
It'd probably be nice to use the same {% extends "src/.pylintrc-mandatory.jinja" %}
mechanism here as in src/
.
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.
Proposal in coopiteasy@9ef6115
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've no strong opinion on this. As long as this does the same as the pylint configs of oca/maintainer-quality-tools.
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.
It does basically the same, except .pylintrc
now also repeats the .pylintrc-mandatory
tests, which I think is desirable for local development.
In OCA/product-variant#248 and in local testing flake8 has been, well, flaky. This error keeps popping up:
pyflakes bug report found here: PyCQA/pyflakes#367 Fixed in pyflakes==2.1.0 (2019-01-23). I'm not sure what the direct relation between pyflakes and flake8 is, but I suspect that any 2019 release of flake8 should not exhibit this problem. (That, or bump down the Python version for the flake8 test.) Any reason why there's an old version of flake8 (v3.4.1, 2017-07-28) in this PR? |
Because that is the one that MQT uses. And when I tried to use a more recent one, there were new errors because of new/different checks in recent flake8 versions. Maybe this can be solved by pinning pyflakes to a version of the same era here. Or by disabling the new checks introduced by flake8 since then. Not sure what's best. |
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.
Looks very good.
2078d01
to
885143b
Compare
@carmenbianca I have squashed my commits here. Feel free to do PRs to my branches, or to cherry-pick my commit in a new PR of yours. |
@sbidoul I'm afraid I don't have the correct rights to push to your branch. In any case that shouldn't halt progress for now :) |
Notes on the flake8 problem:
Of these options, 2 and 4 seem the least painful. The reason 2 probably isn't that bad is because I suspect that people doing dev work on Odoo 12 probably do so on Python 3.6/3.7, so they should have the ability to install pre-commit against a lower Python version. But it'll still result in a lot of time wasted à la 'why doesn't this work' for local development. |
In my personal case, 1. would work best. Because I do have several python versions installed on my machine, while my pre-commit install is global and with the latest python version I have. |
Did a little research on to-disable tests for flake8: the flake8/pyflakes change logs sadly aren't very illuminating. The pycodestyle change log is more useful. On second thought @sbidoul you're probably right that option 1 isn't that bad. Can we reasonably 'force' devs who work on Odoo 12 to have Python 3.6 xor Python 3.7 (depending on which is chosen) installed? |
Ah, it appears option 1 is mutually inclusive with option 2 (but not the other way around). If you specify Python 3.6 in |
# F999 pylint support this case with expected tests | ||
# W503 changed by W504 and OCA prefers allow both | ||
# E203: whitespace before ':' (black behaviour and not pep8 compliant) | ||
ignore = E123,E133,E226,E241,E242,F811,F601,W503,W504,E203 |
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.
F999 doesn't exist. I think F601 is intended?
Pushed a partial fix for the failing pre-commit test here: coopiteasy@97f10c9 (edit 2022-03-02: fixed this link because it was incorrect) However, the solution causes prettier to fail on files like So I've also pushed coopiteasy@087d738 to fix that. |
The template used is this commit: <coopiteasy/oca-addons-repo-template@d28f504> At the time of writing, the 12.0 template for OCA is not yet finished, see <OCA/oca-addons-repo-template#117>. It was used regardless, with some modifications. The modifications are the additions of several tests in pre-commit, and the bumping of flake8. These modifications are made because the source material of this repo used these tools. The bumping of flake8 naively fixes an unresolved problem from the linked PR. Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
The template used is this commit: <coopiteasy/oca-addons-repo-template@d28f504> At the time of writing, the 12.0 template for OCA is not yet finished, see <OCA/oca-addons-repo-template#117>. It was used regardless, with some modifications. The modifications are the additions of several tests in pre-commit, and the bumping of flake8. These modifications are made because the source material of this repo used these tools. The bumping of flake8 naively fixes an unresolved problem from the linked PR. Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
The template used is this commit: <coopiteasy/oca-addons-repo-template@d28f504> At the time of writing, the 12.0 template for OCA is not yet finished, see <OCA/oca-addons-repo-template#117>. It was used regardless, with some modifications. The modifications are the additions of several tests in pre-commit, and the bumping of flake8. These modifications are made because the source material of this repo used these tools. The bumping of flake8 naively fixes an unresolved problem from the linked PR. Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
The template used is this commit: <coopiteasy/oca-addons-repo-template@d28f504> At the time of writing, the 12.0 template for OCA is not yet finished, see <OCA/oca-addons-repo-template#117>. It was used regardless, with some modifications. The modifications are the additions of several tests in pre-commit, and the bumping of flake8. These modifications are made because the source material of this repo used these tools. The bumping of flake8 naively fixes an unresolved problem from the linked PR. Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
The template used is this commit: <coopiteasy/oca-addons-repo-template@d28f504> At the time of writing, the 12.0 template for OCA is not yet finished, see <OCA/oca-addons-repo-template#117>. It was used regardless, with some modifications. The modifications are the additions of several tests in pre-commit, and the bumping of flake8. These modifications are made because the source material of this repo used these tools. The bumping of flake8 naively fixes an unresolved problem from the linked PR. Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
@carmenbianca will you do another PR with your work on this ? |
This continues in #132 |
Towards #103