-
Notifications
You must be signed in to change notification settings - Fork 16
Revive pylint support, and a first batch for fixes for problems found #3
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
Conversation
Top-level xcp/ is not a symlink any more, it's a dir. Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
_CMPProxy is an abstract class, and pylint needs a way to see that, or it issues an error: ************* Module xcp.cpiofile E:519,12: Instance of '_CMPProxy' has no 'init' member (no-member) Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
edwintorok
left a comment
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.
Thanks for enabling pylint. Could we get it to run using github actions?
See here what SM does: https://github.com/xapi-project/sm/blob/master/.github/workflows/main.yml
Might be useful to have a test matrix there: test using both python2.7 and 3.x to ensure our changes are compatible with both.
| self.init() | ||
| self.read(pos - self.pos) | ||
|
|
||
| def init(self): |
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 think this can be done via some of the @abc annotations in python, would https://docs.python.org/3/library/abc.html#abc.abstractmethod (and inheriting from the proper ABC class) fix the pylint warning too?
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, using abc works just as well. That one is annoying in projects making heavy use of metaclasses (which is why I default to the exception idiom), but it will do the job here.
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.
Note, inheriting from abc.ABC comes with 3.4 only, so we'd have to use something like @six.add_metaclass(abc.ABCMeta) for a 2/3-portable idiom, which I feel brings too much complexity, for no clear advantage over NotImplementedError(). What do you think ?
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.
Note, inheriting from
abc.ABCcomes with 3.4 only, so we'd have to use something like@six.add_metaclass(abc.ABCMeta)for a 2/3-portable idiom, which I feel brings too much complexity, for no clear advantage overNotImplementedError(). What do you think ?
I think I'd concur with that. My feeling is we want the Py2/Py3 compatibility phase to be relatively short until the migration is complete and then drop the py2 support completely at which point there can be a follow on set of changes to perform code cleanups.
sure!
That does make sense for unit tests, but for pylint the usefulness will I think mostly be in making use of newer py3-only versions of pylint - all of which requires to get the migration far enough first. |
b4fda60 to
54494b4
Compare
|
I think to enable the CI we'd have to merge this to master, I see it passed on your fork |
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
Signed-off-by: Yann Dirson <yann.dirson@vates.fr>
| self.init() | ||
| self.read(pos - self.pos) | ||
|
|
||
| def init(self): |
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.
Note, inheriting from
abc.ABCcomes with 3.4 only, so we'd have to use something like@six.add_metaclass(abc.ABCMeta)for a 2/3-portable idiom, which I feel brings too much complexity, for no clear advantage overNotImplementedError(). What do you think ?
I think I'd concur with that. My feeling is we want the Py2/Py3 compatibility phase to be relatively short until the migration is complete and then drop the py2 support completely at which point there can be a follow on set of changes to perform code cleanups.
CP-48784: Sync with original tar file
Capture multipath
* tox.ini: Complete the transition from pyre to pyright Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * pre-commit: Remove the remaining call to pyre in pre-commit Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * docs: Complete the transition from pyre to pyright Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * `tox.ini/pyright`: Fail `tox` if `pyright` fails (enforce check) Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * pyre: Finally, remove obsolete pyre error suppressions Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * Fix remaining pyright warnings found by the unit tests Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * GitHub CI/`tox`: Update CI to use Python `3.11`, `3.12` and `3.13` Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * `CONTRIBUTING.md`: Add `venv` setup and using `pipx` Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * `tests/test_logger.py`: Use `pyfakefs`: don't create a file in the host Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * `.github/workflows/main.yml`: Cleanup obsolete code for Python 2.7/3.8 Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * `CONTRIBUTING.md`: Fix Markdown format for linting Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * `README.md`: Fix Markdown format for linting and update it Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * `README-Unicode.md`: Fix Markdown format for linting and update it Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * `.pre-commit-config.yaml`: Replace mdformat check with markdownlint-cli Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * pytest.ini: Support newer pytest versions (>=7) to fix errors devs face Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> * tox.ini: Fix choking on venvs with symlink to dirs: skip untracked files Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com> --------- Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
pylint will be of help for python3 support.