Skip to content

fixed #12811 - added CLI option --filesdir to show the built-in FILESDIR / added TODOs#7200

Merged
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:filesdir-cmd
Mar 15, 2025
Merged

fixed #12811 - added CLI option --filesdir to show the built-in FILESDIR / added TODOs#7200
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:filesdir-cmd

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

@firewave firewave commented Jan 9, 2025

No description provided.

Comment thread cli/cppcheckexecutor.cpp
void printRaw(const std::string &message) override
{
std::cout << message << std::endl;
std::cout << message << std::endl; // TODO: should not append newline
Copy link
Copy Markdown
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.

Comment thread cli/cmdlineparser.cpp

if (std::strcmp(argv[i], "--filesdir") == 0) {
#ifdef FILESDIR
mLogger.printRaw(FILESDIR); // TODO: should not include newline
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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.

Comment thread cli/cmdlineparser.cpp Outdated
" --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
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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
Copy Markdown
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.

Comment thread cli/cmdlineparser.cpp

if (std::strcmp(argv[i], "--filesdir") == 0) {
#ifdef FILESDIR
mLogger.printRaw(FILESDIR); // TODO: should not include newline
Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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.

@firewave
Copy link
Copy Markdown
Collaborator Author

See conda-forge/cppcheck-feedstock#19 for a case where this would be helpful.

The user can build cppcheck without the FILESDIR and install it across multiple platforms.

This was actually not possible in all cases until recently.

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Feb 5, 2025

I feel this is something that should be added to --help-all or something instead.

@firewave
Copy link
Copy Markdown
Collaborator Author

firewave commented Feb 7, 2025

I feel this is something that should be added to --help-all or something instead.

Definitely. That's where it will be grouped in when we rework that.

@firewave firewave force-pushed the filesdir-cmd branch 3 times, most recently from 693e0bc to 3b74b01 Compare February 14, 2025 22:04
@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Feb 24, 2025

Definitely. That's where it will be grouped in when we rework that.

I would prefer that it's not added to --help at all

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Feb 24, 2025

If you remove it from --help then you can merge this.. but maybe you rather wait for --help-all.

@firewave
Copy link
Copy Markdown
Collaborator Author

If you remove it from --help then you can merge this.. but maybe you rather wait for --help-all.

Will do.

@firewave firewave marked this pull request as draft March 15, 2025 07:11
@firewave
Copy link
Copy Markdown
Collaborator Author

If you remove it from --help then you can merge this.. but maybe you rather wait for --help-all.

Done.

@firewave firewave marked this pull request as ready for review March 15, 2025 08:22
@firewave firewave merged commit 313cec4 into cppcheck-opensource:main Mar 15, 2025
78 of 79 checks passed
@firewave firewave deleted the filesdir-cmd branch March 15, 2025 09:33
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