Skip to content

Commit

Permalink
CI: Ensure no hyphens in Python file and directory names in the "Styl…
Browse files Browse the repository at this point in the history
…e Checks" workflow (#3703)
  • Loading branch information
seisman authored Dec 26, 2024
1 parent 359e457 commit 33a4bac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Fixes #
- [ ] 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**

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/style_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@ jobs:
rm output.txt
exit $nfiles
fi
- name: Ensure hyphens are not used in names of directories and Python files
run: |
git ls-files '*.py' | grep '-' > output.txt || true
git ls-tree -rd --name-only HEAD | grep '-' >> output.txt || true
nfiles=$(wc --lines output.txt | awk '{print $1}')
if [[ $nfiles > 0 ]]; then
echo "Following directories/files use hyphens in file names:"
cat output.txt
rm output.txt
exit $nfiles
fi
6 changes: 3 additions & 3 deletions doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ our tests. This way, the *main* branch is always stable.
integrated separately.
- Bug fixes should be submitted in separate PRs.
* How to write and submit a PR
- Use underscores for all Python (*.py) files as per
[PEP8](https://www.python.org/dev/peps/pep-0008/), not hyphens. Directory
names should also use underscores instead of hyphens.
- Use underscores for all Python (\*.py) files as per
[PEP8](https://www.python.org/dev/peps/pep-0008/), not hyphens. Directory names
should also use underscores instead of hyphens.
- Describe what your PR changes and *why* this is a good thing. Be as
specific as you can. The PR description is how we keep track of the changes
made to the project over time.
Expand Down

0 comments on commit 33a4bac

Please sign in to comment.