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

CI: Ensure no hyphens in Python file and directory names in the "Style Checks" workflow #3703

Merged
merged 5 commits into from
Dec 26, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Dec 20, 2024

We've documented that underscores, not hyphens, should be used in Python file and directory names, but we don't have a way to enforce it.

This PR adds a check in the "Style Checks" workflow, so the workflow will fail if there are violations. The following two commands list all Python files and directories.

git ls-files '*.py' 
git ls-tree -rd --name-only HEAD 

and then we can use grep "-" to check hyphens.

grep "-" exits with 0 if hyphens are found and 1 if unfound, which makes GitHub Actions step fail. So we need to add || true so that the commands always exit with 0.

The related entry in the pull request template is removed so keep the template simple.

In 5879833, one file and directory with hyphens are added to test the workflow. The workflow fails as expected (https://github.com/GenericMappingTools/pygmt/actions/runs/12431105443/job/34707863816?pr=3703).

@seisman seisman added maintenance Boring but important stuff for the core devs needs review This PR has higher priority and needs review. labels Dec 20, 2024
@seisman seisman added this to the 0.14.0 milestone Dec 20, 2024
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. final review call This PR requires final review and approval from a second reviewer labels Dec 25, 2024
@seisman seisman merged commit 33a4bac into main Dec 26, 2024
11 checks passed
@seisman seisman deleted the ci/check-hypens branch December 26, 2024 02:49
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant