95 Commits

Author SHA1 Message Date
Sebastian
c990d10ffa
Check for JSON error when parsing addon .json files + fixes (#2374)
* cppcheck.cpp: Check for JSON error when parsing addon .json files

This fixes that errors in JSON files given via `--addon=*.json` are
silently ignored and maybe only a part of the JSON file is used.
Now the error message which picojson can return is checked and a
corresponding error message is returned again by getAddonInfo().

* naming.json: Fix missing comma

* CLI: Fix naming violations detected by addon naming.py via naming.json

* Addon naming: Add argument for validating names of constants

* LIB: Rename functions/variables so they are valid, loosen naming rules

* GUI: Fix naming violations
2019-11-20 15:37:09 +01:00
Oliver Stöneberg
eac040a00b Various clang-tidy fixes (#2192)
* use range loops

* removed redundant string initializations

* use nullptr

* use proper boolean false

* removed unnecessary continue from end of loop

* removed unnecessary c_str() usage

* use emplace_back()

* removed redundant void arguments
2019-09-25 15:25:19 +02:00
Oliver Stöneberg
de9f489b08 use range loops / constness (#2181)
* use range loops / constness

* platform.cpp: avoid shadowed variable
2019-09-19 20:29:33 +02:00
Daniel Marjamäki
8855978f8a Import project: Ignoring paths better 2019-09-12 09:32:24 +02:00
Daniel Marjamäki
0fbbe2ff23 Refactor load/write of cppcheck project. Reuse same string constants in cli and gui. 2019-08-09 21:15:02 +02:00
Daniel Marjamäki
3ec45acc43 astyle formatting
[ci skip]
2019-07-24 08:22:12 +02:00
Daniel Marjamäki
680fbfe612 Fix Cppcheck warning, unused value 2019-07-23 14:10:34 +02:00
Daniel Marjamäki
681bd0a911 GUI: Better settings for extended safe checks 2019-07-23 11:54:38 +02:00
Daniel Marjamäki
c97dc79815 --addon: Use json for addon output 2019-06-24 19:29:43 +02:00
Daniel Marjamäki
d69f002757 Fixed Cppcheck shadowVar warning 2019-04-30 20:19:21 +02:00
Daniel Marjamäki
ece13033b2 dmake: use -isystem for externals to avoid compiler warnings 2019-04-19 14:52:49 +02:00
Daniel Marjamäki
f26b15e5b5 astyle formatting
[ci skip]
2019-04-16 19:07:44 +02:00
bbennetts
7287ffe781 Handle 'arguments' sections in compile_commands.json (#1797)
* Handle 'arguments' sections in compile_commands.json

Previous code assumes 'commands' exists and ill assert if t does not.

* Correct typo checking for "arguments" rather than "commands"

* Use ostringstring rather than stringstream

* Add test deominstrating graceful degradation

* Add test for parsing "arguments" rather than "commands"
2019-04-15 20:03:42 +02:00
Daniel Marjamäki
83f8d7fab9 test/cli: Improved proj2 testing. fixed bug for relative path when vs-solution is imported with relative path 2019-04-15 19:00:57 +02:00
Daniel Marjamäki
15eba39963 test/cli: better handling of absolute ignored paths 2019-04-15 08:48:58 +02:00
Daniel Marjamäki
0cc2b5ca14 Fix wrong assignment 2019-04-14 07:27:23 +02:00
Daniel Marjamäki
a0dd853642 analyzing one vs config (first debug config that matches platform) 2019-04-13 20:01:40 +02:00
Daniel Marjamäki
dfe417c369 msvc compatibility: /constexpr/const/ 2019-04-11 21:06:37 +02:00
Daniel Marjamäki
c9172b169a Improved handling of paths when importing cppcheck gui project 2019-04-11 21:02:49 +02:00
Daniel Marjamäki
7ede0feb2c Better handling for excluded paths 2019-04-11 18:46:57 +02:00
Daniel Marjamäki
e27b54664e appveyor: /constexpr/const/ 2019-04-10 19:15:56 +02:00
Daniel Marjamäki
42fdb1f826 ImportProject: checkHeaders, checkUnusedTemplates, maxCtuDepth 2019-04-10 17:04:18 +02:00
Daniel Marjamäki
bf9006737a Addons: Adding support in Cppcheck CLI to execute addons 2019-04-07 17:01:59 +02:00
Daniel Marjamäki
6d7ec98dd6 Import Project: import suppressions from gui project 2019-04-07 13:15:25 +02:00
Daniel Marjamäki
111db91387 ImportProject: Import excluded paths properly 2019-04-07 12:31:52 +02:00
Daniel Marjamäki
3701db96a3 Refactoring; use range for loop 2019-04-07 11:58:42 +02:00
Daniel Marjamäki
4a45655bc2 astyle formatting
[ci skip]
2019-03-27 18:15:12 +01:00
Oliver Stöneberg
88dc74929a Add defines set by compiler options when using compilation database (#1763)
* Add defines set by compiler options when using compilation database

sets __cplusplus and __STDC_VERSION__ based on -std and the defines for -municode, -fpie, -fPIE, -fpic and -fPIC

* Fixed merge
2019-03-27 10:23:04 +01:00
Daniel Marjamäki
7c6f21a158 astyle formatting 2019-03-26 20:51:04 +01:00
firewave
ce11778a20 fixed parsing of -std= in compilation database 2019-03-26 19:02:08 +01:00
Daniel Marjamäki
bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki
8925299947 Attempt to fix MSVC compile issue 2019-02-01 00:09:07 +01:00
Daniel Marjamäki
53967c83e9 Fixed compile error 2019-01-31 23:52:48 +01:00
Daniel Marjamäki
961f66baff Fixed #8820 (import GUI project)
This has basic handling of GUI projects. But further work will be needed to handle addons etc, the plan is that we will be able to run addons from the command line soon.
2019-01-31 20:40:21 +01:00
Daniel Marjamäki
91435310cb Fixed #8925 (compile_commands.json: False positives in .mm (Objective-C++) files, that file type should maybe just be ignored) 2019-01-21 06:36:31 +01:00
Daniel Marjamäki
c6b48b67f9 astyle formatting
[ci skip]
2019-01-11 16:37:12 +01:00
juremenart
45def06d59 fix trailing / from CMAKE JSON file and update unittests to cover both (w and w/o cases) (#1592)
* fix for CMake compile_commands.json input - director does not include trailing / which makes include directories wrong - so add it if it doesnt exist

* fix the bugfix for trailing / in the directory name of CMAKE JSON file, add also new test case to see if it works in both cases (with and without trailing /)

* revert adding accidental new line
2019-01-11 16:36:55 +01:00
Daniel Marjamäki
ea0232653f Fixed #8563 (CPPCheck not able to locate file through compilation database) 2019-01-05 23:11:43 +01:00
Daniel Marjamäki
5f5c33baf2 Json: Use simple json library picojson to read compile databases 2019-01-05 17:45:07 +01:00
Daniel Marjamäki
86f9fb778b Fixed #8864 (compile commands: handle define with string value) 2018-11-25 15:09:23 +01:00
Daniel Marjamäki
c7e5176284 Fixed #8061 (Problems with handling of --project argument) 2018-08-31 16:06:52 +02:00
Daniel Marjamäki
a30941d885 Refactoring; Use range for loops 2018-08-19 17:27:41 +02:00
firewave
01ceb9bae7 fixed issue 8661: Misleading error message when compilation database is not recognized 2018-07-25 16:26:25 +02:00
amai2012
f947b3b025 Fix some doxygen warnings 2018-06-07 08:33:32 +02:00
bwoester
9b28499412 Import BCB6 projects (#1245)
* added support for reading borland c++ builder 6 projects

* add: fetch sysdefines from project
add: start providing bcb6 predefines (WIP)

* configure all the internal defines for BCB6

* make sure define strings don't start with ';'

* improvements on bwoesters BCB6 project support

- improved `*.bpr` XML handling by reducing the number of loops
- added `const` where aplicable
- optimized compiler argument parser performance
- reformatted code with provided astyle config

* - undo looping (keep it the same as the other implementations)
- keep parsing of cflags simple and separate from the synonym cleanup (no need for micro optimization in this place)
- move input validation to FileSettings::setDefines
- re-run astyle

* use [] instead of at() when comparing characters
2018-05-20 18:19:20 +02:00
PKEuS
d2146844dd Refactorizations:
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
Daniel Marjamäki
4836df9b1d Fix Token::Match pattern 2018-04-05 15:47:25 +02:00
Daniel Marjamäki
e5db23fff3 project: import compile_commands.json generated by compiledb-generator 2018-04-05 15:40:59 +02:00
jrp2014
b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
Daniel Marjamäki
7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00