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

Added checks for description and longDescription length, description being non-empty #333

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

Onyx2406
Copy link
Contributor

@Onyx2406 Onyx2406 commented Mar 8, 2023

fixes #332 and #336

@kelson42 kelson42 marked this pull request as draft March 8, 2023 09:51
@kelson42
Copy link
Contributor

kelson42 commented Mar 8, 2023

@Onyx2406 In case this is not clear, you don't have implemented everything requested.

@Onyx2406
Copy link
Contributor Author

can you review this now? @kelson42

I made some commits

@Onyx2406 Onyx2406 marked this pull request as ready for review March 19, 2023 10:01
@rgaudin rgaudin requested a review from kelson42 March 19, 2023 11:29
Copy link
Contributor

@kelson42 kelson42 left a comment

Choose a reason for hiding this comment

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

Update the usage() as well

src/zimwriterfs/zimwriterfs.cpp Outdated Show resolved Hide resolved
src/zimwriterfs/zimwriterfs.cpp Outdated Show resolved Hide resolved
@Onyx2406
Copy link
Contributor Author

Done @kelson42

Copy link
Contributor

@kelson42 kelson42 left a comment

Choose a reason for hiding this comment

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

LGTM, requesting @veloman-yunkan for a more technical review.

Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

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

Please squash all commits into one.

src/zimwriterfs/zimwriterfs.cpp Show resolved Hide resolved
Comment on lines 307 to 320
if (description.length() > 80) {
std::cerr << "Description length exceeds the 80 character limit." << std::endl;
exit(1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Please fix the indentation
  2. Do we allow empty descriptions? Should we impose a lower limit on the length of the short description?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we allow empty descriptions?

#336 says "no". So we can fix that ticket in this PR too.

src/zimwriterfs/zimwriterfs.cpp Outdated Show resolved Hide resolved
@Onyx2406 Onyx2406 force-pushed the main branch 3 times, most recently from a305a39 to c922868 Compare March 21, 2023 06:20
@Onyx2406
Copy link
Contributor Author

Done @kelson42 , can you review?

@kelson42
Copy link
Contributor

@Onyx2406 I have already approved, @veloman-yunkan is your reviewer now. You don't need to put a comment, just click on the review rerequesting icon.

Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

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

The commit description must be edited

src/zimwriterfs/zimwriterfs.cpp Outdated Show resolved Hide resolved
src/zimwriterfs/zimwriterfs.cpp Outdated Show resolved Hide resolved
@Onyx2406 Onyx2406 changed the title Added checks for description and longDescription length. Added checks for description and longDescription length, description being non-empty Mar 21, 2023
Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

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

Code is good. However the commit message body contains some text that has little to no value. Once the commit message is fixed this PR can be merged.

Note that std::string::length() returns the size of the string in bytes rather than in characters, i.e. the checks will not work correctly on non-ascii texts. But that can be fixed in s separate PR.

@Onyx2406
Copy link
Contributor Author

Code is good. However the commit message body contains some text that has little to no value. Once the commit message is fixed this PR can be merged.

Note that std::string::length() returns the size of the string in bytes rather than in characters, i.e. the checks will not work correctly on non-ascii texts. But that can be fixed in s separate PR.

Hi, which commit message body? Can you maybe give reference.

@veloman-yunkan
Copy link
Collaborator

Hi, which commit message body? Can you maybe give reference.

Your PR contains only one commit. Its description (commit message) reads

Added checks for description and longDescription length.

Update zimwriterfs.cpp

Update zimwriterfs.cpp

Update zimwriterfs.cpp

Update zimwriterfs.cpp

added a check on description being non-empty

The first line (the commit title) is fine (I just figured out that the fact that a new option --longDescription was added is not reflected). The rest (body) doesn't add any valuable information in excess of what is found in the title.

A better commit description should be, for example:

zimwriterfs: added new option --longDescription

Also

  • made the --description option mandatory (its value cannot be empty)
  • checking that the lengths of the short and long descriptions are below their respective limits (80 and 4000)
  • the long description is optional; however, if provided, it must not be shorter than the short description

Copy link
Collaborator

@veloman-yunkan veloman-yunkan left a comment

Choose a reason for hiding this comment

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

The title of the commit message is too long - it exceeds the recommended limit, hence part of the title is moved into the body. If you want to mention the new checks in the title, you better split your changes into two commits:

  1. Introduce the checks on --description option
  2. Add --longDescription option (along with its own checks, but the latter part doesn't need to be in the commit title)

@Onyx2406
Copy link
Contributor Author

The title of the commit message is too long - it exceeds the recommended limit, hence part of the title is moved into the body. If you want to mention the new checks in the title, you better split your changes into two commits:

  1. Introduce the checks on --description option
  2. Add --longDescription option (along with its own checks, but the latter part doesn't need to be in the commit title)

Looks good now..

@kelson42
Copy link
Contributor

@veloman-yunkan @Onyx2406 Part of the CI does not pass, it seems to me we have a regression here.

@veloman-yunkan
Copy link
Collaborator

@veloman-yunkan @Onyx2406 Part of the CI does not pass, it seems to me we have a regression here.

Indeed. I missed a missing closing brace during review since I trust the compiler. Looks like @Onyx2406 didn't build the latest code before requesting review.

@veloman-yunkan
Copy link
Collaborator

@kelson42 BTW, I wonder why the list of CI jobs in this PR is limited to Packages workflows.

@mgautierfr
Copy link
Collaborator

@kelson42 BTW, I wonder why the list of CI jobs in this PR is limited to Packages workflows.

This is because the PR is coming from a branch in another repository. And the CI workflow is not run for security reasons.
However, we may have to check the exact status about that and do something to homogenize all CIs.

@Onyx2406 Onyx2406 force-pushed the main branch 2 times, most recently from f8a7f8a to ec80394 Compare March 22, 2023 13:28
@Onyx2406
Copy link
Contributor Author

@veloman-yunkan @Onyx2406 Part of the CI does not pass, it seems to me we have a regression here.

Indeed. I missed a missing closing brace during review since I trust the compiler. Looks like @Onyx2406 didn't build the latest code before requesting review.

should pass now @veloman-yunkan

made the --description option mandatory (its value cannot be empty)

checking that the lengths of the short and long descriptions are below
their respective limits (80 and 4000)

the long description is optional; however, if provided, it must not be
shorter than the short description
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.

zimwriterfs should allow the new --longDescription
4 participants