From 6f35a44ad38833d6959c1ebe791cd70a9ba61213 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 13 May 2019 12:01:47 -0600 Subject: [PATCH] update python tools scripts - also check for empty lines in html tables - improve one of the error messages --- contrib/utilities/checkdoxygen.py | 65 +++++++++++++++++++++++-------- contrib/utilities/wrapcomments.py | 2 +- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/contrib/utilities/checkdoxygen.py b/contrib/utilities/checkdoxygen.py index 22aea15644..8c76d3d9db 100755 --- a/contrib/utilities/checkdoxygen.py +++ b/contrib/utilities/checkdoxygen.py @@ -1,12 +1,55 @@ #!/usr/bin/python -# run this script on all headers of deal.II to check that -# all doxygen groups have matching @{ @} pairs. +# run this script on all headers of deal.II to check various doxygen related problems + # for example: -# find include -name "*h" -print | xargs -n 1 ../tests/scripts/checkdoxygen.py +# find doc examples include -name "*.h" -o -name "*.dox" -print | xargs -n 1 contrib/utilities/checkdoxygen.py + import sys +# have matching @{ @} pairs? (doxygen groups) +def check_doxygen_groups(lines): + count = 0 + lineno = 1 + for l in lines: + if "@{" in l: + count = count + 1 + elif "@}" in l: + count = count -1 + if count < 0: + sys.exit("Error in file '%s' in line %d"%(args[0],lineno)) + lineno = lineno + 1 + + if (count != 0): + sys.exit("Error: missing closing braces in file '%s'"%(args[0])) + + return + +# have empty lines in html tables? +def check_empty_lines_in_tables(lines): + count = 0 + lineno = 1 + for l in lines: + if "" in l: + count = count -1 + if count < 0: + sys.exit("Error in file '%s' in line %d"%(args[0],lineno)) + + if count==1: + if l.strip()=="": + sys.exit("Error: empty line inside html table in file '%s' in line %d"%(args[0],lineno)) + + lineno = lineno + 1 + + if (count != 0): + sys.exit("Error: mismatched html table tags in file '%s'"%(args[0])) + + return + + args=sys.argv args.pop(0) @@ -14,17 +57,7 @@ f = open(args[0]) lines = f.readlines() f.close() +check_doxygen_groups(lines) +check_empty_lines_in_tables(lines) + -count = 0 -lineno = 1 -for l in lines: - if "@{" in l: - count = count + 1 - elif "@}" in l: - count = count -1 - if (count < 0): - sys.exit("Error in file '%s' in line %d"%(args[0],lineno)) - lineno = lineno + 1 - -if (count != 0): - sys.exit("Error: missing closing braces in file '%s'"%(args[0])) diff --git a/contrib/utilities/wrapcomments.py b/contrib/utilities/wrapcomments.py index a174d9266d..8909e7a83d 100755 --- a/contrib/utilities/wrapcomments.py +++ b/contrib/utilities/wrapcomments.py @@ -164,7 +164,7 @@ def format_block(lines, infostr=""): thisline = remove_junk([lines[idx]])[0] if not thisline.split(" ")[0] in ops_title_line: - print ("%s warning title not at start of line"%(infostr), file=sys.stderr) + print ("%s warning: @page/@name not at start of line"%(infostr), file=sys.stderr) out.append(start + thisline.strip()) elif "@ref" in lines[idx]: -- 2.39.5