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

doc/manpages: New "lint" target to check generated man-pages #331

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mobin-2008
Copy link
Collaborator

This new script will check every generated man-page to find anything wrong.
See #330 for an example.

There will be a workflow for checking them in CI.

Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>

This new script will check every generated man-page to find anything wrong.

See davmac314#330 for an example.

Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
@mobin-2008 mobin-2008 marked this pull request as draft May 12, 2024 19:19
@mobin-2008 mobin-2008 added Enhancement/New Feature Improving things or introduce new feature A-Importance: Low Issues such as harmless typos are included in this category. CI Things about CI/CD Docs Things about docs labels May 12, 2024
@mobin-2008
Copy link
Collaborator Author

mobin-2008 commented May 12, 2024

@davmac314 Is it useful for man-pages? I think yes.

Currently it's marked as draft because we need to adjust warnings that we want and it's missing a CI workflow.
It's an example of script's output (except "date" warning):

$ make -C doc/manpages/ lint
gmake: Entering directory '/home/mobin/Documents/git/dinit/doc/manpages'
m4 -DVERSION=0.18.1pre -DMONTH=January -DYEAR=2024 -DDEFAULT_AUTO_RESTART=true\
   -DDEFAULT_START_TIMEOUT=60\
   -DDEFAULT_STOP_TIMEOUT=10 dinit-service.5.m4 > dinit-service.5
./mandoc-lint.sh
mandoc: dinit.8:237:2: WARNING: skipping paragraph macro: PP after SH
mandoc: dinit.8:286:2: WARNING: skipping paragraph macro: PP after SH
mandoc: dinitctl.8:252:1: WARNING: invalid escape sequence: \f[C]
mandoc: dinitctl.8:253:1: WARNING: invalid escape sequence: \f[C]
mandoc: dinitctl.8:254:1: WARNING: invalid escape sequence: \f[C]
mandoc: dinitctl.8:255:1: WARNING: invalid escape sequence: \f[C]
mandoc: dinitctl.8:256:1: WARNING: invalid escape sequence: \f[C]
mandoc: dinitctl.8:257:1: WARNING: invalid escape sequence: \f[C]
mandoc: dinit-monitor.8:43:42: WARNING: invalid escape sequence: \br\fB\-\-test\fR
mandoc: dinit-service.5:638:2: ERROR: skipping end of block that is not open: RE
mandoc: dinit-service.5:638:2: WARNING: skipping paragraph macro: br at the end of SS
mandoc: dinit-service.5:717:2: WARNING: skipping paragraph macro: PP after SH
There is some error/warning around man-pages, Exiting with 1...
gmake: *** [Makefile:27: lint] Error 1
gmake: Leaving directory '/home/mobin/Documents/git/dinit/doc/manpages'

Comment on lines +25 to +30
# There is an annoying warning about date from mandoc:
#
# mandoc: ./dinit-service.5:1:23: WARNING: cannot parse date, using it verbatim: TH January 2024
#
# We want to get rid of it.
suppress_warning "WARNING: cannot parse date, using it verbatim:"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this a good thing?

Copy link
Owner

Choose a reason for hiding this comment

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

You tell me! What date format is it expecting? Do other man pages (other projects) conform to what it expects?

In general I don't think it's a good idea to try to filter the output of a tool in this way, though.

@mobin-2008 mobin-2008 force-pushed the fix_doc branch 2 times, most recently from ebd8e68 to efea95e Compare May 13, 2024 13:12
Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
@mobin-2008 mobin-2008 changed the title Draft: doc/manpages: New "lint" target to check generated man-pages doc/manpages: New "lint" target to check generated man-pages May 13, 2024
@mobin-2008 mobin-2008 marked this pull request as ready for review May 13, 2024 13:18
@mobin-2008 mobin-2008 requested a review from davmac314 May 13, 2024 13:18
@mobin-2008
Copy link
Collaborator Author

CI workflow has been added. Failure is because of current warnings from mandoc.

@davmac314
Copy link
Owner

I'm not convinced these warnings are accurate enough generally to make this a gate requirement for CI. I see both incorrect warnings:

mandoc: dinit.8:237:2: WARNING: skipping paragraph macro: PP after SH

(It's an LP after the SH, not a PP)

and warnings about sequences that groff understands but that mandoc doesn't:

mandoc: dinitctl.8:252:1: WARNING: invalid escape sequence: \f[C]

I haven't evaluated the rest of the warnings. As the person who instigated this, you should do that yourself. Figure out what the warnings mean, whether they are correct, what is required to fix them and whether it is worth doing so. There is at least one thing actually worth fixing - so it would be good if you could raise a PR to fix that and any other genuine issues - but unless you can provide a better idea of how actually useful this is, I don't want it to be part of CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Importance: Low Issues such as harmless typos are included in this category. CI Things about CI/CD Docs Things about docs Enhancement/New Feature Improving things or introduce new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants