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

CI: Require at least one code block separator for example files in the Style Checks workflow #2810

Merged
merged 7 commits into from
Nov 18, 2023

Conversation

seisman
Copy link
Member

@seisman seisman commented Nov 14, 2023

Description of proposed changes

Add a step in the Style Checks workflow, to ensure all example files have at least one code block separator # %%.

Address #2805 (comment).

See https://github.com/GenericMappingTools/pygmt/actions/runs/6864172516/job/18665360359?pr=2810. If I revert the changes in PR #2805, the workflow fails with the following error:

Code block separator '# %%' is required in following example files:
examples/gallery/maps/choropleth_map.py

which means the added step works as expected.

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.
  • Use underscores (not hyphens) in names of Python files and directories.

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 the maintenance Boring but important stuff for the core devs label Nov 14, 2023
@seisman seisman added this to the 0.11.0 milestone Nov 14, 2023
@seisman seisman added the needs review This PR has higher priority and needs review. label Nov 16, 2023
@seisman seisman requested a review from a team November 16, 2023 02:08
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.

.github/workflows/style_checks.yaml Outdated Show resolved Hide resolved
seisman and others added 2 commits November 16, 2023 10:50
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
@seisman
Copy link
Member Author

seisman commented Nov 16, 2023

Also mention this # %% rule in https://github.com/GenericMappingTools/pygmt/blob/v0.10.0/doc/contributing.md#code-style, and link to #2660?

Done in 8752ef2.

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.

One minor spelling issue, otherwise ok. Might be good to have someone else proofread the documentation.

doc/contributing.md Outdated Show resolved Hide resolved
@weiji14 weiji14 added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Nov 16, 2023
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
@seisman
Copy link
Member Author

seisman commented Nov 17, 2023

@yvonnefroehlich Maybe you can give this PR another review?

doc/contributing.md Outdated Show resolved Hide resolved
doc/contributing.md Outdated Show resolved Hide resolved
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
@seisman seisman merged commit 29610d7 into main Nov 18, 2023
13 of 16 checks passed
@seisman seisman deleted the check-code-block branch November 18, 2023 10:00
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Nov 18, 2023
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

3 participants