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
6fcfba3a
Commit
6fcfba3a
authored
8 years ago
by
Greg Wilson
Browse files
Options
Downloads
Plain Diff
Merge branch '2016-06' of github.com:swcarpentry/styles into 2016-06
parents
d67c4f42
0c9c1533
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/lesson_check.py
+30
-7
30 additions, 7 deletions
bin/lesson_check.py
with
30 additions
and
7 deletions
bin/lesson_check.py
+
30
−
7
View file @
6fcfba3a
...
...
@@ -67,8 +67,8 @@ KNOWN_CODEBLOCKS = {
'
sql
'
}
# What fields are required in episode metadata?
EPISODE
_METADATA_FIELDS
=
{
# What fields are required in
teaching
episode metadata?
TEACHING
_METADATA_FIELDS
=
{
(
'
title
'
,
str
),
(
'
teaching
'
,
int
),
(
'
exercises
'
,
int
),
...
...
@@ -77,6 +77,13 @@ EPISODE_METADATA_FIELDS = {
(
'
keypoints
'
,
list
)
}
# What fields are required in break episode metadata?
BREAK_METADATA_FIELDS
=
{
(
'
layout
'
,
str
),
(
'
title
'
,
str
),
(
'
break
'
,
int
)
}
# How long are lines allowed to be?
MAX_LINE_LEN
=
100
...
...
@@ -351,11 +358,27 @@ class CheckEpisode(CheckBase):
def
check_metadata
(
self
):
super
(
CheckEpisode
,
self
).
check_metadata
()
if
self
.
metadata
:
for
(
name
,
type_
)
in
EPISODE_METADATA_FIELDS
:
self
.
reporter
.
check
(
type
(
self
.
metadata
.
get
(
name
,
None
))
==
type_
,
self
.
filename
,
'"
{0}
"
missing, empty, or has wrong type in metadata
'
,
name
)
if
'
layout
'
in
self
.
metadata
:
if
self
.
metadata
[
'
layout
'
]
==
'
break
'
:
self
.
check_metadata_fields
(
BREAK_METADATA_FIELDS
)
else
:
self
.
reporter
.
add
(
self
.
filename
,
'
Unknown episode layout
"
{0}
"'
,
self
.
metadata
[
'
layout
'
])
else
:
self
.
check_metadata_fields
(
TEACHING_METADATA_FIELDS
)
def
check_metadata_fields
(
self
,
expected
):
for
(
name
,
type_
)
in
expected
:
if
name
not
in
self
.
metadata
:
self
.
reporter
.
add
(
self
.
filename
,
'
Missing metadata field {0}
'
,
name
)
elif
type
(
self
.
metadata
[
name
])
!=
type_
:
self
.
reporter
.
add
(
self
.
filename
,
'"
{0}
"
has wrong type in metadata ({1} instead of {2})
'
,
name
,
type
(
self
.
metadata
[
name
]),
type_
)
class
CheckReference
(
CheckBase
):
...
...
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