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

Add more example code standards #1126

Merged
merged 7 commits into from
Apr 4, 2021
Merged

Conversation

core-man
Copy link
Member

@core-man core-man commented Mar 26, 2021

Description of proposed changes

A code standard about string value is added in CONTRIBUTING.md (Originally posted in #983 (comment). See also #983 (comment) and #983 (comment)):

  • Double-quotes are used to indicate a string value instead of single-quotes. Example: "05m".
  • An argument with a string value set should be added `` on both sides of the expressions. Example: ``style="v"`` results in style="v".

Fixes #983

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.

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

@core-man core-man marked this pull request as draft March 26, 2021 09:12
@core-man core-man self-assigned this Mar 26, 2021
Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

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

This guideline seems fine to me, but we can leave it open for a bit longer to see if anyone else has other preferences.

@seisman seisman added this to the 0.4.0 milestone Mar 29, 2021
@seisman seisman added documentation Improvements or additions to documentation skip-changelog Skip adding Pull Request to changelog labels Mar 29, 2021
@seisman seisman marked this pull request as ready for review March 29, 2021 23:10
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
Co-authored-by: Dongdong Tian <[email protected]>
@core-man
Copy link
Member Author

core-man commented Apr 2, 2021

  1. Python arguments, such as import statements, Boolean expressions, and function arguments should be wrapped as code by using `` on both sides of the code. Example: ``import pygmt`` results in import pygmt.

I find we use both `True` (True) and **True** (True). E.g,

Shall we add an example in the first rule? e.g., ``True`` results in True. This corresponds to Boolean expressions, right?

Meanwhile, shall we move this example in the first rule: ``style="v"`` results in style="v"? This is for function arguments.

@seisman
Copy link
Member

seisman commented Apr 3, 2021

Shall we add an example in the first rule? e.g., True results in True. This corresponds to Boolean expressions, right?

Yes.

Meanwhile, shall we move this example in the first rule: style="v" results in style="v"? This is for function arguments.

Yes.

@seisman seisman requested a review from maxrjones April 3, 2021 15:07
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Apr 3, 2021
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Apr 4, 2021
@seisman seisman changed the title Add a string code standard Add more example code standards Apr 4, 2021
@seisman seisman merged commit 9b57cc9 into GenericMappingTools:master Apr 4, 2021
@core-man core-man deleted the string branch April 4, 2021 04:09
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation skip-changelog Skip adding Pull Request to changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve PyGMT documentation
3 participants