* use python3 on debians too
in Debian 11 which is Bullseye, /usr/bin/python is a Python2
interpreter, which means that cppcheck-htmlreport fails to run here.
So I've chenged the shebang to use python3
* change all shebangs from python to python3
Co-authored-by: Sam M W <smw@alertergroup.co.uk>
pygments 2.12.0 changed the signature of the HtmlFormatter.wrap()
method. As we don't actually care about the arguments to wrap we can
use packing/unpacking to maintain compatability with older versions of
pygments.
Some plugins of cppcheck may use error ids that are not valid css
selectors. When the javascript script of htmlreport tries to use these
ids as selectors to display/hide categories of errors, this produces an
error inside the user's browser. The solution is to transform the error
ids that will be used as selectors in order to remove the invalid
characters. This transformation doesn't apply to what is displayed,
so that from a reader point of view, nothing is changed.
Signed-off-by: Cilyan Olowen <gaknar@gmail.com>
* Various changes
-CSS grid layout
-scrollbars
-fixed header/footer
-severity filtering
-double escaped XML entities
-git blame fix and cmd line config
-"Toggle All" behavior
* Fixed table columns
Using visibility: collapse to hide entries without affecting
table/column width for more "stable" look when filtering
* Fix subprocess.check_output for Linux
* Filter by tool
Co-authored-by: afestini <afestini@gmail.com>
Co-authored-by: Alexander Festini <alexander.festini@technica-engineering.de>
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.