Skip to content

Commit 33a4bac

Browse files
authored
CI: Ensure no hyphens in Python file and directory names in the "Style Checks" workflow (#3703)
1 parent 359e457 commit 33a4bac

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Fixes #
2020
- [ ] Write detailed docstrings for all functions/methods.
2121
- [ ] If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
2222
- [ ] If adding new functionality, add an example to docstrings or tutorials.
23-
- [ ] Use underscores (not hyphens) in names of Python files and directories.
2423

2524
**Slash Commands**
2625

.github/workflows/style_checks.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,15 @@ jobs:
5252
rm output.txt
5353
exit $nfiles
5454
fi
55+
56+
- name: Ensure hyphens are not used in names of directories and Python files
57+
run: |
58+
git ls-files '*.py' | grep '-' > output.txt || true
59+
git ls-tree -rd --name-only HEAD | grep '-' >> output.txt || true
60+
nfiles=$(wc --lines output.txt | awk '{print $1}')
61+
if [[ $nfiles > 0 ]]; then
62+
echo "Following directories/files use hyphens in file names:"
63+
cat output.txt
64+
rm output.txt
65+
exit $nfiles
66+
fi

doc/contributing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ our tests. This way, the *main* branch is always stable.
130130
integrated separately.
131131
- Bug fixes should be submitted in separate PRs.
132132
* How to write and submit a PR
133-
- Use underscores for all Python (*.py) files as per
134-
[PEP8](https://www.python.org/dev/peps/pep-0008/), not hyphens. Directory
135-
names should also use underscores instead of hyphens.
133+
- Use underscores for all Python (\*.py) files as per
134+
[PEP8](https://www.python.org/dev/peps/pep-0008/), not hyphens. Directory names
135+
should also use underscores instead of hyphens.
136136
- Describe what your PR changes and *why* this is a good thing. Be as
137137
specific as you can. The PR description is how we keep track of the changes
138138
made to the project over time.

0 commit comments

Comments
 (0)