Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

firewave
Copy link
Collaborator

@firewave firewave commented Jan 9, 2025

No description provided.

@@ -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
Copy link
Collaborator Author

@firewave firewave Jan 9, 2025

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
Copy link
Collaborator Author

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.

Copy link
Owner

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"
Copy link
Owner

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?

Copy link
Owner

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.

Copy link
Collaborator Author

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
Copy link
Owner

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.

@danmar
Copy link
Owner

danmar commented Jan 14, 2025

Most of the issue we uncover have not been reported by the users. Would that be a reason not to fix them.

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:

That makes it hard to automate something related to that path and files in some tooling across multiple platforms.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants