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

build_arg_list: Raise an exception if an invalid output file name is given #3336

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Jul 18, 2024

Description of proposed changes

When working on PR #3334, I realized that we didn't check if the outfile parameter passed to build_arg_list is valid or not. Some invalid values are "", ".", ".." or a string ending with / or \.

This PR enhances the build_arg_list function to check if the outfile argument is valid. We can't check all cases but at least we can raise an exception for a few common cases.

This PR will further simplify #3334.

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 command is:

  • /format: automatically format and lint the code

@seisman seisman marked this pull request as ready for review July 18, 2024 03:54
@seisman seisman added maintenance Boring but important stuff for the core devs needs review This PR has higher priority and needs review. run/benchmark Trigger the benchmark workflow in PRs labels Jul 18, 2024
@seisman seisman added this to the 0.13.0 milestone Jul 18, 2024
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.

Looks ok I think, just one suggestion to check the Windows-style folders ending with \\.

pygmt/tests/test_helpers.py Outdated Show resolved Hide resolved
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
@seisman
Copy link
Member Author

seisman commented Jul 19, 2024

/format

@seisman seisman merged commit 419e931 into main Jul 19, 2024
20 checks passed
@seisman seisman deleted the build_arg_list/check-output branch July 19, 2024 01:30
@seisman seisman removed the needs review This PR has higher priority and needs review. label Oct 10, 2024
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 run/benchmark Trigger the benchmark workflow in PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants