Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/style_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,21 @@ jobs:
exit $nfiles
fi

- name: Ensure hyphens are not used in names of directories and Python files
- name: Ensure hyphens are not used in names of directories and files
run: |
git ls-files '*.py' | grep '-' > output.txt || true
git ls-tree -rd --name-only HEAD | grep '-' >> output.txt || true
# Paths that allows hyphens in their names.
allowed=(
'^\.pre-commit-config\.yaml$'
'^\.github/release-drafter\.yml$'
'^\.github/ISSUE_TEMPLATE/[0-9]+-'
'^doc/_static/'
'^pygmt/tests/baseline/'
'^\.github/workflows/'
)
git ls-files | grep '-' | grep -v -E "$(IFS='|'; echo "${allowed[*]}")" > output.txt || true
nfiles=$(wc --lines output.txt | awk '{print $1}')
if [[ $nfiles > 0 ]]; then
echo "Following directories/files use hyphens in file names:"
echo "Following directories/files use hyphens in their names:"
cat output.txt
rm output.txt
exit $nfiles
Expand Down
7 changes: 4 additions & 3 deletions doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ 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, not hyphens, in the names of all files and directories, as per
[PEP8](https://www.python.org/dev/peps/pep-0008/) for Python (\*.py) files. A few
exceptions are allowed (e.g., `.pre-commit-config.yaml`) and are listed
in the [style checks](.github/workflows/style_checks.yaml) workflow.
- 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
Loading