Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lesson Template
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
prace-lessons
Lesson Template
Commits
fdc766a4
Commit
fdc766a4
authored
8 years ago
by
Greg Wilson
Browse files
Options
Downloads
Plain Diff
Merge branch 'new-style' of github.com:swcarpentry/styles into new-style
parents
349fdb07
c29abf91
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/workshop_check.py
+35
-0
35 additions, 0 deletions
bin/workshop_check.py
with
35 additions
and
0 deletions
bin/workshop_check.py
+
35
−
0
View file @
fdc766a4
...
...
@@ -29,10 +29,14 @@ logger.addHandler(console_handler)
# TODO: these regexp patterns need comments inside
EMAIL_PATTERN
=
r
'
[^@]+@[^@]+\.[^@]+
'
HUMANTIME_PATTERN
=
r
'
((0?[1-9]|1[0-2]):[0-5]\d(am|pm)(-|to)(0?[1-9]|1[0-2]):[0-5]\d(am|pm))|((0?\d|1\d|2[0-3]):[0-5]\d(-|to)(0?\d|1\d|2[0-3]):[0-5]\d)
'
EVENTBRITE_PATTERN
=
r
'
\d{9,10}
'
URL_PATTERN
=
r
'
https?://.+
'
CARPENTRIES
=
(
"
dc
"
,
"
swc
"
)
DEFAULT_CONTACT_EMAIL
=
'
admin@software-carpentry.org
'
USAGE
=
'
Usage:
"
check-workshop path/to/index.html
"
\n
'
# Country and language codes. Note that codes mean different things: 'ar'
...
...
@@ -110,6 +114,13 @@ def check_layout(layout):
return
layout
==
'
workshop
'
@look_for_fixme
def
check_carpentry
(
layout
):
'''"
carpentry
"
in YAML header must be
"
dc
"
or
"
swc
"
.
'''
return
layout
in
CARPENTRIES
@look_for_fixme
def
check_country
(
country
):
'''"
country
"
must be a lowercase ISO-3166 two-letter code.
'''
...
...
@@ -204,6 +215,16 @@ def check_helpers(helpers):
return
isinstance
(
helpers
,
list
)
and
len
(
helpers
)
>=
0
@look_for_fixme
def
check_email
(
email
):
'''"
contact
"
must be a valid email address consisting of characters, a
@, and more characters. It should not be the default contact
email address
"
admin@software-carpentry.org
"
.
'''
return
bool
(
re
.
match
(
EMAIL_PATTERN
,
email
))
and
\
(
email
!=
DEFAULT_CONTACT_EMAIL
)
def
check_eventbrite
(
eventbrite
):
'''"
eventbrite
"
(the Eventbrite registration key) must be 9 or more digits.
'''
...
...
@@ -231,9 +252,13 @@ def check_pass(value):
HANDLERS
=
{
'
layout
'
:
(
True
,
check_layout
,
'
layout isn
\'
t
"
workshop
"'
),
'
carpentry
'
:
(
True
,
check_carpentry
,
'
carpentry isn
\'
t in
'
+
'
,
'
.
join
(
CARPENTRIES
)),
'
country
'
:
(
True
,
check_country
,
'
country invalid: must use lowercase two-letter ISO code
'
+
'
from
'
+
'
,
'
.
join
(
ISO_COUNTRY
)),
'
language
'
:
(
False
,
check_language
,
'
language invalid: must use lowercase two-letter ISO code
'
+
'
from
'
+
'
,
'
.
join
(
ISO_LANGUAGE
)),
...
...
@@ -241,11 +266,14 @@ HANDLERS = {
'
humandate
'
:
(
True
,
check_humandate
,
'
humandate invalid. Please use three-letter months like
'
+
'"
Jan
"
and four-letter years like
"
2025
"
.
'
),
'
humantime
'
:
(
True
,
check_humantime
,
'
humantime doesn
\'
t include numbers
'
),
'
startdate
'
:
(
True
,
check_date
,
'
startdate invalid. Must be of format year-month-day,
'
+
'
i.e., 2014-01-31.
'
),
'
enddate
'
:
(
False
,
check_date
,
'
enddate invalid. Must be of format year-month-day, i.e.,
'
+
'
2014-01-31.
'
),
...
...
@@ -257,14 +285,21 @@ HANDLERS = {
'
instructor
'
:
(
True
,
check_instructors
,
'
instructor list isn
\'
t a valid list of format
'
+
'
[
"
First instructor
"
,
"
Second instructor
"
,..].
'
),
'
helper
'
:
(
True
,
check_helpers
,
'
helper list isn
\'
t a valid list of format
'
+
'
[
"
First helper
"
,
"
Second helper
"
,..].
'
),
'
contact
'
:
(
True
,
check_email
,
'
contact email invalid or still set to
'
+
'"
{0}
"
.
'
.
format
(
DEFAULT_CONTACT_EMAIL
)),
'
eventbrite
'
:
(
False
,
check_eventbrite
,
'
Eventbrite key appears invalid.
'
),
'
etherpad
'
:
(
False
,
check_etherpad
,
'
Etherpad URL appears invalid.
'
),
'
venue
'
:
(
False
,
check_pass
,
'
venue name not specified
'
),
'
address
'
:
(
False
,
check_pass
,
'
address not specified
'
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment