redhataccess / pantheon-cmd

Pantheon CMD is an open source and freely distributed program for validating and building local previews of modular documentation.
GNU General Public License v3.0
2 stars 5 forks source link

Potential glitch in the test case to check comment after the additional resources header #49

Closed soulcharmer closed 3 years ago

soulcharmer commented 3 years ago

I started to review and fix pcmd validate results in the RHEL 8 repo and saw a few things worth checking:

FAIL: a comment after the additional resources header was found in the following files: rhel-8/modules/core-kernel/proc_changing-kernel-command-line-parameters-for-all-boot-entries.adoc

"
[role="_additional-resources"]
.Additional resources
* xref:understanding-kernel-command-line-parameters_configuring-kernel-command-line-parameters[Understanding kernel command-line parameters]
* `grubby(8)` and `zipl(8)` manual pages
* [citetitle]_link:++https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-working_with_the_grub_2_boot_loader#sec-Making_Persistent_Changes_to_a_GRUB_2_Menu_Using_the_grubby_Tool++  [grubby tool]_

// Content for future module - "Other ways of changing kernel command line parameters (vbendel userstory RHELPLAN-34909)"

...
"

Looks like a false positive, a comment is just further below and away from the header

Levi-Leah commented 3 years ago

@soulcharmer This is not entirely a bug but a known behavior. https://github.com/redhataccess/pantheon-cmd/blob/702d3aa54e315150c9d8405da6e246a848597e9f/PantheonCMD/pcchecks.py#L199

The validator maintains 2 versions of the file. One is the original, the other one is the modified version with removed single line and multi line comments. The validator checks if the modified version has an additional resources section and if it does, it then checks the original version for the comment after the additional resources section.

If there are 2 additional resources section, one commented out and one not commented out, the validator would pick on the commented out section while performing the check, as there's no way to check the modified version for the comments cause they are, well, removed.

In this particular example, the test picked up on the commented out additional resources section on lines 81-82 of rhel-8/modules/core-kernel/proc_changing-kernel-command-line-parameters-for-all-boot-entries.adoc file:

//.Additional resources
//

I can add a negative lookbehind to the regular expression that'll prevent the test from picking up additional resources section if it has // before it, but it'll still pick up on additional resources section inside a multi-line comment, e.g.:

////
.Additional resources
//
////

or:

////
.Additional resources
/////
something commented out
////
////

That being said, I don't think a comment would prevent files from rendering properly. Can you perhaps confirm that by uploading a test file to Pv2? In which case I'll just remove this test altogether.

soulcharmer commented 3 years ago

Finally, I was able to check in Pv2 that neither one-line nor multiline comments do nothing to how the Add.resources box is rendered. I think we can remove this test case.