Ticket #12387: 0001-checkstyle-change-html-output-to-confirm-to-XHTML-St.patch

File 0001-checkstyle-change-html-output-to-confirm-to-XHTML-St.patch, 2.6 KB (added by idefix, 4 years ago)
  • src/tools/checkstyle/checkstyle.py

    From 4d1e30ba159da9365ffa954fbcae10e8d8308503 Mon Sep 17 00:00:00 2001
    From: Jeroen Oortwijn <oortwijn@gmail.com>
    Date: Tue, 22 Sep 2015 00:35:15 +0200
    Subject: [PATCH] [checkstyle] change html output to confirm to XHTML Strict
    
    Several errors in the html output caused WebPositive to not render
    the file completely.
    ---
     src/tools/checkstyle/checkstyle.py | 4 ++--
     src/tools/checkstyle/utils.py      | 9 ++++-----
     2 files changed, 6 insertions(+), 7 deletions(-)
    
    diff --git a/src/tools/checkstyle/checkstyle.py b/src/tools/checkstyle/checkstyle.py
    index fb581ef..7b86341 100755
    a b cppRules["Operator at line end"] = re.compile('([*=/+\-\|\&\?]|\&&|\|\|)(?=\n)') 
    5858cppRules["Missing space"] = re.compile('\){')
    5959cppRules["Mixed tabs/spaces"] = re.compile('( \t]|\t )+')
    6060cppRules["Malformed else"] = re.compile('}[ \t]*\n[ \t]*else')
    61 cppRules["Lines between functions > 2"] \
     61cppRules["Lines between functions &gt; 2"] \
    6262    = re.compile('(?<=\n})([ \t]*\n){3,}(?=\n)')
    63 cppRules["Lines between functions < 2"] \
     63cppRules["Lines between functions &lt; 2"] \
    6464    = re.compile('(?<=\n})([ \t]*\n){0,2}(?=.)')
    6565cppRules["Windows Line Ending"] = re.compile('\r')
    6666cppRules["Bad pointer/reference style"] \
  • src/tools/checkstyle/utils.py

    diff --git a/src/tools/checkstyle/utils.py b/src/tools/checkstyle/utils.py
    index 8b20575..8b587d4 100644
    a b def openHtml(fileList, outputFileName): 
    2727        <style type="text/css">""" + cssStyle() + """</style>
    2828    </head>
    2929    <body>
    30         <p><b>File list:</b><br>""")
     30        <p><b>File list:</b><br/>""")
    3131    for fileName in fileList:
    32         file.write(fileName + "<br>")
     32        file.write(fileName + "<br/>")
    3333    file.write("</p>")
    3434    file.close()
    3535
    def openHtml(fileList, outputFileName): 
    3737def closeHtml(outputFileName):
    3838    file = open(outputFileName, 'a')
    3939    file.write("""
    40         </pre>
    4140    </body>
    4241    </html>""")
    4342
    def renderHtml(text, highlights, sourceFileName, outputFileName): 
    6766    file.write('<table><tr><td><pre class="code"><span class="linenumber">')
    6867    count = 1
    6968    for line in temp.split('\n'):
    70         file.write(str(count).rjust(4)+"<br>")
     69        file.write(str(count).rjust(4)+"<br/>")
    7170        count += 1
    7271
    7372    file.write('</span></pre></td><td><pre class="code">')
    7473
    7574    for line in temp.split('\n'):
    7675        file.write('<span class="linehead"> </span>' + line.replace('\r', ' ') \
    77              + '<br>')
     76             + '<br/>')
    7877
    7978    file.write("</pre></td></tr></table>")
    8079