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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
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
Show 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):
...
@@ -153,6 +153,12 @@ class Plugin(CoveragePlugin):
match_source_path_line
=
re
.
compile
(
r' */[*] +"(.*)":([0-9]+)$'
).
match
match_source_path_line
=
re
.
compile
(
r' */[*] +"(.*)":([0-9]+)$'
).
match
match_current_code_line
=
re
.
compile
(
r' *[*] (.*) # <<<<<<+$'
).
match
match_current_code_line
=
re
.
compile
(
r' *[*] (.*) # <<<<<<+$'
).
match
match_comment_end
=
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)
code_lines = defaultdict(dict)
filenames = set()
filenames = set()
...
@@ -168,7 +174,10 @@ class Plugin(CoveragePlugin):
...
@@ -168,7 +174,10 @@ class Plugin(CoveragePlugin):
for comment_line in lines:
for comment_line in lines:
match = match_current_code_line(comment_line)
match = match_current_code_line(comment_line)
if match:
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
break
elif match_comment_end(comment_line):
elif match_comment_end(comment_line):
# unexpected comment format - false positive?
# 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