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

Migrate pylint settings from .pylintrc to pyproject.toml #1755

Merged
merged 10 commits into from
Feb 21, 2022
Merged

Conversation

seisman
Copy link
Member

@seisman seisman commented Feb 13, 2022

Description of proposed changes

Changes in this PR:

  • Remove the long pylint configuration file .pylintrc
  • Migrate custom pylint settings (only five settings) in pyproject.toml
  • Do not set global disables import-outside-toplevel and attribute-defined-outside-init
  • Set jobs to 0 so that pylint can use all available cores (the old value is 4).

Fixes #1740.

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 wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman added this to the 0.6.0 milestone Feb 13, 2022
@seisman seisman added the maintenance Boring but important stuff for the core devs label Feb 13, 2022
Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one quick comment for now. I still need to find time to test this locally. Oh, and please remove the exclude .pylintrc line from MANIFEST.in!

Comment on lines -505 to -535
[DESIGN]

# Maximum number of arguments for function / method.
max-args=10

# Maximum number of attributes for a class (see R0902).
max-attributes=10

# Maximum number of boolean expressions in an if statement (see R0916).
max-bool-expr=5

# Maximum number of branch for function / method body.
max-branches=12

# Maximum number of locals for function / method body.
max-locals=15

# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of public methods for a class (see R0904).
max-public-methods=20

# Maximum number of return / yield for function / method body.
max-returns=6

# Maximum number of statements in function / method body.
max-statements=50

# Minimum number of public methods for a class (see R0903).
min-public-methods=2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep any more of these design choices? I think the max-attributes=10 is also a non-default choice according to #484. Feel like there are a few of these we should keep too even though we don't encounter it often.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default max-attributes=7 works well for the current main branch. Perhaps we should only change these values when we have to.

@seisman seisman marked this pull request as ready for review February 16, 2022 05:14
@seisman
Copy link
Member Author

seisman commented Feb 19, 2022

Ping @weiji14 and @meghanrjones for review.

Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks good, no errors running make lint locally 🎉

@weiji14 weiji14 added the final review call This PR requires final review and approval from a second reviewer label Feb 20, 2022
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Feb 21, 2022
@seisman seisman merged commit 24d6474 into main Feb 21, 2022
@seisman seisman deleted the pylintrc branch February 21, 2022 13:42
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…ingTools#1755)

* Migrate pylint settings from .pylintrc to pyproject.toml
* Disable import-error
* Remove .pylintrc from MANIFEST.in
* Remove .pylintrc from workflows
* Set generated-members to pandas.*
* Refactor test_hotspots to avoid E1101 error
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.

Migrate pylint configurations from .pylintrc to pyproject.toml
3 participants