Commit Graph

181 Commits

Author SHA1 Message Date
Oliver Stöneberg e766fba813
fixed tests by adjusting results for `picojson` update (#5729)
The tests which are failing were in introduced in #5712. Those were not
included in #5710 which updated `picojson` that resulted in the
different lines being reported in the error messages.

I also added some checks to `ScopeFile` which will indicate that a
temporary file already exists highlighting multi-threading issues and
leftover files from previously aborted testruns. I ran into his while
looking into these failing tests
2023-12-05 20:39:26 +01:00
Oliver Stöneberg ec9dbb31f4
testrunner: make sure all redirected output is being consumed / some cleanups (#5714) 2023-12-01 20:56:30 +01:00
Oliver Stöneberg 3272a2bbe7
greatly improved `Settings::loadCppcheckCfg()` error handling (#5712)
This also fixes the issue that `cppcheck.cfg` is no longer being loaded
from executable path. That was introduced by #5704.
2023-12-01 16:34:14 +01:00
Oliver Stöneberg 237bed8a91
CmdLineParser: made some options exclusive (#5704) 2023-12-01 14:19:47 +01:00
Oliver Stöneberg a937862a5d
CmdLineParser: return enum from `parseFromArgs()` instead of using additional member (#5698) 2023-11-27 12:06:03 +01:00
Oliver Stöneberg 8e1ae7e412
CmdLineParser: various refactorings and cleanups as well as testing improvements (#5676) 2023-11-25 21:12:24 +01:00
Oliver Stöneberg 2a15428096
fixed #12059 - added `--fsigned-char` and `--funsigned-char` command-line options (#5580) 2023-11-08 09:28:33 +01:00
Oliver Stöneberg e6d15b17ff
extracted `FileSettings` from `ImportProject` to `filesettings.h` (#5604) 2023-11-02 17:42:41 +01:00
Oliver Stöneberg dd627a2b1d
moved `ImportProject` out of `Settings` and only store `fileSettings` (#5603)
`ImportProject` is not needed outside of the command-line parsing so we
do not need it inside the `Settings` at all. We only use the
`fileSettings` in the executors.
2023-11-01 21:08:30 +01:00
Oliver Stöneberg 7086ffaa1b
fixed #12045 - print error when using an option which has not been compiled in instead of treating it as non-existent or a no-op (#5508)
Also disabled more internal code around those options and did some
cleanups.
2023-10-21 09:12:59 +02:00
Oliver Stöneberg 3811d01498
fixed "Redundant dereferencing and tasking address expression" Rider warnings (#5563) 2023-10-16 14:09:03 +02:00
Oliver Stöneberg 5e89eb05a6
iwyu.yml: made `include-what-you-use` output more verbose / cleaned up includes (#5540) 2023-10-16 12:57:49 +02:00
Oliver Stöneberg ebb877adcc
gui/platforms.h: renamed `Platform` to `PlatformData` / Platform: removed unnecessary `cppcheck` namespace (#5545) 2023-10-13 16:02:04 +02:00
Oliver Stöneberg 7393083d5d
added `CmdLineLogger::printRaw()` / CppCheckExecutor: more `CmdLineLogger` usage (#5537) 2023-10-09 22:22:39 +02:00
Oliver Stöneberg 06b5ef1e4d
cleaned up includes based on include-what-you-use (#5532) 2023-10-09 10:07:20 +02:00
Oliver Stöneberg 0f28f3e493
generate `AddonInfo` only once (#4958)
Currently the `AddonInfo` is generated and discarded on each addon
invocation. This leads to an unnecessary process invocation for each
addon on each file.

Also if an addon is completely broken we will still perform the whole
analysis only for it to be failed at the end so we should bail out early
if we know it doesn't work at all.
2023-10-08 21:28:57 +02:00
Oliver Stöneberg 3ba53c6b6a
fixed #12022 - disallow using `--project` with source files (#5515) 2023-10-08 09:07:15 +02:00
Oliver Stöneberg 5a52fa80fb
refs #12022 - disallow multiple `--project` options (#5499) 2023-10-05 21:36:44 +02:00
Oliver Stöneberg fc700b68eb
refs #4452 / refs #11705 - improved `--showtime=` behavior and testing (#4876)
This is a step onto leveraging the `ThreadExecutor` implementation for
`ProcessExecutor` which is a follow-up to #4870. We need to have the
proper test coverage and the existing implementations working as
expected before we move to the shared code.

Fixes:
- added `--showtime=` tests for all executor implementations
- only print `--showtime=summary` once at the end
- prevents `--showtime=` by multiple threads to be written at the same
time - essentially breaking the output
- reset the timer results before each test
- deprecated `top5` in favor of `top5_file`
- fixed printing for all executors except `ProcessExecutor`
2023-10-05 19:04:06 +02:00
Oliver Stöneberg 3774d46303
TestCmdlineParser: store messages in logger class instead of utilizing the redirect (#5482) 2023-09-26 21:38:15 +02:00
Oliver Stöneberg 3fd00c19df
perform logging in `CmdLineParser` through an interface (#5478)
This is in preparation of avoiding accessing `std::cout` directly as
well as streamlining and improving the logging during the settings
parsing. There are no functional changes yet.
2023-09-25 13:43:18 +02:00
Oliver Stöneberg f49fedb2ad
fixed #11483 (FN unusedFunction for method with inline implementation) (#5457)
Co-authored-by: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
2023-09-20 14:45:44 +02:00
Oliver Stöneberg 98ce46a3e5
fixed #11919 - Removed deprecated command-line options `--template <template>` and `--template-format=<template>` (#5439) 2023-09-12 22:46:40 +02:00
Oliver Stöneberg 64cd09ab62
fixed #11917 (Default to `native` platform in Windows builds) (#5428) 2023-09-11 11:08:23 +02:00
Oliver Stöneberg 91070ca794
utils.h: added `startsWith()` and started using it (#5381)
This makes the code much more readable. It also makes it less prone to
errors because we do not need to specify the length of the string to
match and the returnvalue is clear.

The code with the bad returnvalue check was never executed and I added a
test to show that.
2023-09-08 19:30:25 +02:00
Oliver Stöneberg 0901e496ed
refs #3450 (CLI --report-progress is currently useless) - added `--report-progress=<val>` to specify interval (#5353) 2023-08-23 11:20:20 +02:00
Oliver Stöneberg c7f88db90a
CmdLineParser: deprecated `--template <template>` and `--template-location <template>` (#5331)
Both are bugprone since they just take the next parameter which doesn't
start with `-`.

Also `--template` has not been documented since
17842394c0 back in 2011(!). And
`--template-location` has never been documented since its induction in
f058d9ad08. That's also why we can have a
short deprecation period.
2023-08-18 11:59:14 +02:00
Ryan M. Lederman d064f9c243
-j 0 causes indefinite hang. require >= 1 (#5326)
In cppcheck 2.11.1 (macOS), using `-j 0` actually causes cppcheck to do
nothing–it stalls indefinitely.

I could only find one place where `mSettings.jobs` was validated against
> 0 and it's simply an assert, so you wouldn't hit it in a release
build.

- Require -j >= 1 
- Cap -j at 1024, not 10000  (I don't even know what would happen if
you created 10,000 threads, but nothing good; likely exhaust virtual
memory or grind the process to a halt). 1024 is still obscene but there
may be some hypercomputers out there that have that many logical cores.
2023-08-14 11:55:32 +02:00
Oliver Stöneberg 693084470d
TestCmdlineParser: fixed some TODO test cases (#5325) 2023-08-14 11:37:59 +02:00
Oliver Stöneberg 2b3dec4418
TestCmdlineParser: properly reset settings and parser between tests (#5310) 2023-08-12 21:43:12 +02:00
Samuel Poláček b2511fb3ae
Check if --cppcheck-build-dir exists (#5254)
Cppcheck does not report that cppcheck build dir does not exist and also
does not report any write issues to the non-existent directory.

This means that cppcheck build dir is actually not used.

We should either create the directory or fail.
2023-08-04 17:38:43 +02:00
Daniel Marjamäki 55af68aaf7
Update type for Settings::checksMaxTime. (#5205)
It's a time offset not a size. It should not have value SIZE_MAX that
makes it ineffective (overflow in calculation of stop time).
2023-06-28 19:52:33 +02:00
Oliver Stöneberg 2935c855c3
reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
Oliver Stöneberg 5a2c31a41c
CmdLineParser: pass suppressions separately from settings (#5023) 2023-04-30 20:56:54 +02:00
Oliver Stöneberg 8cf6a22ea3
cleaned up includes based on `include-what-you-use` (#5021) 2023-04-30 07:33:19 +02:00
Oliver Stöneberg f5e51eace7
do not use string-to-integer conversions without error handling (#4906) 2023-04-08 22:29:09 +02:00
Oliver Stöneberg cfca3a69a2
optimized template string substitutions a bit (#4840) 2023-04-08 22:19:52 +02:00
Oliver Stöneberg 30131837b5
refs #11603 - deprecated `--enable=information` implicitly enabling `missingInclude` (#4865) 2023-03-09 20:04:20 +01:00
Oliver Stöneberg d17e804235
made `CmdLineParser::mSettings` a reference (#4855) 2023-03-07 12:11:21 +01:00
Oliver Stöneberg 5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups (#4791) 2023-03-03 18:36:27 +01:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
Oliver Stöneberg 14e78e1800
greatly improved error handling in Cppcheck project file parsing / some cleanups (#4752) 2023-02-08 20:30:43 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg f16ffd88e9
deprecate non-`native` platform being used by default in Windows builds (#4734)
* deprecate non-`native` platform being used by default in Windows builds

* test-helloworld.py: avoid deprecation warnings
2023-01-27 10:46:48 +01:00
Oliver Stöneberg 1d3955bd92
renamed some files in the `test` folder (#4705) 2023-01-27 08:18:32 +01:00
Oliver Stöneberg e5572835c0
fixed `platforms` lookup / set proper platform type for `unix32-unsigned` and `unix64-unsigned` / copy `platforms` in CMake (#4464) 2023-01-26 22:05:40 +01:00
Oliver Stöneberg 38abeccd24
added command-line option `--disable=<id>` to disable individual checks (#4712) 2023-01-21 10:39:44 +01:00
chrchr-github 11f1a9d1f5
Fix crash on ternary with omitted operand (#4673)
* Fix MSVC compiler warning

* Fix crash on incomplete ternary operator

* Revert "Fix crash on incomplete ternary operator"

This reverts commit 28df0f0ab6ff794e733617447f847a97c1a7a609.

* Handle ternary with omitted operand
2023-01-02 17:44:17 +01:00
Daniel Marjamäki bf11cdf299 TestCmdLineParser: Add tests for ignored paths 2023-01-01 15:32:37 +01:00
Oliver Stöneberg b380fd2589
added command-line option `--valueflow-max-iterations` to control amount of valueflow iterations / also log debug warning when iterations are being exceeded (#4557) 2022-12-20 20:51:08 +01:00