Skip to content
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

Unpin pylint version and fix some lint warnings #484

Merged
merged 15 commits into from
Jun 27, 2020
Merged

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Jun 21, 2020

Description of proposed changes

Not sure why pylint was pinned to 2.2.2 in #383, but it's broken and we'll need to update to 2.3.0 or newer (see pylint-dev/astroid#649). Using 2.2.2 will give the following error:

 AttributeError: 'Import' object has no attribute 'infer_name_module'

Will also fix some lint warnings in this PR. I've refreshed the .pylintrc file for pylint v2.5.3 by running:

pylint --generate-rcfile > .pylintrc

and then manually kept some old PyGMT specific settings from earlier PRs (e.g. #73).

  • jobs=4
  • max-module-lines=2000
  • max-args=10
  • max-attributes=10
  • good-names=i,j,k,ex,Run,_,w,e,s,n,x,y,z

Also added back 'attribute-defined-outside-init' and 'bad-continuation' to the disable list, the latter is to fit in with black (see psf/black#48).

References:

Fixes #

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

@weiji14 weiji14 added the maintenance Boring but important stuff for the core devs label Jun 21, 2020
@seisman
Copy link
Member

seisman commented Jun 21, 2020

pylint-dev/astroid#649 (comment)

The reason we pin pylint is that new versions often introduce new types of errors, and we don't want our CI to break due to these new errors. For example 2.3.0 introduces a new "no-else-raise" error.

I guess @leouieda pinned pylint for the same reason.

Run v2.5.3 of pylint: `pylint --generate-rcfile > .pylintrc`, and then manually keeping some old PyGMT specific settings. E.g. jobs=4; max-module-lines=2000; max-args=10; max-attributes=10; good-names=i,j,k,ex,Run,_,w,e,s,n,x,y,z. Add back 'attribute-defined-outside-init' and 'bad-continuation' to the disable list, the latter is to fit in with black (see psf/black#48).
Allow importing certain modules outside of toplevel.
@vercel vercel bot temporarily deployed to Preview June 24, 2020 00:44 Inactive
@weiji14 weiji14 requested a review from a team June 26, 2020 03:12
@seisman
Copy link
Member

seisman commented Jun 26, 2020

Please merge the master branch in and see if the CI pass (still 43 failures).

See https://stackoverflow.com/a/61139278.

Co-Authored-By: Dongdong Tian <seisman.info@gmail.com>
@seisman
Copy link
Member

seisman commented Jun 26, 2020

There is still one warning for me:

pylint pygmt setup.py
************* Module pygmt
pygmt/__init__.py:42:4: C0415: Import outside toplevel (clib) (import-outside-toplevel)

but I'm using pylint 2.4.4

.pylintrc Outdated Show resolved Hide resolved
So that both pylint 2.4.4 and 2.5.3 will be happy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants