Commit Graph

93 Commits

Author SHA1 Message Date
omarandlorraine 6488650d24
use python3 on debians too (#3812)
* 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>
2022-11-03 22:14:30 +01:00
Patrick Oppenlander d7317b4f8a
fix html report generation with pygments >= 2.12.0 (#4110)
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.
2022-05-16 12:58:54 +02:00
Cilyan Olowen 8b76a109ce
Fix invalid css selectors in htmlreport (#3989)
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>
2022-04-08 21:12:26 +02:00
afestini 423c4f8207
Htmlreport changes (#3690) 2022-01-12 22:07:12 +01:00
afestini 0841e47075
Various changes (#3622)
* 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>
2021-12-15 20:57:06 +01:00
Daniel Marjamäki ca047e57bf Switch from http to https on our sourceforge webpage 2021-08-28 12:46:54 +02:00
Daniel Marjamäki e6cf4cad87 htmlreport: indentation 2021-08-09 20:32:24 +02:00
Daniel Marjamäki c48fc9ef89 htmlreport: add author information 2021-08-09 20:23:40 +02:00
Oliver Stöneberg b472b4e65d
some Python cleanups based on PyCharm inspections (#2999)
* some Python cleanups based on PyCharm inspections

* test-helloworld.py: adjusted assert in test_addon_relative_path()
2021-01-31 14:27:11 +01:00
jlguardi 82047ea282
cppcheck-htmlreport: Support for multiple input files and fixed stdin… (#2822) 2020-09-25 20:12:41 +02:00
versat a6deae5f94 htmlreport: Fix source view with leading empty lines
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.
2020-01-21 09:13:55 +01:00
versat 55f88f21a3 htmlreport: Fix shifted line number position for inconclusive messages
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.
2020-01-20 15:43:22 +01:00
XhmikosR e17863c216 Fix #9574 htmlreport: fix sticky sidebar (#2495)
* 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
2020-01-20 15:25:12 +01:00
Sebastian 103532bb03
Update cppcheck-htmlreport (#2494)
* 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>
2020-01-18 01:49:46 +01:00
Sebastian bca5d0d820 Fix #9501: htmlreport: Line number position is shifted (#2480)
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.
2020-01-09 08:45:54 +01:00
Sebastian 61286392d9 htmlreport: Also check "cppcheck-htmlreport" with pylint on Travis (#2326)
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
2019-11-04 15:44:13 +01:00
Sebastian 4f927ea6c7
htmlreport: Add HTML validation and fix syntax errors (#2317)
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.
2019-11-01 15:06:44 +01:00
Sebastian db7cddf163 cppcheck-htmlreport: Fix premature end of loop in statistics output (#2313)
This issue and also a fix has been reported by Lionel Gimbert in the forum:
https://sourceforge.net/p/cppcheck/discussion/development/thread/d18fb312ee/
All credit goes to him.
2019-10-31 09:26:43 +01:00
Sebastian 816aa7e211
Fix and re-enable htmlreport tests (#2310)
* 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.
2019-10-30 18:01:39 +01:00
tititiou36 40f76b9bc0 Update cppcheck-htmlreport (#1858)
Line 632 generates 5 <td>, so there is no point in restricting to colspan='4' everywhere else.
Use the full width available.
2019-05-30 10:37:52 +02:00
fuzzelhjb 2e93df13cf add "toggle all" to the html report (#1849) 2019-05-24 10:45:45 +02:00
Martin Herren 8298937077 [cppcheck-htmlreport] Use makedirs instead of mkdir to create report_dir to allow recursive creation of the full directory path (#1829) 2019-05-11 09:50:28 +02:00
Malcolm Parsons 344424b759 cppcheck-htmlreport: Handle errors with multiple locations (#1488) 2018-11-23 11:58:19 +01:00
Matthias Schmieder cc8e80e03f removed ‘has_key’ function and used ‘in’ instead to make the code python2 and python3 compatible 2017-05-27 11:29:44 +02:00
Abigail 55733fb987 Write HTML report as UTF-8
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).
2017-05-27 10:20:45 +02:00
Daniel Marjamäki 85c7456546 http://cppcheck.sourceforge.net => http://cppcheck.net 2016-06-05 18:17:47 +02:00
Boris Egorov cbb4b1bb22 htmlreport: Add checkboxes to toggle error visibility by id 2016-03-11 11:20:44 +06:00
Boris Egorov e4f81ba755 htmlreport: Few style fixes
* Fix wrong indentation
* Use single quotes for consistency
* It is fine to substitute %s with empty str
2016-03-11 11:12:52 +06:00
Boris Egorov ab75b047b0 htmlreport: Do not recalculate stat counters 2016-03-11 10:55:35 +06:00
Matthias Krüger 542d610d4e htmlreport: add support for CWE ids 2016-02-28 10:08:54 +01:00
XhmikosR c090ed2fc9 PEP8 fixes.
[ci skip]
2015-04-20 21:11:45 +03:00
Matthias Krüger 2681b0e56e htmlreport: show statistics; top 10 files with the most findings for each severity (style, error, warning, portability etc). Partly addresses #1019. 2015-04-20 09:30:43 +02:00
Matthias Krüger 7ef74924e1 htmlreport: pep8 fixes 2015-03-20 09:32:16 +01:00
Matthias Krüger 0ffa81dd8a htmlreport: show filename of currently viewed file in defect list 2015-03-10 13:59:32 +01:00
Matthias Krüger 8fff48ed7b htmlreport: don't just hang if --file is not specified. Print a warning and exit. 2015-03-05 18:33:46 +01:00
Matthias Krüger fad50de311 htmlreport: fix errors when unmatched suppressions are reported via --enable=information. Incorporate tests. 2015-03-05 17:09:19 +01:00
Matthias Krüger e730f525ae htmlreport: only include verbose messages if they differ from the regular/actual message. 2014-11-10 12:32:11 +01:00
Matthias Krüger ffe7f57f4c htmlreport: remove link to the forum since it is no longer available. 2014-11-08 23:57:55 +01:00
Samuel Degrande ab6178f739 HTML report: display 'verbose' message using clickable expandable divs 2014-10-15 21:49:22 +02:00
Matthias Krüger f5c872ed52 htmlreport: stats: display total number of warnings/errors. 2014-07-30 01:27:50 +02:00
vBm ef0a4e87cb Some minor PEP8 fixes 2014-07-29 13:56:31 +02:00
Matthias Krüger da319b7485 htmlreport: stats: sort primary by occurrences but if several IDs occur equally often, sort them alphabetically. 2014-07-24 16:35:57 +02:00
Matthias Krüger f58873a9d6 htmlreport: on the index page, print stats of which warning ID occured how often. 2014-07-23 12:37:21 +02:00
Matthias Krüger ae0c1f7112 htmlreport: don't crash when pygments fails to determine filetype of a file we want to highlight. This happens for files with no extension (for example "foo" instead of "foo.c"). 2014-07-22 14:20:01 +02:00
Matthias Krüger 90b41aa672 htmlreport: if no arguments are passed, print --help output; when done generating the report, print where index.html is (take report_dir into account). 2014-07-22 14:11:19 +02:00
Matthias Krüger d718793540 htmlreport: sort error-data per line (in index.html page as well as in the defect list of the respective files.) 2014-07-21 21:48:16 +02:00
Matthias Krüger 46a0ab1754 htmlreport: fix #5998, crash on some files with "UnicodeDecodeError".
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.
2014-07-21 01:41:26 +02:00
Steven Myint ed73c3a026 Fix bad indentation 2014-07-18 11:09:12 -07:00
Matthias Krüger fadf9baf46 htmlreport: fix #5963, handle inconclusive messages and underlay them in grey color. 2014-07-17 23:05:00 +02:00
Toralf Förster 91fa452020 cppcheck-htmlreport: print the cppcheck version in every footer
missed in 2d4bae0

Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
2014-06-23 19:13:17 +02:00