Commit Graph

121 Commits

Author SHA1 Message Date
Oliver Stöneberg 0ed98c8f29
removed unused test files () 2022-12-18 19:36:37 +01:00
omarandlorraine 6488650d24
use python3 on debians too ()
* 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
Oliver Stöneberg eab60668fd
htmlreport/check.sh: use less heavy input for tests () 2022-08-29 12:26:10 +02:00
Patrick Oppenlander d7317b4f8a
fix html report generation with pygments >= 2.12.0 ()
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 ()
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 () 2022-01-12 22:07:12 +01:00
afestini 0841e47075
Various changes ()
* 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
Oliver Stöneberg f3a66a24ab
htmlreport/check.sh: use less heavy input folder to reduce scriptcheck build times () 2021-12-15 20:53:10 +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 98335e5d5f
moved more tests from Travis to GitHub actions () 2021-04-09 07:47:11 +02:00
Oliver Stöneberg b472b4e65d
some Python cleanups based on PyCharm inspections ()
* 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
Rikard Falkeborn c6036f8704
travis: Test htmlreport with python2 and python3 () 2020-11-04 21:03:46 +01:00
jlguardi 82047ea282
cppcheck-htmlreport: Support for multiple input files and fixed stdin… () 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 htmlreport: fix sticky sidebar ()
* 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 ()
* 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 : htmlreport: Line number position is shifted ()
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 ()
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 ()
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 ()
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 ()
* 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 ()
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 () 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 () 2019-05-11 09:50:28 +02:00
Malcolm Parsons 344424b759 cppcheck-htmlreport: Handle errors with multiple locations () 2018-11-23 11:58:19 +01:00
Malcolm Parsons 0af866c9ba test_htmlreport: cppcheck no longer supports XML file version 1 () 2018-11-22 13:28:01 +01:00
Ayaz Salikhov 2dd6168258 Improve Python code 2017-06-04 22:51:48 +02: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
Erik Hovland 229a5bfc99 Update the setup.py to current pythonic norms and add Pygments to install_requires. 2016-08-24 10:41:41 -07:00
Erik Hovland c3564966a2 cppcheck-htmlreport requires Pygments. 2016-08-24 10:40:54 -07:00
Matthias Krüger c2ae976412 remove XML 1 test from htmlreports check.sh 2016-08-07 15:42:24 +02:00
Daniel Marjamäki 85c7456546 http://cppcheck.sourceforge.net => http://cppcheck.net 2016-06-05 18:17:47 +02:00
amai2012 3a6e33d58e Add python 2.7+ requirement (see https://github.com/danmar/cppcheck/pull/751) 2016-05-11 11:58:05 +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 . 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