Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
1862ddfe
Commit
1862ddfe
authored
Feb 22, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverage: exclude code lines that are obviously not executable (e.g. struct declarations)
parent
a871a39a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
Cython/Coverage.py
Cython/Coverage.py
+10
-1
No files found.
Cython/Coverage.py
View file @
1862ddfe
...
...
@@ -153,6 +153,12 @@ class Plugin(CoveragePlugin):
match_source_path_line
=
re
.
compile
(
r' */[*] +"(.*)":([0-9]+)$'
).
match
match_current_code_line
=
re
.
compile
(
r' *[*] (.*) # <<<<<<+$'
).
match
match_comment_end
=
re
.
compile
(
r' *[*]/$'
).
match
not_executable
=
re
.
compile
(
r'\
s*c(?:
type)?def\
s+
'
r'
(
?
:(
?
:
public
|
external
)
\
s
+
)
?
'
r'
(
?
:
struct
|
union
|
enum
|
class
)
'
r'
(
\
s
+
[
^
:]
+|
)
\
s
*
:
'
).match
code_lines = defaultdict(dict)
filenames = set()
...
...
@@ -168,7 +174,10 @@ class Plugin(CoveragePlugin):
for comment_line in lines:
match = match_current_code_line(comment_line)
if match:
code_lines
[
filename
][
lineno
]
=
match
.
group
(
1
).
rstrip
()
code_line = match.group(1).rstrip()
if not_executable(code_line):
break
code_lines[filename][lineno] = code_line
break
elif match_comment_end(comment_line):
# unexpected comment format - false positive?
...
...
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