Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

PR: Add validation prehooks #19

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 14 additions & 0 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import re
import sys

PLUGIN_REGEX = r'^[a-zA-Z][ a-zA-Z0-9]+$'

plugin_name = '{{ cookiecutter.plugin_name }}'

if not re.match(PLUGIN_REGEX, plugin_name):
print('ERROR: {}'.format(plugin_name),
'Plugin name should starts by a letter',
'And containts only letters, numbers or spaces')

ccordoba12 marked this conversation as resolved.
Show resolved Hide resolved
# exits with status 1 to indicate failure
sys.exit(1)