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

feat: Generate config descriptions #1842

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

PeterChen13579
Copy link
Collaborator

Fixes #1460

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 90.10989% with 9 lines in your changes missing coverage. Please review.

Project coverage is 71.74%. Comparing base (fbedeff) to head (7b431d6).
Report is 6 commits behind head on develop.

Files with missing lines Patch % Lines
src/util/newconfig/Types.hpp 85.18% 2 Missing and 2 partials ⚠️
src/util/newconfig/ConfigDescription.hpp 86.36% 1 Missing and 2 partials ⚠️
src/util/newconfig/ConfigConstraints.hpp 88.88% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1842      +/-   ##
===========================================
- Coverage    71.75%   71.74%   -0.02%     
===========================================
  Files          324      332       +8     
  Lines        13265    13504     +239     
  Branches      6742     6865     +123     
===========================================
+ Hits          9518     9688     +170     
- Misses        1907     1925      +18     
- Partials      1840     1891      +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -44,6 +45,7 @@ CliArgs::parse(int argc, char const* argv[])
description.add_options()
("help,h", "print help message and exit")
("version,v", "print version and exit")
("description,d", "generate config description")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
("description,d", "generate config description")
("config-description,d", "generate config description")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it probably should take a string where to put output file.

if (!file.is_open())
return std::unexpected<Error>{fmt::format("failed to create file: {}", kCONFIG_DESCRIPTION_FILE_NAME)};

file << "# Config Description Markdown File\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
file << "# Config Description Markdown File\n";
file << "# Clio Config Description\n";

return std::unexpected<Error>{fmt::format("failed to create file: {}", kCONFIG_DESCRIPTION_FILE_NAME)};

file << "# Config Description Markdown File\n";
file << "This is a **markdown** file listing all Clio Configurations in detail.\n\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think it is important to specify that this is a markdown file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea true, it's not important to say this is a markdown file


for (auto const& [key, val] : kCONFIG_DESCRIPTION) {
file << "### " << key << "\n";
file << val << "\n\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to also add type and constraints for each config entry.

TEST_F(CliArgsTests, Parse_ConfigDescription)
{
using namespace util::config;
std::array argv{"clio_server", "--description"}; // NOLINT(bugprone-suspicious-stringview-data-usage)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the comment be on the next line?

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.

Add descriptive info about various fields of Clio config.
2 participants