For whatever reason, pygments removes leading empty lines by default.
This results in the error messages being in the wrong line, shifted by
how many empty lines were removed.
Adding the option "stripnl=False" as an option to the lexer constructor
avoids this issue.
Follow-up to bca5d0d820
The style for inconclusive messages has to be fixed too. Otherwise
the border adds 2 extra pixels resulting in improper line height.
* rename JS functions
* Use the native font stack
* Update cppcheck-htmlreport
* Use a class for hiding content and toggle that instead. This should improve performance with huge reports.
* reorder selectors
* use classes for header and footer
* remove unneeded clear property (we don't have floats anymore)
* fix wrong `font-size` and `margin` properties
* remove `dir=rtl`
Related ticket: https://trac.cppcheck.net/ticket/9574
* Try to use double quotes consistently
* minor CSS consistency changes
* fix HTML errors
* fix a few JS issues and switch to `textContent`
* use `addEventListener` instead of the onload event
* use `querySelector` and `querySelectorAll`
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
The 1 pixel dotted border that is drawn around every Cppcheck error
message adds 2 extra pixels for every line with an error message.
For more than very few error messages in a file the discrepancy is
clearly visible and line numbering gets wrong.
This commit removes the dotted border as it is not necessary.
The error message is highlighted with a red background and is still
clearly visible.
The error that pylint does not find HtmlFormatter in pygments.formatters
is known and the common solution is to suppress this error.
See https://github.com/PyCQA/pylint/issues/491
Add HTML validation with HTML Tidy for the resulting files index.html
and stats.html.
Fix syntax errors found by the validator.
Fix that the links in the footer are not clickable by removing the
"height: 75%;" style for the classes "menu" and "menu_index".
Add some line breaks to the HTML output for better readability and for
easier debugging.
* htmlreport/check.sh: Remove check with obsolete file
gui/test/data/xmlfiles/xmlreport_v1.xml has been removed with commit
d95efc44c7
* .travis.yml: Enable htmlreport test again
* cppcheck-htmlreport: Fall back to guessing lexer from file content
If the lexer can not be guessed from the file extension (for example
for *.tpp) then guess the lexer that should be used from the content.
This fixes "ERROR: *" output when running "htmlreport/check.sh"
Also use specific exceptions instead of bare ones.
When source code contains non-ASCII characters, `cppcheck-htmlreport`
currently dies with an error like:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019'
in position 80673: ordinal not in range(128)
This is because even though the source code is read as UTF-8, and
HTML_HEAD specifies that the file should be read as UTF-8, the output
file is opened with the default encoding (ascii).
For those files that we can't decode, don't generate a html-preview but note into index.html that we couldn't process the file.
At the end, summarize on which files we failed and suggest using --source-encoding option.