[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CHECKSTYLE: Report problems with a non-zero status
From: |
Alejandro Colomar (man-pages) |
Subject: |
Re: CHECKSTYLE: Report problems with a non-zero status |
Date: |
Wed, 2 Feb 2022 02:46:28 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 |
Hi Branden,
On 2/1/22 20:34, G. Branden Robinson wrote:
> I have a recommendation or two for how you should be able to get the
> behavior you want.
>
> Quoting your commit diff above...
>
> +DEFAULT_GROFFFLAGS := -man
> +DEFAULT_GROFFFLAGS += -rCHECKSTYLE=3
> +DEFAULT_GROFFFLAGS += -z
> +EXTRA_GROFFFLAGS :=
> +GROFFFLAGS := $(DEFAULT_GROFFFLAGS)
> +GROFFFLAGS += $(EXTRA_GROFFFLAGS)
>
> +$(MAN_cks): $(builddir)/%.cks.touch: $(MANDIR)/% Makefile | $$(@D)/.
> + $(info GROFF CHECKSTYLE $@)
> + $(GROFF) $(GROFFFLAGS) $<
> + touch $@
>
> You can do the following:
>
> +DEFAULT_GROFFFLAGS += -Msomedir -mdeadly
>
> Where "somedir" is a convenient directory in your source tree; I'm not
> sure quite where would make the most sense for you, and I didn't study
> the project closely. (Sorry, working on groff... :-| )
>
> The next thing to do is create a file, "deadly.tmac", in that same
> convenient directory you chose.
>
> cat > deadly.tmac
> .am an-style-warn
> . ds LANDMINE\"
> ..
> .de end-of-input-macro
> . if d LANDMINE .ab found style problems; aborting
> ..
> .em end-of-input-macro
>
> It looks like you're using the default output device, so you don't need
> to worry about the fact that continuous rendering mode already sets up
> an end-of-input macro. If you've changed your default output device
> (say, with GROFF_TYPESETTER), then you need to append to the existing
> one instead of installing a new one.
>
> .am an-end
> . if d LANDMINE .ab found style problems; aborting
>
> This should suffice to make the style warnings lethal. The `ab` request
> causes troff to exit with a nonzero exit status, which will percolate up
> through groff in a way that wasn't documented until recently[1].
>
> If you want the formatter to blow up on the _first_ occurrence of a
> style problem, that's even easier.
>
> cat > deadly.tmac
> .am an-style-warn
> . ab
>
> Does this help?
It's up and running. Now I can try to learn all of those groff requests
with time.
It works perfectly, so please dismiss this bug report. I think this
configurability is better than having a hardcoded default, even if the
default could be better than the current default.
Cheers,
Alex
---
commit f16c1c2a8269a3b1ec2718621b949f2c931df8d2 (HEAD -> main, alx/main,
alx/HEAD)
Author: Alejandro Colomar <alx.manpages@gmail.com>
Date: Wed Feb 2 02:38:45 2022 +0100
Makefile, etc/groff/deadly.tmac: Cause groff to error out when
reporting CHECKSTYLE errors
Suggested-by: "G. Branden Robinson" <g.branden.robinson@gmail.com>
Link: groff@
<https://lists.gnu.org/archive/html/groff/2022-02/msg00000.html>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
diff --git a/Makefile b/Makefile
index bd9a8e6..5813009 100644
--- a/Makefile
+++ b/Makefile
@@ -98,9 +98,14 @@ EXTRA_CPPLINTFLAGS :=
CPPLINTFLAGS := $(DEFAULT_CPPLINTFLAGS)
CPPLINTFLAGS += $(EXTRA_CPPLINTFLAGS)
+groff_tmac_dir := $(SYSCONFDIR)/groff
+groff_tmac_names := deadly
+groff_tmac_files := $(foreach
x,$(groff_tmac_names),$(groff_tmac_dir)/$(x).tmac)
DEFAULT_GROFFFLAGS := -man
DEFAULT_GROFFFLAGS += -rCHECKSTYLE=3
DEFAULT_GROFFFLAGS += -z
+DEFAULT_GROFFFLAGS += -M $(groff_tmac_dir)
+DEFAULT_GROFFFLAGS += $(foreach x,$(groff_tmac_names),-m $(x))
EXTRA_GROFFFLAGS :=
GROFFFLAGS := $(DEFAULT_GROFFFLAGS)
GROFFFLAGS += $(EXTRA_GROFFFLAGS)
@@ -212,7 +217,9 @@ $(UNITS_cpl): $(builddir)/%.cpl.touch: $(SRCDIR)/%.c
Makefile \
$(CPPLINT) $(CPPLINTFLAGS) $< >/dev/null
touch $@
-$(MAN_cks): $(builddir)/%.cks.touch: $(MANDIR)/% Makefile | $$(@D)/.
+$(MAN_cks): $(builddir)/%.cks.touch: $(MANDIR)/% Makefile \
+ $(groff_tmac_files) \
+ | $$(@D)/.
$(info GROFF CHECKSTYLE $@)
$(GROFF) $(GROFFFLAGS) $<
touch $@
diff --git a/etc/groff/deadly.tmac b/etc/groff/deadly.tmac
new file mode 100644
index 0000000..b87cb6a
--- /dev/null
+++ b/etc/groff/deadly.tmac
@@ -0,0 +1,7 @@
+.am an-style-warn
+. ds LANDMINE\"
+..
+.de end-of-input-macro
+. if d LANDMINE .ab found style problems; aborting
+..
+.em end-of-input-macro
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/