Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ae24e7b5
Commit
ae24e7b5
authored
Jan 03, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Recognize usage of the default role.
parent
9f7a3398
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
Doc/tools/rstlint.py
Doc/tools/rstlint.py
+10
-2
No files found.
Doc/tools/rstlint.py
View file @
ae24e7b5
...
...
@@ -40,7 +40,7 @@ directives = [
all_directives
=
'('
+
'|'
.
join
(
directives
)
+
')'
seems_directive_re
=
re
.
compile
(
r'\
.
\. %s([^a-z:]|:(?!:))'
%
all_directives
)
default_role_re
=
re
.
compile
(
r'(^| )`\
w([^`]*?
\w)?`($| )'
)
leaked_markup_re
=
re
.
compile
(
r'[a-z]::[^=]|:[a-z]+:|`|\
.
\.\
s*
\w+:'
)
...
...
@@ -65,7 +65,8 @@ def check_syntax(fn, lines):
try
:
code
=
''
.
join
(
lines
)
if
'
\
r
'
in
code
:
yield
0
,
'
\
\
r in code file'
if
os
.
name
!=
'nt'
:
yield
0
,
'
\
\
r in code file'
code
=
code
.
replace
(
'
\
r
'
,
''
)
compile
(
code
,
fn
,
'exec'
)
except
SyntaxError
,
err
:
...
...
@@ -75,9 +76,16 @@ def check_syntax(fn, lines):
@
checker
(
'.rst'
,
severity
=
2
)
def
check_suspicious_constructs
(
fn
,
lines
):
"""Check for suspicious reST constructs."""
inprod
=
False
for
lno
,
line
in
enumerate
(
lines
):
if
seems_directive_re
.
match
(
line
):
yield
lno
+
1
,
'comment seems to be intended as a directive'
if
'.. productionlist::'
in
line
:
inprod
=
True
elif
not
inprod
and
default_role_re
.
search
(
line
):
yield
lno
+
1
,
'default role used'
elif
inprod
and
not
line
.
strip
():
inprod
=
False
@
checker
(
'.py'
,
'.rst'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment