`CppCheckExecutor` contains some code which is not related to the
execution but actually to the creation of the settings. This is causing
inconsistencies in the error handling/logging as well as interfering
with the testability.
As we now fail early on loading of all libraries we no longer need to
explicitly bail out on mandatory ones. This would have also caused
`libraries` and `library` to go out-of-sync and possibly lead to
duplicated loading of the library. It also allows for a
`CppCheckExecutor` to be made private.
Moved the `FileSettings` out of the `Settings` and pass them around
explicitly. They can never be specified at the same time and are used
exclusively. The code hasn't been fully adjusted to reflect this as this
is only the refactoring without any functional changes.
`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.
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`
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.
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.
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.
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.
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.
This is a mess. The version is AUR is still outdated and also doesn't
install anymore. Fedora 38 carries the latest version of it so use that
now. Keep the old steps in case we need to switch again in the future.
* Use path to executable when trying to load library
* Fix function call, add support for more OS, add test
* Format
* Handle MacOS
* Amend
* Argument as fallback
* Use Path::getCurrentExecutablePath()
* Move to cmdlineparser.cpp
* Debug output
* Use argv[0] in Cygwin
* Revert "Debug output"
This reverts commit 5a68d71f1d27549c7b4a46363f3cd5cd912018e7.
* Use native python in Cygwin