-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #12771: Progress value is not increased #6993
Open
ludviggunne
wants to merge
27
commits into
danmar:main
Choose a base branch
from
ludviggunne:12771
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
245636f
fix #12771
ludviggunne c35fd05
fix #12771 for ThreadExecutor
ludviggunne 53d7585
use _stati64 on 64 bit windows
ludviggunne b25503d
move (most of the) file size logic to FileWithDetails
ludviggunne 09936ca
use accumulate
ludviggunne 4571588
update dmake dependencies
ludviggunne 8129131
add const
ludviggunne 8f5df68
remove unused includes
ludviggunne 8cd166d
add test
ludviggunne 3933832
move test
ludviggunne 037c6ad
rebase
ludviggunne 037cffe
fix path
ludviggunne 3b7ed50
calculate percentage in test
ludviggunne 11f7685
account for different file orders
ludviggunne 5a97406
account for spaces in filenames
ludviggunne 758b7ed
move filesize logic to path.cpp
ludviggunne 4dc6684
set file sizes in CmdLineParser::fillSettingsFromArgs
ludviggunne ccad3f0
store filesize in pipeFile map
ludviggunne 456de96
remove -j2 in progress test
ludviggunne 2e09d44
update dmake
ludviggunne 46e2a80
don't use ssize_t
ludviggunne 006c9f4
fix typo
ludviggunne cd4ff8a
base percentage on file size in SingleExecutor
ludviggunne a9570ae
add test for .cppcheck files
ludviggunne feb624b
Update test/cli/proj2_test.py
ludviggunne c3a9e9c
fix FileWithDetails constructor
ludviggunne 2ddba93
add test for files specified on command line
ludviggunne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,8 @@ class ThreadData | |
mTotalFiles = mFiles.size() + mFileSettings.size(); | ||
mTotalFileSize = std::accumulate(mFiles.cbegin(), mFiles.cend(), std::size_t(0), [](std::size_t v, const FileWithDetails& p) { | ||
return v + p.size(); | ||
}) + std::accumulate(mFileSettings.cbegin(), mFileSettings.cend(), std::size_t(0), [](std::size_t v, const FileSettings& p) { | ||
return v + p.filesize(); | ||
}); | ||
} | ||
|
||
|
@@ -104,7 +106,7 @@ class ThreadData | |
if (mItNextFileSettings != mFileSettings.end()) { | ||
file = nullptr; | ||
fs = &(*mItNextFileSettings); | ||
fileSize = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make sure we always fetch the filesize we probably should initialize/set it to -1 everywhere and valid that later on. Can be done at a later date though. |
||
fileSize = mItNextFileSettings->filesize(); | ||
++mItNextFileSettings; | ||
return true; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you use
mLogger.printError
then it feels like we should abort. But I think it's unfortunate to abort if there are missing files. Could we write some proper cppcheck warnings during the analysis instead if a file cannot be opened.How about just setting filesize to -1 or something:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the files can just be removed from the list (after showing a warning)? That way we don't have to care about it when calculating the total file size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that error happens we should bail out - otherwise we would silently (nobody cares about the warnings because they are not visible in a headless system - yet) drop a file from the analysis which might cause issues to slip through or lead to inconsistent results between runs.
This should only happen if there are filesystem issues or somebody is modifying the data. You should avoid that. e.g. in the CLion IDE integration I pass a fixed temporary file to the analysis to avoid that a file which might constantly being changed is being read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
mLogger.printError(error);
is used and Cppcheck just aborts then I see the risk that Cppcheck plugins will silently just fail and the user get no proper information. For instance the vscode plugin does not show the CppcheckprintError
output it just does not recognize its output and aborts. It just says "Failed to execute Cppcheck" or something like that.I don't know what you talk about. It would be pointless to run Cppcheck at all if nobody cares about the warnings. I want that we report proper Cppcheck warning output so the plugins have a good chance to show the output.
Yeah sure.. but we do run into this sometimes. And it would be nice to be able to scan a project even if some files are autogenerated during build or whatever..