Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tor
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jarl
tor
Commits
560450f2
Commit
560450f2
authored
9 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
helper script to highlight undocumented members
parent
4895d828
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/maint/locatemissingdoxygen.py
+74
-0
74 additions, 0 deletions
scripts/maint/locatemissingdoxygen.py
with
74 additions
and
0 deletions
scripts/maint/locatemissingdoxygen.py
0 → 100755
+
74
−
0
View file @
560450f2
#!/usr/bin/python
"""
This script parses the stderr output of doxygen and looks for undocumented
stuff. By default, it just counts the undocumented things per file. But with
the -A option, it rewrites the files to stick in /*DOCDOC*/ comments
to highlight the undocumented stuff.
"""
import
os
import
re
import
shutil
import
sys
warning_pattern
=
re
.
compile
(
r
'
^([^:]+):(\d+): warning: (.*) is not documented
'
)
def
readDoxygenOutput
(
f
):
"
yields (cfilename, lineno, thingname)
"
for
line
in
f
:
m
=
warning_pattern
.
match
(
line
)
if
m
:
yield
m
.
groups
()
warnings
=
{}
def
buildWarnings
():
for
fn
,
lineno
,
what
in
list
(
readDoxygenOutput
(
sys
.
stdin
)):
warnings
.
setdefault
(
fn
,
[]).
append
(
(
int
(
lineno
),
what
)
)
def
count
(
fn
):
if
os
.
path
.
abspath
(
fn
)
not
in
warnings
:
print
"
0
\t
%s
"
%
fn
else
:
n
=
len
(
warnings
[
os
.
path
.
abspath
(
fn
)])
print
"
%d
\t
%s
"
%
(
n
,
fn
)
def
getIndentation
(
line
):
s
=
line
.
lstrip
()
return
line
[:
len
(
line
)
-
len
(
s
)]
def
annotate
(
filename
):
if
os
.
path
.
abspath
(
filename
)
not
in
warnings
:
return
with
open
(
filename
)
as
f
:
lines
=
f
.
readlines
()
w
=
warnings
[
os
.
path
.
abspath
(
filename
)][:]
w
.
sort
()
w
.
reverse
()
for
lineno
,
what
in
w
:
lineno
-=
1
# list is 0-indexed.
if
'
DOCDOC
'
in
lines
[
lineno
]:
continue
ind
=
getIndentation
(
lines
[
lineno
])
lines
.
insert
(
lineno
,
"
%s/* DOCDOC %s */
\n
"
%
(
ind
,
what
))
shutil
.
copy
(
filename
,
filename
+
"
.orig
"
)
with
open
(
filename
,
'
w
'
)
as
f
:
for
l
in
lines
:
f
.
write
(
l
)
if
__name__
==
'
__main__
'
:
if
len
(
sys
.
argv
)
==
1
:
print
"
Usage: locatemissingdoxygen.py [-A] filename... <doxygen_log
"
sys
.
exit
(
1
)
buildWarnings
()
if
sys
.
argv
[
1
]
==
'
-A
'
:
del
sys
.
argv
[
1
]
func
=
annotate
else
:
func
=
count
for
fname
in
sys
.
argv
[
1
:]:
func
(
fname
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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