Commit Graph

107 Commits

Author SHA1 Message Date
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
Malcolm Parsons 0af866c9ba test_htmlreport: cppcheck no longer supports XML file version 1 (#1487) 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 #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
Toralf Förster d3a71916aa htmlreport: Use source_encoding to open XML files 2014-06-18 22:13:26 +02:00
Matthias Krüger fdc717c6ea htmlreport: remove black background, make the report a bit more space efficient. 2014-06-05 23:00:54 +02:00
Matthias Krüger 275e2501ff htmlreport: fix syntax highlighting broken in ca4a0af840. 2014-06-05 22:10:32 +02:00