-
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
fixed #12811 - added CLI option --filesdir
to show the built-in FILESDIR
/ added TODOs
#7200
base: main
Are you sure you want to change the base?
Conversation
…LESDIR` / added TODOs
@@ -240,7 +240,7 @@ namespace { | |||
|
|||
void printRaw(const std::string &message) override | |||
{ | |||
std::cout << message << std::endl; | |||
std::cout << message << std::endl; // TODO: should not append newline |
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.
It is a bit of a misnomer right now since it is not raw
(it has been an awkward name to begin with) as it adds to it.
I have not changed it because it would have ripple effect beyond the actual change.
@@ -421,11 +421,18 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a | |||
return Result::Exit; | |||
} | |||
|
|||
if (std::strcmp(argv[i], "--filesdir") == 0) { | |||
#ifdef FILESDIR | |||
mLogger.printRaw(FILESDIR); // TODO: should not include newline |
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.
This should not include the newline because that means you can simply assign this to a variable but you always have to strip the newline which is extremely annoying in a shell environment.
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.
It makes sense to me that the newline is added. But maybe the name can be clarified instead.
@@ -1688,6 +1695,7 @@ void CmdLineParser::printHelp() const | |||
" --file-list=<file> Specify the files to check in a text file. Add one\n" | |||
" filename per line. When file is '-,' the file list will\n" | |||
" be read from standard input.\n" | |||
" --filesdir Print the built-in FILESDIR.\n" |
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.
hmm.. nobody has asked for this as far as I know. why do you add it?
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.
The interface of some linux tools is not very nice. Lots of options. I don't want to end up with 100's of options.
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.
hmm.. nobody has asked for this as far as I know.
Most of the issue we uncover have not been reported by the users. Would that be a reason not to fix them.
why do you add it?
Because outside of some debug messages (and that only recently) that path is not visible unless you dump all the strings used in the executable.
Also it is an absolute(!) path hard-coded by the packager(!) which a normal user cannot control.
And see the ticket for more reasoning.
@@ -421,11 +421,18 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a | |||
return Result::Exit; | |||
} | |||
|
|||
if (std::strcmp(argv[i], "--filesdir") == 0) { | |||
#ifdef FILESDIR | |||
mLogger.printRaw(FILESDIR); // TODO: should not include newline |
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.
It makes sense to me that the newline is added. But maybe the name can be clarified instead.
If no users are asking for a flag/option then I hesitate to add such flag. I don't understand the purpose still. From the ticket:
what would a regular user want to automate? those files are not supposed to be touched directly by the user. If you use a installation package / package manager you are not supposed to mess up the installed files. The user can build cppcheck without the FILESDIR and install it across multiple platforms. |
No description provided.