Commit Graph

282 Commits

Author SHA1 Message Date
Sebastian cc34fee989
.travis.yml: Add *.json file validation (#2362) 2019-11-21 09:12:25 +01:00
Sebastian 4f1db90367
naming.py: Fix FP for constructors/destructors (#2375) 2019-11-18 18:41:57 +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 e9bc62d5b4 .travis.yml: Install pygments via pip instead of apt (#2318)
This way we should get a newer version of pygments.
2019-11-01 09:10:10 +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
Sebastian ec521fba36
donate-cpu-server.py: Upgrade to work with Python 3 (drop Python 2 support) (#2292)
* donate-cpu-server.py: Use tools to prepare code to work with Python 3

The following commands were used for these changes:
futurize -1 -w donate-cpu-server.py
2to3 -w donate-cpu-server.py

* Make the server work under Python 3

Manually fixed the Unicode issues. Received data is decoded, sent data
is encoded.

* Add backward compatible type hints (in comments)

This enables better static analysis and suggestions in an IDE.

* Fix Pylint warning "Comparison to literal"

* .travis.yml: Fix/enhance pylint verification and Python compilation

donate-cpu-server.py is only Python 3 compatible, so it must be ignored
for pylint verification under Python 2.
All Python scripts that were verified with pylint under Python 2 are
now also verified with pylint under Python 3.

* donate-cpu-server.py: Add shebang and mark script as executable

* start_donate_cpu_server_test_local.sh: Directly execute server

Since the server script is executable now and has a shebang it can
be directly executed.

* Use Python 3.0 function annotations instead of comment type hints

Reference: https://www.python.org/dev/peps/pep-3107/
2019-10-26 21:10:21 +02:00
Sebastian 8fb794e731
libsigc++.cfg: Add configuration for library libsigc++ (#2291)
* libsigc++.cfg: Add configuration for library libsigc++

Reference: https://libsigcplusplus.github.io/libsigcplusplus/

* Make code compatible with libsigc++-2.0 instead of 3.0

Since Version 3.0 C++14 is required which is not (fully) supported in
some older GCC versions.
2019-10-26 17:37:14 +02:00
Oliver Stöneberg 3db828b46e print stack trace for UBSAN errors / enabled detect_stack_use_after_return for ASAN (#2252) 2019-10-16 13:46:23 +02:00
Daniel Marjamäki 3c085fd88a Fixed #9359 (SymbolDatabase: function lookup fails when -funsigned-char is used) 2019-10-06 12:05:58 +02:00
amai2012 6c9839a585 Validate rules files 2019-09-21 21:42:13 +02:00
Sebastian 7d26a694da
.travis.yml: Run addon tests also with Python 3 (#2185)
Python 3 does not search parent directories of the initially executed
script for modules imported by modules in this parent directory by
default. So simply set the PYTHONPATH to the ./addons directory. Thus
all scripts are found. It is similar to running the test-*.py script
from the ./addons directory, but this way all the paths in the test-*.py
scripts do not have to be changed (for example to find the cppcheck
executable.
For more details regarding the parent directory issue see for example:
https://stackoverflow.com/questions/11393492/python-package-import-from-parent-directory
For details about the used PYTHONPATH solution see:
https://stackoverflow.com/questions/4580101/python-add-pythonpath-during-command-line-module-run
2019-09-19 20:46:16 +02:00
Sebastian 8207fb7b14
cairo.cfg: Add library configuration/tests/... for cairo library (#2176)
Reference: https://www.cairographics.org/
2019-09-19 08:48:04 +02:00
Paul Fultz II e7ff983fe0 Run cmake tests on travis (#2155)
* Run cmake tests on travis

* Build with tests

* Use correct variable
2019-09-09 21:35:07 +02:00
Sebastian e9231d2eee
.travis.yml: Remove already fixed TODO comment
y2038 addon has been fixed and moved directly to the addons directory. So this comment is no longer necessary.
2019-09-09 21:19:03 +02:00
Sebastian a501f65c8c
libcurl.cfg: Add library configuration for libcurl (#2120)
Add curl_easy_*() functions and deprecated functions with warnings.
Add tests and prepare donate-cpu.py
Reference: https://curl.haxx.se/libcurl/c/
2019-08-29 15:11:59 +02:00
Sebastian 8782a5f5e4
lua.cfg: Add Lua C API library configuration with tests (#2119) 2019-08-29 11:38:21 +02:00
Sebastian f25dcd5cda
python.cfg: Add Py_CLEAR(), and add initial test file (#2110) 2019-08-24 10:17:23 +02:00
Daniel Marjamäki e24ce5b3ba .travis.yml: The 'make install' now require a FILESDIR parameter 2019-08-17 17:25:41 +02:00
Daniel Marjamäki a17f2a6f05 Compiling/Installing : The CFGDIR parameter was removed. Use FILESDIR instead. 2019-08-17 10:53:07 +02:00
Daniel Marjamäki 1718963d9f Travis: Remove step the check clang sources. We can do this on daca@home. 2019-08-05 11:39:31 +02:00
Daniel Marjamäki e60c4e4768 Travis: Remove step that analyse llvm source code 2019-07-28 08:58:06 +02:00
Georgy Komarov fe2885e430 cert.py: Refactor arguments handling (#2044)
* cert.py: Add '--quiet' option and test

Main sentinel also was required.

* travis.yml: Install pytest with --user

To avoid possible conflicts with system packages later.

* Quickfix
2019-07-26 15:40:25 +02:00
Georgy Komarov fbd7b5180b Update addons structure. Make Y2038 addon works. (#2024)
* Update addons structure. Make Y2038 addon works.

All addons are now located in same directory, where cppcheck-gui is
looking for them.

Y2038 addon has been updated to latest cppcheck version. Output is same
as 303622f01c commit as it described in
README: 303622f01c/addons/y2038/README.

* Clean up .travis.yml

* Update travis.yml paths.

* misra.py: Bring back -P argument for backward compatibility

* Fix paths

* Normalize dumpfile paths tpo cppcheck format

* Fixup 3 test.

* Add arguments regression test.

* Fixing travis build
2019-07-26 06:38:03 +02:00
Daniel Marjamäki 3458692cc7 Travis: Remove Precise job because they are decommisioning that environment :-( 2019-07-25 22:30:44 +02:00
Sebastian 8f92c43567
.travis.yml: Check more Python scripts with pylint (#2019)
Use renamed pylintrc file that is only meant for Travis checks.

Check all Python scripts in 'addons', 'htmlreport' and 'tools'

Errors for `_socketobject` class are disabled, see
https://stackoverflow.com/questions/10300082/how-to-prevent-python-pylint-complaining-about-socket-class-sendall-method

Install imported modules `unittest2` and `pexpect` via pip.

Add "./addons" to search-path for modules because
"tools/compare-ast-clang-and-cppcheck.py" imports cppcheckdata.py from
addons. Pylint does not seem to evaluate
`sys.path.insert(0, '../addons')` in the script. So an `init-hook` is
necessary in pylintrc_travis.
2019-07-24 21:09:53 +02:00
amai2012 453de18101
Run pylint on addons providing a buld breaker on travis (#2011)
* Run pylint (using a pylintrc file) on the addon Python scripts. It serves as a build breaker for severe issues.
* Skip y2038 addon for now until it's fixed.
2019-07-18 20:51:58 +02:00
Georgy Komarov 413a5a4865 MISRA: Fix rules suppression, add tests (#1996)
* MISRA: Fix suppressed rules line numbers

Line numbers represented as strings in lxml ETree, but we use it in
integer comparison later.

* MISRA: Use standard library function instead file_prefix.

* MISRA: Use pytest's capsys for capturing, add suppressions tests.

* travis.yml: Update pytest version
2019-07-16 22:32:41 +02:00
Daniel Marjamäki 7e3626c84e Travis: Check the naming conventions again 2019-07-15 20:58:07 +02:00
Daniel Marjamäki bafffa6cf2 Travis: Activate and speedup NONNEG syntax check 2019-07-15 13:01:58 +02:00
Daniel Marjamäki 2cfc2d25bb Travis: Temporarily disable the naming conventions check 2019-07-15 08:14:04 +02:00
Daniel Marjamäki 842f8c569b Travis: remove NONNEG syntax check to limit time 2019-07-15 07:50:02 +02:00
Daniel Marjamäki a9d47d4de2 Travis: Use -std=c++0x in NONNEG compile 2019-07-15 07:15:56 +02:00
Daniel Marjamäki aeefaf7004 Travis: Fix one more 'nonneg' issue 2019-07-14 22:49:37 +02:00
Daniel Marjamäki 593733f522 Travis; Try to fix Travis build. Limit self check of gui code 2019-07-14 22:27:22 +02:00
Daniel Marjamäki 33284be64a Try to fix Travis 2019-07-14 21:56:33 +02:00
Daniel Marjamäki 7be6fbf658 Travis: Reduce execution time 2019-07-14 20:46:50 +02:00
Daniel Marjamäki 0014fe880e Mark members and arguments with 'nonneg' 2019-07-14 12:22:33 +02:00
Daniel Marjamäki 1b4485a738 Makefile: Add one more flag 'MATCHCOMPILER=yes' 2019-06-23 13:43:09 +02:00
Daniel Marjamäki de9c999d79 Better handling of spaces in paths 2019-06-22 19:20:15 +02:00
Georgy Komarov e979b0652c misra.py: Fix up and improve load rules parser. (#1895)
* misra.py: Fixup load rules parser.

* misra.py: Report when rule text is missing in rule-texts file

* misra.py: Allow to skip misra checks not specified in rule-texts.

* misra.py: Remove top-level control flow.

Create separate class that stores settings, instead of global variables.

This is required to perform imports from misra.py for testing purposes.

* misra.py: Add simple pytest test for load rules.

* misra.py: Add document structure tests.

* misra.py: Exit after show rules table.

* misra.py: Add document structure tests.

* misra.py: Fixup import pitfall with python2

* misra.py: Minor fixes
2019-06-17 21:17:29 +02:00
Daniel Marjamäki 54ba9482c6 Travis: Tweak self checking. Only check normal source code folders. 2019-06-15 16:44:34 +02:00
Daniel Marjamäki 181991204a Travis: Improved Cppcheck self check 2019-06-15 14:34:46 +02:00
Daniel Marjamäki b3a46e72dc Fix and test syntaxError suppression 2019-05-01 11:54:13 +02:00
Daniel Marjamäki b0baf4f65b Travis: Fix the cppcheck self-check 2019-04-30 08:56:20 +02:00
Daniel Marjamäki ff8cf4fe25 gui/test: Add projectfile test 2019-04-20 19:07:14 +02:00
Daniel Marjamäki 5a14473963 Disable gui/test again 2019-04-19 14:55:10 +02:00
Daniel Marjamäki 91c000c09d Travis: Try to reactivate the gui/test tests 2019-04-19 11:57:52 +02:00
Daniel Marjamäki bb00435736 Travis: Temporarily disable gui/test until problems are fixed 2019-04-19 11:23:59 +02:00
Daniel Marjamäki 93b27b2022 cleanup gui/test 2019-04-19 09:41:58 +02:00
Daniel Marjamäki 17ec37b366 Run gui tests on Travis 2019-04-19 07:56:10 +02:00
Daniel Marjamäki 0c7d4eb91f Try to fix Travis 2019-04-17 09:04:51 +02:00
Daniel Marjamäki 65d18b3da9 test/cli: refactorings 2019-04-15 10:02:25 +02:00
Daniel Marjamäki 964c2a237a Travis: Try to run the cli testing on Travis 2019-04-14 12:49:43 +02:00
Daniel Marjamäki c47de235f7 Travis: Disable noisy Wshadow warnings 2019-04-10 19:10:05 +02:00
Sebastian 4735b6ca1b
addons/naming.py: Fix crash on unnamed arguments, add regex validation. (#1762)
Crash has been reported in the forum:
https://sourceforge.net/p/cppcheck/discussion/development/thread/138788ac6b/
A small test has been added to avoid regression.
2019-03-26 18:54:09 +01:00
Sebastian d204869d3d
.travis.yml: Add retries to the `apt-get` commands. (#1749)
Travis often fails to update / install the packages via `apt-get` and
jobs must be restarted manually. This should fix the problem or at least
reduce the frequency at which these failures occur.
Details about the problem and the `travis_retry` command can be found
here:
https://blog.travis-ci.com/2013-05-20-network-timeouts-build-retries
2019-03-21 13:51:14 +01:00
Sebastian 597107ac9a
.travis.yml: update to xenial; add jobs for ubsan and asan (#1745)
As tested by @matthiaskrgr in the branch
https://github.com/matthiaskrgr/cppcheck/commits/travis_xenial
Add job to build Cppcheck on Ubuntu 14.04 trusty (same as for precise).
2019-03-20 15:30:01 +01:00
Sebastian 5728bd63af
.travis.yml: Minor fixes of addons execution / documentation (#1739) 2019-03-14 14:49:02 +01:00
Daniel Marjamäki e16d4f4353 Travis: output errors in gcc format in self-checks 2019-03-11 13:34:44 +01:00
Daniel Marjamäki 33a6e26535 Travis: Remove reduce check, tool has been removed. 2019-03-02 12:12:28 +01:00
Sebastian c10ddaef4a
donate-cpu-server.py: Replace syntax that is deprecated in Python 3. (#1712)
The function `iteritems()` of `dict`s is deprecated. The recommended
alternative is to use `items()`, this function also works with Python 2.

The next issue is that lambdas can no longer unpack tuple parameters
in Python 3. It would be possible to use some workaround and still use
a lambda, but using `operator.itemgetter(1)` instead is faster and the
recommended method in such a case.

The syntax is now compatible with Python 2 and 3 but the server script
still does not work with Python 3. For example `socket.recv()` returns
`bytes` in Python 3 and `str` in Python 2. Currently `str` is expected
so it does not work with Python 3.
2019-02-28 13:34:23 +01:00
Sebastian b2bb8daaca
.travis.yml: Check python syntax (version 2 and 3) (#1694)
As suggested by rikardfalkeborn here:
https://github.com/danmar/cppcheck/pull/1679#issuecomment-465927692
By compiling python scripts the syntax can be checked.
There are two compilations, one for Python 2 and one for Python 3 for
most scripts to make sure at least the syntax is valid for both
versions.
2019-02-25 16:11:14 +01:00
Sebastian c106dd2939
misra addon: Fix issue with unexpected encodings in loadRuleTexts() (trac 8946) (#1608)
https://trac.cppcheck.net/ticket/8946
Add tests to travis script for verifying rule text loading.
Add dummy rule text files.
misra.py: Try to find a suitable codec for rule texts file.
2019-01-18 21:30:08 +01:00
Daniel Marjamäki 0c08503b00 Travis: Enable missingOverride checker 2019-01-13 12:21:01 +01:00
Matthias Krüger d45e4287e6 travis: and job that builds on osx 2019-01-13 11:52:01 +01:00
Matthias Krüger 6eca26a4cf travis: add job making sure cppcheck builds on ubuntu precise (12.04) with gcc and clang 2019-01-12 21:09:04 +01:00
Daniel Marjamäki e6edd74099 Temporarily suppress Cppcheck false positives 2019-01-12 19:11:44 +01:00
Matthias Krüger c334d959ce travis: dmake job: don't redundatly install ubuntu packages 2019-01-12 13:22:54 +01:00
Sebastian 1042208c2c
triage: Fix warnings and Windows issues; some enhancements (#1591)
Changes:
- Fixed compiler warnings
- Add "*.*" to file open menu so files without suffix can be opened
- Make it work under Windows
- Make wget() and unpackArchive() methods so they can access the UI
- wget() and unpackArchive() use the new method runProcess() now that also does some error handling
- Errors are shown in the status bar for easier debugging / usage
- Add readme.txt
- Let travis build the triage tool
2019-01-12 09:16:43 +01:00
Matthias Krüger 63d9144f60 travis: refactor config, spawn llvm, clang and dmake jobs directly and remove env var hacks. (#1565)
* travis: refactor config, spawn llvm, clang and dmake jobs directly and remove env var hacks.
* travis: make sure cxxflags of travis match those in the makefile
* travis: move tests that run independant of CXXFLAGS into their own job
2019-01-09 09:54:46 +01:00
amai2012 cc4ca7525a
Clean up redundant actions in travis jobs (#1563)
* Clean up redundant actions in travis jobs.
* Drop validatePlatforms from Makefile target checkcfg
* Print out CPU count. Adjust parameters for parallel jobs to 2 - the current result.
2019-01-05 11:12:32 +01:00
amai2012 c10db6c73b
Try to run CMake (#1555) 2019-01-02 00:01:15 +01:00
Matthias Krüger b5e83d03fe travis: remove "sudo required" as it is being deprecated. 2018-11-24 12:51:33 +01:00
Daniel Marjamäki 1048aa8ead Disable Wshadow warnings
[ci skip]
2018-11-23 22:34:21 +01:00
Daniel Marjamäki 1fd7ea91e0 Revert "travis: reduce log output when checking clang"
This reverts commit 8efa405552.
2018-11-19 15:11:59 +01:00
Daniel Marjamäki 8efa405552 travis: reduce log output when checking clang 2018-11-19 14:29:12 +01:00
Thorsten Sick 43b6a391d8 Added a new naming check addon. Also verifies variable and function p… (#1456)
* Added a new naming check addon. Also verifies variable and function prefixes

* Verification added to code

* added naming checks ng selftest to travis file

* Ensure zero exit value for tests if tests succeed

* Expected values adjusted

* Fixed copy and paste error
2018-11-06 20:46:07 +01:00
amai2012 39c2625789 Run check for missing CWE entries on travis. 2018-10-22 13:14:48 +02:00
Matthias Krüger df32b0fb05 travis: reenable llvm and clang checks 2018-10-16 22:01:52 +02:00
Daniel Marjamäki 1245a036f7 Add check for shadow variables 2018-10-16 20:17:27 +02:00
amai2012 b6103d15a6 #8711 Run Makefile target validateXML on travis 2018-09-24 14:27:02 +02:00
Sebastian dce3281766
addons/cert.py: Add MSC30-C: Do not use rand() (#1348)
Add function isStandardFunction() that checks if the given function is a standard function.
Only when this function returns true for the currently checked rand() tokens it is reported as a violation.
Tests added for C and C++.
2018-08-24 15:05:50 +02:00
Matthias Krüger cfd5460670 travis: update clang and llvm repo hashes. 2018-08-12 11:17:24 +02:00
Sebastian 788ad0fc1f
Travis: Parallelize naming.py calls. (#1317)
naming.py is called parallel (4 times at a time) for all *.cpp.dump files directly in gui/ and lib/.
@matthiaskrgr had the idea for it: e46c499f5a (commitcomment-29717495)
Files in gui/test are now ignored already when creating the .dump files.
According to the Travis log output these changes speed up the Travis build up to three minutes.
2018-07-19 08:43:23 +02:00
Matthias Krüger e46c499f5a travis: when checking variable naming convention, run cppcheck with 2 threads instead of one. 2018-07-16 10:52:40 +02:00
Sebastian 5cc8da2db4
cfg/runtests.sh: Check syntax of defines in configuration files. (#1303)
travis: Add xmlstarlet package used by cfg/runtests.sh
2018-07-12 08:40:26 +02:00
Daniel Marjamäki a660ccaec8 Travis: Ensure naming convention in GUI 2018-06-18 14:23:28 +02:00
Daniel Marjamäki 68a91b73da Travis: Enforce naming convention, private variable names must start with 'm[A-Z]' 2018-06-18 09:55:43 +02:00
amai2012 453c663fb0
#8611 Rename xmlV2.rng. Renaming it to cppcheck-errors.rng (#1278) 2018-06-06 15:25:09 +02:00
amai2012 978bc7c150 Activate validation of --errorlist output (#1248) 2018-05-20 14:54:38 +02:00
amai2012 e2ea82908a #5718: temporarily disable make validateXMLV2 on travis 2018-05-17 13:48:06 +02:00
amai2012 64f0d31280 #5718 Supply DTD/XSD/RNG for cppcheck XML output - supply rng for current XML output. Add an automatic check on travis against the --errorlist output 2018-05-17 12:46:15 +02:00
Daniel Marjamäki e0a6ab1a0f activate misra regression tests 2018-05-16 11:13:25 +02:00
Matthias Krüger 9949768d7c travis: install wx-common which is used in test/cfg/runtests.sh 2018-05-13 12:32:19 +02:00
Matthias Krüger 547934b5a5 travis: use $CPPCHECK global containing absolute path to cppcheck executable 2018-05-13 12:32:14 +02:00
Matthias Krüger 1a1bb10511 travis: add misra tests to ci 2018-05-12 00:50:05 +02:00
Matthias Krüger 73a9f05a73 travis: update commits of the clang/llvm repo we are checking during CI
I had to reduce cppchecks stdout amount a bit and suppress unreadVariable warnings to not hit the 4MB log file limit on travis while checking llvm/clang.
2018-05-10 14:46:09 +02:00
Matthias Krüger ef574987d5 travis: also honor suppressions when checking cppcheck-gui code. 2018-04-27 13:10:42 +02:00
Daniel Marjamäki dffad3b3d1 Remove some more cxx11emu.h references 2018-04-10 06:52:33 +02:00