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
40c84e19
Commit
40c84e19
authored
10 years ago
by
Raniere Silva
Browse files
Options
Downloads
Plain Diff
Merge pull request #115 from abought/114_errmsg_fixes
Validator logging QA bugfixes
parents
36000796
8fd487b3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/check.py
+19
-23
19 additions, 23 deletions
tools/check.py
tools/test_check.py
+8
-0
8 additions, 0 deletions
tools/test_check.py
with
27 additions
and
23 deletions
tools/check.py
+
19
−
23
View file @
40c84e19
...
...
@@ -141,7 +141,7 @@ class MarkdownValidator(object):
for
h
in
missing_headings
:
logging
.
error
(
"
In {0}:
"
"
Header section is missing expected
"
"
row {1}
"
.
format
(
self
.
filename
,
h
))
"
row
'
{1}
'
"
.
format
(
self
.
filename
,
h
))
return
has_hrs
and
all
(
test_headers
)
and
only_headers
...
...
@@ -371,9 +371,9 @@ class TopicPageValidator(MarkdownValidator):
if
node_tests
is
False
:
logging
.
error
(
"
In {0}:
"
"
Learning Objectives should not be empty.
"
.
format
(
self
.
filename
))
"
Page should contain a blockquoted section with level 2
"
"
title
'
Learning Objectives
'
. Section should not
"
"
be empty.
"
.
format
(
self
.
filename
))
return
node_tests
def
_validate_has_no_headings
(
self
):
...
...
@@ -385,17 +385,13 @@ class TopicPageValidator(MarkdownValidator):
if
len
(
heading_nodes
)
==
0
:
return
True
# Individual heading msgs are logged by validate_section_heading_order
logging
.
error
(
"
In {0}:
"
"
The topic page should not have sub-headings
"
"
outside of special blocks.
"
"
If a topic needs sub-headings,
"
"
it should be broken into multiple topics.
"
.
format
(
self
.
filename
))
for
n
in
heading_nodes
:
logging
.
warning
(
"
In {0}:
"
"
The following sub-heading should be removed: {1}
"
.
format
(
self
.
filename
,
n
.
strings
[
0
]))
return
False
def
_run_tests
(
self
):
...
...
@@ -433,10 +429,10 @@ class ReferencePageValidator(MarkdownValidator):
glossary_keyword
=
glossary_entry
[
0
]
if
len
(
glossary_entry
)
<
2
:
logging
.
error
(
"
In {0}:
"
"
Glossary entry
'
{1}
'
must have at least two lines-
"
"
a term and a definition.
"
.
format
(
glossary_keyword
,
self
.
filename
))
"
In {0}:
"
"
Glossary entry
'
{1}
'
must have at least two lines-
"
"
a term and a definition.
"
.
format
(
self
.
filename
,
glossary_keyword
))
return
False
entry_is_valid
=
True
...
...
@@ -444,20 +440,20 @@ class ReferencePageValidator(MarkdownValidator):
if
line_index
==
1
:
if
not
re
.
match
(
"
^:
"
,
line
):
logging
.
error
(
"
In {0}:
"
"
At glossary entry
'
{1}
'
"
"
First line of definition must
"
"
start with
'
:
'
.
"
.
format
(
glossary_keyword
,
self
.
filename
))
"
In {0}:
"
"
At glossary entry
'
{1}
'
"
"
First line of definition must
"
"
start with
'
:
'
.
"
.
format
(
self
.
filename
,
glossary_keyword
))
entry_is_valid
=
False
elif
line_index
>
1
:
if
not
re
.
match
(
"
^
"
,
line
):
logging
.
error
(
"
In {0}:
"
"
At glossary entry
'
{1}
'
"
"
Subsequent lines of definition must
"
"
start with
'
'
.
"
.
format
(
glossary_keyword
,
self
.
filename
))
"
In {0}:
"
"
At glossary entry
'
{1}
'
"
"
Subsequent lines of definition must
"
"
start with
'
'
.
"
.
format
(
self
.
filename
,
glossary_keyword
,
))
entry_is_valid
=
False
return
entry_is_valid
...
...
This diff is collapsed.
Click to expand it.
tools/test_check.py
+
8
−
0
View file @
40c84e19
...
...
@@ -295,6 +295,14 @@ minutes: not a number
---
"""
)
self
.
assertFalse
(
validator
.
_validate_doc_headers
())
def
test_topic_page_should_have_no_headings
(
self
):
"""
Requirement according to spec; may be relaxed in future
"""
validator
=
self
.
_create_validator
(
"""
## Heading that should not be present
Some text
"""
)
self
.
assertFalse
(
validator
.
_validate_has_no_headings
())
def
test_sample_file_passes_validation
(
self
):
sample_validator
=
self
.
VALIDATOR
(
self
.
SAMPLE_FILE
)
res
=
sample_validator
.
validate
()
...
...
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