Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ repos:
language: python
additional_dependencies: [pygments, restructuredtext_lint]
python_version: python3.6
- id: changelogs-rst
name: changelog files must end in .rst
entry: ./scripts/fail
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since I think this will probably be an applicable pattern elsewhere, I think I'll make it a first-class thing: pre-commit/pre-commit#807

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile this misses the part that automatically renames them in the workdir

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I left that as an exercise to the developer since making untracked files isn't usually a great idea (people often git add -u && !! which would untrack the file -- and generally touching the staging area seems not the best)

language: script
files: 'changelog/.*(?<!\.rst)$'
File renamed without changes.
7 changes: 7 additions & 0 deletions scripts/fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python
"""Used by .pre-commit-config.yaml"""
import sys

if __name__ == "__main__":
print(" ".join(sys.argv[1:]))
sys.exit(1)